I'm trying to crop an image before applying CNN. I do not understand the above method of cropping. I understand that it is attempting to crop the image but do not understand the negative value.
Asked
Active
Viewed 18 times
-2
-
1Does this answer your question? [How does slice indexing work in numpy array](https://stackoverflow.com/questions/55581540/how-does-slice-indexing-work-in-numpy-array) – Tomerikoo Feb 04 '21 at 15:15
-
Also helpful [Understanding slice notation](https://stackoverflow.com/questions/509211/understanding-slice-notation) – Tomerikoo Feb 04 '21 at 15:17
1 Answers
0
This looks like NumPy advanced indexing, where you specify the indices for each axis, separated by commas. As for the negative, when indexing in Python a negative number indicates the index starts from the end and not the beginning. So, 60:-25
means starting from index 60 and ending 25 indices from the end.

Andy
- 3,132
- 4
- 36
- 68