Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pillow Image class has no attribute shape #889

Closed
potipot opened this issue Jul 12, 2021 · 3 comments · Fixed by #894
Closed

Pillow Image class has no attribute shape #889

potipot opened this issue Jul 12, 2021 · 3 comments · Fixed by #894
Labels
bug Something isn't working

Comments

@potipot
Copy link
Contributor

potipot commented Jul 12, 2021

🐛 Bug

Describe the bug
Pillow Image class has no attribute shape. When using open_image function from utils/image_io.py the shape property is not defined for Pil Image class.

This has been changed in 0.8.1 where we return PIL image instead of numpy array. To fix this one should try to access Image.height and Image.width fields instead or read these values from Image.size property.

Expected behavior
The show_records should be able to open the image without issues.

Screenshots

show_records(records[:1])

obraz

Desktop (please complete the following information):

  • OS: Windows 10

Additional context

height, width = img.shape

@potipot potipot added the bug Something isn't working label Jul 12, 2021
@potipot
Copy link
Contributor Author

potipot commented Jul 12, 2021

this might be coming from the python poetry installation file. It is reproducible if icevision=0.8.1 is installed without specifying [all] egg

@jayqi
Copy link

jayqi commented Oct 29, 2021

Hi @ai-fast-track or other maintainers. We ran into this bug on the latest release (0.8.1). Can you please make a new release with this fix included?

@jpsimen
Copy link

jpsimen commented Nov 8, 2021

+1 for a new release, please.

FraPochetti pushed a commit that referenced this issue Mar 30, 2022
* Fixed PIL size bug in ImageRecordComponent (#889)

* Preliminary work on mmsegmentation integration

This is currently very crude, mostly copy/pasting of the mmdet integration with a few changes.

* Updated mmseg dataloaders based on unet implementation

* Training now kind of working!

- Fixed issue with number of classes
- Fixed dataloader issue (mask tensor size)

* Improved predictions handling

* Fixed prediction, general code clean-up

* Simplification of folder structure

* Getting closer to final structure

* Finished first structure update

- This implementation was created based on the existing mmdet integration, and some remaining, unused folders, were removed

* Attempt to fix show_batch for mmseg

* Added binary and multi-class dice coefficient metrics

* Removed test-only code in binary Dice coefficient method

* Initial support for multiple pre-trained variants

* Reformatting using black

* First version of DeepLabV3plus support

* Exceptions to elegantly handled unknown pre-trained variants

* Added all DeepLabV3 pretrained variants

* Ground truth masks saved with predictions if keep_images set to True

* Added all DeepLabV3Plus pre-training variants

* Added proper support for param_groups

* Removed erroneous pre-trained variants for DeepLabV3Plus

* Fixed erroneous DeepLabV3 pre-trained variants

* re-added default values to DeepLabV3 pretrained variants

* Improved model loading and initialization

* Improved how distributed BNs are handled

* - Proper integration of loop_mmseg
- First test!

* Updated tests

* __init__.py file

* jaccard index metric

* update init file to include multilabel dice coef

* updates to logical statements

* update to handle denominator equal to 0

* update to handle denominator equal to 0

* removed repeated code

* removed repeated code

* Getting started with seg notebook

* Formatting fix (black)

* Removed temporary file

* Added mmsegmentation to Dockerfile

* Added mmseg installation to workflows

* Updating mmcv to 1.3.7 for mmseg support

* Added artifacts to gitignore (wandb)

* Testing mim-based install in actions

* Fixing mim-based install

* Pinning mmcv version in mim installs

* Bumping mmcv-full to 1.3.13

* Improved CPU support

* Reverted workflow files to match current master

* Improved tests on CPU devices

* Update docs action to match new dependencies versions

* Better handling of the device mess?

* Attempt to remove hacky device code

* Added mmseg to soft dependency test

* changed to binary jaccard index

* delete jaccard_index

* added jaccard index

* up to date metric test files

* Fixed init for binary jaccard index

* Argument to exclude classes from multiclass dice coefficient metric

* Added background exclusion case for multilabel dice coefficient tests

* adjusted setup, need to verify values

* added comment for correct values

* updated cases and setup

* updated cases and setup

* added class map to dictionary for each case

* Adapted RLE mask saving code, might need to revisit later

* Added support for wandb logging of semantic seg masks

* Added option not to pad dimensions when creating a MaskArray object

* Fixed typo

* Resampling of masks should use nearest neighbour

* Added TODO to masks.py

* Fixed loss keys for mssg

* mmseg installation in icevision_install.sh

* Fixed typo in install script

* Fixed albumentation for polygon mask

* Black formatting

* Fix handlig of special case of Polygon masks

* Started updating getting started notebook

* More updates to the notebook

* Adding after_pred convert raw pred callback to unet fastai learner

* Fixed unet prediction when GT not available

* More fixes to unet prediction callback

* Fixing predict batch for mmseg models

* Fixed predictions conversion for mmseg

* Improved unet prediction conversion

* Black formatting

* segformer support

* Updated mmseg model creation function

* Misc comment

* Added options to install script to assist with testing (temporary)

* Black formatting

* Remove install colab script added by mistake

* Actual updated install script

* Updated semantic seg notebook

* Removed legacy cell from notebook

* Further updated notebook

* Updated "open in colab" icon URL

* Added cell to restart kernel after installation

* Reverted notebook changes for merge into master

* Started work on README

* Updated README somewhat

* Updated semantic seg notebook to match updated version on master

* Fix draw data for mask files

* Implementation of mask resizing for MaskFile objects

* Support for MaskFile obnects in draw_data

* Fixed mask display in show_batch for mask-enabled mmdet models

* import typo

* Adding warning if re-creating masks from file in draw_data

* Added warning if maskfile loaded from disc for display

* README typo fixed

* Removed temporary mmsegmentation installation option

* Reverted changes to plot_top_losses

* Disabling mmseg PL implementation for now (pending update)

* Re-added unet callback

* Fixed CI

* Actually disabled PL implementation

* Removing test file uploaded by mistake

* mmseg fastai training test

* Fixed BackboneConfig location

* Fixed formatting

* Use latest convert_raw_predictions for Unet

* Fixed Unet PL test with new raw prediction conversion method

* Removed lightning mmseg files pending proper implementation

Co-authored-by: Gabriella Lanouette <[email protected]>
brownaa added a commit to brownaa/icevision that referenced this issue May 22, 2022
* Add error message for easy data fix (airctic#1074)

* add error message for easy data fix

* formatting

* fix black

* Mmseg initial support (airctic#1079)

* Preliminary work on mmsegmentation integration

This is currently very crude, mostly copy/pasting of the mmdet integration with a few changes.

* Updated mmseg dataloaders based on unet implementation

* Training now kind of working!

- Fixed issue with number of classes
- Fixed dataloader issue (mask tensor size)

* Improved predictions handling

* Fixed prediction, general code clean-up

* Simplification of folder structure

* Getting closer to final structure

* Finished first structure update

- This implementation was created based on the existing mmdet integration, and some remaining, unused folders, were removed

* Attempt to fix show_batch for mmseg

* Added binary and multi-class dice coefficient metrics

* Removed test-only code in binary Dice coefficient method

* Initial support for multiple pre-trained variants

* Reformatting using black

* First version of DeepLabV3plus support

* Exceptions to elegantly handled unknown pre-trained variants

* Added all DeepLabV3 pretrained variants

* Ground truth masks saved with predictions if keep_images set to True

* Added all DeepLabV3Plus pre-training variants

* Added proper support for param_groups

* Removed erroneous pre-trained variants for DeepLabV3Plus

* Fixed erroneous DeepLabV3 pre-trained variants

* re-added default values to DeepLabV3 pretrained variants

* Improved model loading and initialization

* Improved how distributed BNs are handled

* - Proper integration of loop_mmseg
- First test!

* Updated tests

* __init__.py file

* jaccard index metric

* update init file to include multilabel dice coef

* updates to logical statements

* update to handle denominator equal to 0

* update to handle denominator equal to 0

* removed repeated code

* removed repeated code

* Getting started with seg notebook

* Formatting fix (black)

* Removed temporary file

* Added mmsegmentation to Dockerfile

* Added mmseg installation to workflows

* Added artifacts to gitignore (wandb)

* Testing mim-based install in actions

* Fixing mim-based install

* Pinning mmcv version in mim installs

* Bumping mmcv-full to 1.3.13

* Improved CPU support

* Reverted workflow files to match current master

* Improved tests on CPU devices

* Better handling of the device mess?

* Attempt to remove hacky device code

* Added mmseg to soft dependency test

* changed to binary jaccard index

* delete jaccard_index

* added jaccard index

* up to date metric test files

* Fixed init for binary jaccard index

* Argument to exclude classes from multiclass dice coefficient metric

* Added background exclusion case for multilabel dice coefficient tests

* adjusted setup, need to verify values

* added comment for correct values

* updated cases and setup

* updated cases and setup

* added class map to dictionary for each case

* Adapted RLE mask saving code, might need to revisit later

* Added support for wandb logging of semantic seg masks

* Added option not to pad dimensions when creating a MaskArray object

* Fixed typo

* Resampling of masks should use nearest neighbour

* Added TODO to masks.py

* Fixed loss keys for mssg

* mmseg installation in icevision_install.sh

* Fixed typo in install script

* Fixed albumentation for polygon mask

* Black formatting

* Fix handlig of special case of Polygon masks

* Adding after_pred convert raw pred callback to unet fastai learner

* Fixed unet prediction when GT not available

* More fixes to unet prediction callback

* Fixing predict batch for mmseg models

* Fixed predictions conversion for mmseg

* Improved unet prediction conversion

* segformer support

* Updated mmseg model creation function

* Misc comment

* Added options to install script to assist with testing (temporary)

* Black formatting

* Remove install colab script added by mistake

* Actual updated install script

* Started work on README

* Updated README somewhat

* Fix draw data for mask files

* Implementation of mask resizing for MaskFile objects

* Support for MaskFile obnects in draw_data

* Fixed mask display in show_batch for mask-enabled mmdet models

* import typo

* Adding warning if re-creating masks from file in draw_data

* Added warning if maskfile loaded from disc for display

* README typo fixed

* Removed temporary mmsegmentation installation option

* Reverted changes to plot_top_losses

* solving merging conflicts

* fix error in CI

* adding back segm nbs

* merging notebooks

* fix indentation in build-pkg

* adding fastai and pl train tests

Co-authored-by: Nicolas Jaccard <[email protected]>
Co-authored-by: Gabriella Lanouette <[email protected]>
Co-authored-by: Nicolas Jaccard <[email protected]>

* Revert "Mmseg initial support (airctic#1079)" (airctic#1082)

This reverts commit 20c3ff5.

* Initial mmsegmentation support (airctic#934)

* Fixed PIL size bug in ImageRecordComponent (airctic#889)

* Preliminary work on mmsegmentation integration

This is currently very crude, mostly copy/pasting of the mmdet integration with a few changes.

* Updated mmseg dataloaders based on unet implementation

* Training now kind of working!

- Fixed issue with number of classes
- Fixed dataloader issue (mask tensor size)

* Improved predictions handling

* Fixed prediction, general code clean-up

* Simplification of folder structure

* Getting closer to final structure

* Finished first structure update

- This implementation was created based on the existing mmdet integration, and some remaining, unused folders, were removed

* Attempt to fix show_batch for mmseg

* Added binary and multi-class dice coefficient metrics

* Removed test-only code in binary Dice coefficient method

* Initial support for multiple pre-trained variants

* Reformatting using black

* First version of DeepLabV3plus support

* Exceptions to elegantly handled unknown pre-trained variants

* Added all DeepLabV3 pretrained variants

* Ground truth masks saved with predictions if keep_images set to True

* Added all DeepLabV3Plus pre-training variants

* Added proper support for param_groups

* Removed erroneous pre-trained variants for DeepLabV3Plus

* Fixed erroneous DeepLabV3 pre-trained variants

* re-added default values to DeepLabV3 pretrained variants

* Improved model loading and initialization

* Improved how distributed BNs are handled

* - Proper integration of loop_mmseg
- First test!

* Updated tests

* __init__.py file

* jaccard index metric

* update init file to include multilabel dice coef

* updates to logical statements

* update to handle denominator equal to 0

* update to handle denominator equal to 0

* removed repeated code

* removed repeated code

* Getting started with seg notebook

* Formatting fix (black)

* Removed temporary file

* Added mmsegmentation to Dockerfile

* Added mmseg installation to workflows

* Updating mmcv to 1.3.7 for mmseg support

* Added artifacts to gitignore (wandb)

* Testing mim-based install in actions

* Fixing mim-based install

* Pinning mmcv version in mim installs

* Bumping mmcv-full to 1.3.13

* Improved CPU support

* Reverted workflow files to match current master

* Improved tests on CPU devices

* Update docs action to match new dependencies versions

* Better handling of the device mess?

* Attempt to remove hacky device code

* Added mmseg to soft dependency test

* changed to binary jaccard index

* delete jaccard_index

* added jaccard index

* up to date metric test files

* Fixed init for binary jaccard index

* Argument to exclude classes from multiclass dice coefficient metric

* Added background exclusion case for multilabel dice coefficient tests

* adjusted setup, need to verify values

* added comment for correct values

* updated cases and setup

* updated cases and setup

* added class map to dictionary for each case

* Adapted RLE mask saving code, might need to revisit later

* Added support for wandb logging of semantic seg masks

* Added option not to pad dimensions when creating a MaskArray object

* Fixed typo

* Resampling of masks should use nearest neighbour

* Added TODO to masks.py

* Fixed loss keys for mssg

* mmseg installation in icevision_install.sh

* Fixed typo in install script

* Fixed albumentation for polygon mask

* Black formatting

* Fix handlig of special case of Polygon masks

* Started updating getting started notebook

* More updates to the notebook

* Adding after_pred convert raw pred callback to unet fastai learner

* Fixed unet prediction when GT not available

* More fixes to unet prediction callback

* Fixing predict batch for mmseg models

* Fixed predictions conversion for mmseg

* Improved unet prediction conversion

* Black formatting

* segformer support

* Updated mmseg model creation function

* Misc comment

* Added options to install script to assist with testing (temporary)

* Black formatting

* Remove install colab script added by mistake

* Actual updated install script

* Updated semantic seg notebook

* Removed legacy cell from notebook

* Further updated notebook

* Updated "open in colab" icon URL

* Added cell to restart kernel after installation

* Reverted notebook changes for merge into master

* Started work on README

* Updated README somewhat

* Updated semantic seg notebook to match updated version on master

* Fix draw data for mask files

* Implementation of mask resizing for MaskFile objects

* Support for MaskFile obnects in draw_data

* Fixed mask display in show_batch for mask-enabled mmdet models

* import typo

* Adding warning if re-creating masks from file in draw_data

* Added warning if maskfile loaded from disc for display

* README typo fixed

* Removed temporary mmsegmentation installation option

* Reverted changes to plot_top_losses

* Disabling mmseg PL implementation for now (pending update)

* Re-added unet callback

* Fixed CI

* Actually disabled PL implementation

* Removing test file uploaded by mistake

* mmseg fastai training test

* Fixed BackboneConfig location

* Fixed formatting

* Use latest convert_raw_predictions for Unet

* Fixed Unet PL test with new raw prediction conversion method

* Removed lightning mmseg files pending proper implementation

Co-authored-by: Gabriella Lanouette <[email protected]>

* don't open image on get_img_size (airctic#1084)

* fixes airctic#1090; Fix typo lightning -> lighting in Albumentations helper (airctic#1091)

* Fix coco mask vstack error (airctic#1095)

* Fix coco mask vstack error

* Give empty mask for coco mask prediction

* Reformat code

Co-authored-by: Joowon <[email protected]>
Co-authored-by: Francesco Pochetti <[email protected]>
Co-authored-by: Nicolas Jaccard <[email protected]>
Co-authored-by: Gabriella Lanouette <[email protected]>
Co-authored-by: Nicolas Jaccard <[email protected]>
Co-authored-by: Lucas Vazquez <[email protected]>
Co-authored-by: Behnam Haddadian <[email protected]>
Co-authored-by: aisensiy <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants