Fix band check bug in split_raster and typo fixes#1301
Fix band check bug in split_raster and typo fixes#1301abhayrajjais01 wants to merge 1 commit intoweecology:mainfrom
Conversation
- Fix bug in preprocess.py where band count check used shape[2] (width) instead of shape[0] (channels) after transposing to channels-first format - Fix typo 'prediciton' -> 'prediction' in evaluate.py docstring - Fix typo 'prediciton' -> 'prediction' in predict.py comment
b9588a2 to
b391811
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1301 +/- ##
==========================================
- Coverage 87.89% 87.16% -0.74%
==========================================
Files 20 21 +1
Lines 2776 2851 +75
==========================================
+ Hits 2440 2485 +45
- Misses 336 366 +30
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
@abhayrajjais01, thank you for the PR. We need a bit more information to properly document this patch and the findings. Could you please let us know how you discovered this bug, specifically which scripts or functions you were running at the time? |
|
I found this while reading the split_raster function to understand how numpy images are validated. After transpose(2, 0, 1) converts (H, W, C) to (C, H, W), line 210 reads shape[2] which is now the width dimension. For a 400×400×3 image, bands = 400, the warning fires incorrectly, and numpy_image[:3, :, :] selects 3 rows rather than 3 channels. I also noticed that if shape[2] is not in [3, 4] (like 5-band input), the image is not transposed, but [:3, :, :] still runs on a channels-last array |
Description
band check was reading width instead of channels after transpose