weecology / DeepForest-pytorch

Pytorch implementation of the deepforest model for tree crown RGB detection.
MIT License
17 stars 9 forks source link

Error in predict_tile #56

Closed dwaipayan05 closed 3 years ago

dwaipayan05 commented 3 years ago

Could someone tell me what am I doing wrong here ?

After pip install deepforest-pytorch. Imported Release Model

test_model = main.deepforest()
test_model.use_release()

Tried Predicting Tile with Sample Data already provided

raster_path = get_data("OSBS_029.tif")
predicted_raster = test_model.predict_tile(raster_path, return_plot = True, patch_size=300,patch_overlap=0.25)

Received the following error

ValueError                                Traceback (most recent call last)
<ipython-input-26-923b61ec3ff0> in <module>()
      1 raster_path = get_data("OSBS_029.tif")
----> 2 predicted_raster = test_model.predict_tile(raster_path, return_plot = True, patch_size=400,patch_overlap=0.25)

9 frames
/usr/local/lib/python3.7/dist-packages/tifffile/tifffile.py in decode(exc, *args, **kwargs)
   5788 
   5789             def decode(*args, exc=str(exc)[1:-1], **kwargs):
-> 5790                 raise ValueError(f'TiffPage {self.index}: {exc}')
   5791 
   5792             return cache(decode)

ValueError: TiffPage 0: <COMPRESSION.LZW: 5> requires the 'imagecodecs' package

Environment : Google Colab

bw4sz commented 3 years ago

Pip install imagecodecs, looks like it needs to be added to setup.py and requirements

On Fri, Apr 9, 2021 at 11:15 PM Dwaipayan Munshi @.***> wrote:

Could someone tell me what am I doing wrong here ?

After pip install deepforest-pytorch. Imported Release Model

test_model = main.deepforest()test_model.use_release()

Tried Predicting Tile with Sample Data already provided

raster_path = get_data("OSBS_029.tif")predicted_raster = test_model.predict_tile(raster_path, return_plot = True, patch_size=300,patch_overlap=0.25)

Received the following error

ValueError Traceback (most recent call last)

in () 1 raster_path = get_data("OSBS_029.tif") ----> 2 predicted_raster = test_model.predict_tile(raster_path, return_plot = True, patch_size=400,patch_overlap=0.25) 9 frames /usr/local/lib/python3.7/dist-packages/tifffile/tifffile.py in decode(exc, *args, **kwargs) 5788 5789 def decode(*args, exc=str(exc)[1:-1], **kwargs): -> 5790 raise ValueError(f'TiffPage {self.index}: {exc}') 5791 5792 return cache(decode) ValueError: TiffPage 0: requires the 'imagecodecs' package *Environment* : Google Colab — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub , or unsubscribe . -- Ben Weinstein, Ph.D. Postdoctoral Fellow University of Florida http://benweinstein.weebly.com/
dwaipayan05 commented 3 years ago

I did try ! pip install imagecodecs before posting the issue here. It didn't work

bw4sz commented 3 years ago

As a general rule 'it didn't work', is very unhelpful. Please provide code and error messages if you want support.

dwaipayan05 commented 3 years ago

As a general rule 'it didn't work', is very unhelpful. Please provide code and error messages if you want support.

Apologies about that. It's my fault, I did do pip install imagecodecs However, it showed the same error on that runtime because I didn't restart the runtime.

I found it out when I tried again now. pip install imagecodecs solves this problem

Thank you

dwaipayan05 commented 3 years ago

Or maybe it worked because of the recent PR that added imagecodecs . I am not sure Anyways, it works perfectly now

bw4sz commented 3 years ago

the PR would not have taken effect yet. I appreciate your help, but please try to be more thorough and first checking when submitting issues.

On Sat, Apr 10, 2021 at 8:21 AM Dwaipayan Munshi @.***> wrote:

Or maybe it worked because of the recent PR that added imagecodecs . I am not sure Anyways, it works perfectly now

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/weecology/DeepForest-pytorch/issues/56#issuecomment-817152823, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJHBLEAAUB5VWN4DNI35TLTIBUJDANCNFSM42WFILJA .

-- Ben Weinstein, Ph.D. Postdoctoral Fellow University of Florida http://benweinstein.weebly.com/

dwaipayan05 commented 3 years ago

Yes, I'll keep that in mind @bw4sz Sorry for the trouble !