-
Notifications
You must be signed in to change notification settings - Fork 488
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
predict() support for segmentation models and more (#1708)
* squashed commits from segmentation predict branch * Set ignore_errors=True to trainer test and declare why * version bumped (#1374) Co-authored-by: Eugene Khvedchenya <ekhvedchenya@gmail.com> * segmentation predict: remove predict from ppliteseg models (PPLiteSegBase) as it's implement in SegmentationModule * Added missing transforms in validation * Add missing default preprocessing params for rest of the models * Add STDC predict * Update the predict & transforms & deprecate SegToTensor * Added lru_cache(1) to _get_pipeline method * Use only URL in the example script * Rename segmentation processing classes to have "Segmentation" prefix * Remove test for predict using segformer b0 * Segmentation transforms to use nd.ndarray whenever possible * Segmentation transforms to use nd.ndarray whenever possible * Added tests * Added tests * Fix typos * Merge master --------- Co-authored-by: dafna-r <dalia.rifold@gmail.com> Co-authored-by: dafna-r <47064033+dafna-r@users.noreply.github.com> Co-authored-by: Louis-Dupont <35190946+Louis-Dupont@users.noreply.github.com> Co-authored-by: Shay Aharon <80472096+shaydeci@users.noreply.github.com> Co-authored-by: Louis Dupont <louis-dupont@live.fr>
- Loading branch information
1 parent
445db0f
commit c4bbce7
Showing
40 changed files
with
2,044 additions
and
1,698 deletions.
There are no files selected for viewing
2,273 changes: 710 additions & 1,563 deletions
2,273
notebooks/transfer_learning_semantic_segmentation.ipynb
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
src/super_gradients/examples/predict/segmentation_predict.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
from super_gradients.common.object_names import Models | ||
from super_gradients.training import models | ||
|
||
|
||
model = models.get(model_name=Models.PP_LITE_T_SEG75, pretrained_weights="cityscapes") | ||
|
||
IMAGES = [ | ||
"https://deci-pretrained-models.s3.amazonaws.com/sample_images/beatles-abbeyroad.jpg", | ||
] | ||
|
||
predictions = model.predict(IMAGES) | ||
predictions.show() | ||
predictions.save(output_folder="") # Save in working directory |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.