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

Due to doodleverse-utils v0.0.33 MNDWI and NDWI models no longer function #160

Closed
2320sharon opened this issue Jul 12, 2023 · 4 comments
Closed
Assignees
Labels
bug Something isn't working

Comments

@2320sharon
Copy link
Collaborator

Due to the latest update to doodleverse-utils v0.0.33 MNDWI and NDWI models no longer function and throw error similar to the one pasted below. These models need the option to pass only a single band to the model such with code such as tf.squeeze(model(tf.expand_dims(image[:,:,1], 0)))

Traceback (most recent call last):
  File "c:\development\doodleverse\coastseg\CoastSeg\debug_scripts\test_models.py", line 78, in <module>
    model_dict = {
  File "C:\development\doodleverse\coastseg\CoastSeg\src\coastseg\zoo_model.py", line 1036, in run_model
    self.compute_segmentation(model_dict, percent_no_data)
  File "C:\development\doodleverse\coastseg\CoastSeg\src\coastseg\zoo_model.py", line 1099, in compute_segmentation
    do_seg(
  File "C:\Users\sf230\anaconda3\envs\coastseg_transformers10\lib\site-packages\doodleverse_utils\prediction_imports.py", line 395, in do_seg
    est_label, counter = est_label_multiclass(image,M,MODEL,TESTTIMEAUG,NCLASSES,TARGET_SIZE)
  File "C:\Users\sf230\anaconda3\envs\coastseg_transformers10\lib\site-packages\doodleverse_utils\prediction_imports.py", line 174, in est_label_multiclass
    est_label = tf.squeeze(model(tf.expand_dims(image[:,:,:3], 0)))
  File "C:\Users\sf230\anaconda3\envs\coastseg_transformers10\lib\site-packages\keras\src\utils\traceback_utils.py", line 70, in error_handler
    raise e.with_traceback(filtered_tb) from None
  File "C:\Users\sf230\anaconda3\envs\coastseg_transformers10\lib\site-packages\keras\src\engine\input_spec.py", line 280, in assert_input_compatibility
    raise ValueError(
ValueError: Exception encountered when calling layer 'model' (type Functional).
@2320sharon 2320sharon added the bug Something isn't working label Jul 12, 2023
@dbuscombe-usgs
Copy link
Member

I updated doodleverse-utils to hopefully avoid this bug. please try it out https://pypi.org/project/doodleverse-utils/0.0.34/

@2320sharon
Copy link
Collaborator Author

This remains an issue even with doodleverse_utils 0.0.34. For a temporary solution these models will be taken out in coastseg 0.0.72

@dbuscombe-usgs
Copy link
Member

Due to information provided by @2320sharon , the est_label_multiclass version implemented (for some reason!) in zoo was working but not the one in 'verse-utils-34 ... so I put the zoo versions of that function plus sister functions est_label_binary and do_seg into 'verse-utils/prediction_imports.

then I updated the Zoo and Gym functions so they use the doodleverse-utils versions of the above functions. Specifically, I updated model_functions and model_inference_funcs in zoo and tested various models with segment_orthomosaic.py and `select_model_and_batch_process_folder.py. I also tested gym/seg_images_in_folder.py

I tested both 2- and multiclass models, and segformer and resunet models, on satellite imagery and other imagery, including RGB and MNDWI and NDWI. It worked great every time 🎉

please use https://pypi.org/project/doodleverse-utils/0.0.35/ and fingers crossed!!

@2320sharon
Copy link
Collaborator Author

I was worried this might not work, but its works great! I tested it with all the models in both BEST and ENSEMBLE model and it works great! I also tested this change with all the models and it works!

2320sharon added a commit that referenced this issue Aug 4, 2023
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

No branches or pull requests

2 participants