Spaces:
Sleeping
Sleeping
adding cloth and fashion models
Browse files- .idea/.gitignore +3 -0
- .idea/inspectionProfiles/Project_Default.xml +129 -0
- .idea/inspectionProfiles/profiles_settings.xml +6 -0
- .idea/misc.xml +7 -0
- .idea/modules.xml +8 -0
- .idea/segformer-tf-transformers.iml +8 -0
- .idea/vcs.xml +6 -0
- ADE_val_00000001.jpeg +0 -0
- README.md +16 -10
- __pycache__/labels.cpython-312.pyc +0 -0
- __pycache__/pallete.cpython-312.pyc +0 -0
- ade_palette.txt +0 -150
- app-ade20k.py +127 -0
- app.py +25 -33
- labels.py +223 -0
- labels.txt +0 -150
- pallete.py +152 -0
- requirements.txt +1 -2
.idea/.gitignore
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Default ignored files
|
| 2 |
+
/shelf/
|
| 3 |
+
/workspace.xml
|
.idea/inspectionProfiles/Project_Default.xml
ADDED
|
@@ -0,0 +1,129 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<component name="InspectionProjectProfileManager">
|
| 2 |
+
<profile version="1.0">
|
| 3 |
+
<option name="myName" value="Project Default" />
|
| 4 |
+
<inspection_tool class="PyPackageRequirementsInspection" enabled="true" level="WARNING" enabled_by_default="true">
|
| 5 |
+
<option name="ignoredPackages">
|
| 6 |
+
<value>
|
| 7 |
+
<list size="101">
|
| 8 |
+
<item index="0" class="java.lang.String" itemvalue="human-pose-estimator" />
|
| 9 |
+
<item index="1" class="java.lang.String" itemvalue="torch" />
|
| 10 |
+
<item index="2" class="java.lang.String" itemvalue="numpy" />
|
| 11 |
+
<item index="3" class="java.lang.String" itemvalue="gradio" />
|
| 12 |
+
<item index="4" class="java.lang.String" itemvalue="opencv-python-headless" />
|
| 13 |
+
<item index="5" class="java.lang.String" itemvalue="pymatting" />
|
| 14 |
+
<item index="6" class="java.lang.String" itemvalue="scipy" />
|
| 15 |
+
<item index="7" class="java.lang.String" itemvalue="pillow" />
|
| 16 |
+
<item index="8" class="java.lang.String" itemvalue="rembg" />
|
| 17 |
+
<item index="9" class="java.lang.String" itemvalue="carvekit" />
|
| 18 |
+
<item index="10" class="java.lang.String" itemvalue="scikit-image" />
|
| 19 |
+
<item index="11" class="java.lang.String" itemvalue="paddlepaddle" />
|
| 20 |
+
<item index="12" class="java.lang.String" itemvalue="paddlehub" />
|
| 21 |
+
<item index="13" class="java.lang.String" itemvalue="bisnet" />
|
| 22 |
+
<item index="14" class="java.lang.String" itemvalue="torchvision" />
|
| 23 |
+
<item index="15" class="java.lang.String" itemvalue="realesrgan" />
|
| 24 |
+
<item index="16" class="java.lang.String" itemvalue="huggingface-hub" />
|
| 25 |
+
<item index="17" class="java.lang.String" itemvalue="opencv-python" />
|
| 26 |
+
<item index="18" class="java.lang.String" itemvalue="yapf" />
|
| 27 |
+
<item index="19" class="java.lang.String" itemvalue="gfpgan" />
|
| 28 |
+
<item index="20" class="java.lang.String" itemvalue="lmdb" />
|
| 29 |
+
<item index="21" class="java.lang.String" itemvalue="tqdm" />
|
| 30 |
+
<item index="22" class="java.lang.String" itemvalue="filetype" />
|
| 31 |
+
<item index="23" class="java.lang.String" itemvalue="onnxruntime" />
|
| 32 |
+
<item index="24" class="java.lang.String" itemvalue="basicsr" />
|
| 33 |
+
<item index="25" class="java.lang.String" itemvalue="onnx" />
|
| 34 |
+
<item index="26" class="java.lang.String" itemvalue="psutil" />
|
| 35 |
+
<item index="27" class="java.lang.String" itemvalue="torchaudio" />
|
| 36 |
+
<item index="28" class="java.lang.String" itemvalue="timm" />
|
| 37 |
+
<item index="29" class="java.lang.String" itemvalue="gradio_imageslider" />
|
| 38 |
+
<item index="30" class="java.lang.String" itemvalue="transformers" />
|
| 39 |
+
<item index="31" class="java.lang.String" itemvalue="pydantic" />
|
| 40 |
+
<item index="32" class="java.lang.String" itemvalue="huggingface_hub" />
|
| 41 |
+
<item index="33" class="java.lang.String" itemvalue="monotonic-align" />
|
| 42 |
+
<item index="34" class="java.lang.String" itemvalue="einops-exts" />
|
| 43 |
+
<item index="35" class="java.lang.String" itemvalue="phonemizer" />
|
| 44 |
+
<item index="36" class="java.lang.String" itemvalue="txtsplit" />
|
| 45 |
+
<item index="37" class="java.lang.String" itemvalue="nltk" />
|
| 46 |
+
<item index="38" class="java.lang.String" itemvalue="SoundFile" />
|
| 47 |
+
<item index="39" class="java.lang.String" itemvalue="librosa" />
|
| 48 |
+
<item index="40" class="java.lang.String" itemvalue="gruut" />
|
| 49 |
+
<item index="41" class="java.lang.String" itemvalue="munch" />
|
| 50 |
+
<item index="42" class="java.lang.String" itemvalue="cached-path" />
|
| 51 |
+
<item index="43" class="java.lang.String" itemvalue="gdown" />
|
| 52 |
+
<item index="44" class="java.lang.String" itemvalue="diffusers" />
|
| 53 |
+
<item index="45" class="java.lang.String" itemvalue="matplotlib" />
|
| 54 |
+
<item index="46" class="java.lang.String" itemvalue="skimage" />
|
| 55 |
+
<item index="47" class="java.lang.String" itemvalue="ultralytics" />
|
| 56 |
+
<item index="48" class="java.lang.String" itemvalue="Pillow" />
|
| 57 |
+
<item index="49" class="java.lang.String" itemvalue="dis_bg_remover" />
|
| 58 |
+
<item index="50" class="java.lang.String" itemvalue="kiui" />
|
| 59 |
+
<item index="51" class="java.lang.String" itemvalue="xatlas" />
|
| 60 |
+
<item index="52" class="java.lang.String" itemvalue="open-clip-torch" />
|
| 61 |
+
<item index="53" class="java.lang.String" itemvalue="nvdiffrast" />
|
| 62 |
+
<item index="54" class="java.lang.String" itemvalue="pymeshlab" />
|
| 63 |
+
<item index="55" class="java.lang.String" itemvalue="opencv-contrib-python-headless" />
|
| 64 |
+
<item index="56" class="java.lang.String" itemvalue="xformers" />
|
| 65 |
+
<item index="57" class="java.lang.String" itemvalue="pygltflib" />
|
| 66 |
+
<item index="58" class="java.lang.String" itemvalue="einops" />
|
| 67 |
+
<item index="59" class="java.lang.String" itemvalue="trimesh" />
|
| 68 |
+
<item index="60" class="java.lang.String" itemvalue="deepface" />
|
| 69 |
+
<item index="61" class="java.lang.String" itemvalue="pyside6" />
|
| 70 |
+
<item index="62" class="java.lang.String" itemvalue="dlib" />
|
| 71 |
+
<item index="63" class="java.lang.String" itemvalue="qtawesome" />
|
| 72 |
+
<item index="64" class="java.lang.String" itemvalue="tensorflow" />
|
| 73 |
+
<item index="65" class="java.lang.String" itemvalue="tensorboard" />
|
| 74 |
+
<item index="66" class="java.lang.String" itemvalue="tensorboardX" />
|
| 75 |
+
<item index="67" class="java.lang.String" itemvalue="imgaug" />
|
| 76 |
+
<item index="68" class="java.lang.String" itemvalue="torchsde" />
|
| 77 |
+
<item index="69" class="java.lang.String" itemvalue="onnxruntime-gpu" />
|
| 78 |
+
<item index="70" class="java.lang.String" itemvalue="alembic" />
|
| 79 |
+
<item index="71" class="java.lang.String" itemvalue="comfyui-embedded-docs" />
|
| 80 |
+
<item index="72" class="java.lang.String" itemvalue="comfyui-frontend-package" />
|
| 81 |
+
<item index="73" class="java.lang.String" itemvalue="av" />
|
| 82 |
+
<item index="74" class="java.lang.String" itemvalue="SQLAlchemy" />
|
| 83 |
+
<item index="75" class="java.lang.String" itemvalue="spandrel" />
|
| 84 |
+
<item index="76" class="java.lang.String" itemvalue="segment_anything" />
|
| 85 |
+
<item index="77" class="java.lang.String" itemvalue="comfyui-workflow-templates" />
|
| 86 |
+
<item index="78" class="java.lang.String" itemvalue="dotenv" />
|
| 87 |
+
<item index="79" class="java.lang.String" itemvalue="hydra-core" />
|
| 88 |
+
<item index="80" class="java.lang.String" itemvalue="fvcore" />
|
| 89 |
+
<item index="81" class="java.lang.String" itemvalue="cloudpickle" />
|
| 90 |
+
<item index="82" class="java.lang.String" itemvalue="pycocotools" />
|
| 91 |
+
<item index="83" class="java.lang.String" itemvalue="omegaconf" />
|
| 92 |
+
<item index="84" class="java.lang.String" itemvalue="accelerate" />
|
| 93 |
+
<item index="85" class="java.lang.String" itemvalue="ftfy" />
|
| 94 |
+
<item index="86" class="java.lang.String" itemvalue="pytorch-lightning" />
|
| 95 |
+
<item index="87" class="java.lang.String" itemvalue="torch-fidelity" />
|
| 96 |
+
<item index="88" class="java.lang.String" itemvalue="torchmetrics" />
|
| 97 |
+
<item index="89" class="java.lang.String" itemvalue="taming-transformers" />
|
| 98 |
+
<item index="90" class="java.lang.String" itemvalue="deepspeed" />
|
| 99 |
+
<item index="91" class="java.lang.String" itemvalue="open_clip_torch" />
|
| 100 |
+
<item index="92" class="java.lang.String" itemvalue="autokeras" />
|
| 101 |
+
<item index="93" class="java.lang.String" itemvalue="pyyaml" />
|
| 102 |
+
<item index="94" class="java.lang.String" itemvalue="albumentations" />
|
| 103 |
+
<item index="95" class="java.lang.String" itemvalue="kornia" />
|
| 104 |
+
<item index="96" class="java.lang.String" itemvalue="protobuf" />
|
| 105 |
+
<item index="97" class="java.lang.String" itemvalue="typing" />
|
| 106 |
+
<item index="98" class="java.lang.String" itemvalue="packaging" />
|
| 107 |
+
<item index="99" class="java.lang.String" itemvalue="setuptools" />
|
| 108 |
+
<item index="100" class="java.lang.String" itemvalue="spaces" />
|
| 109 |
+
</list>
|
| 110 |
+
</value>
|
| 111 |
+
</option>
|
| 112 |
+
</inspection_tool>
|
| 113 |
+
<inspection_tool class="PyPep8Inspection" enabled="true" level="INFORMATION" enabled_by_default="true">
|
| 114 |
+
<option name="ignoredErrors">
|
| 115 |
+
<list>
|
| 116 |
+
<option value="E301" />
|
| 117 |
+
</list>
|
| 118 |
+
</option>
|
| 119 |
+
</inspection_tool>
|
| 120 |
+
<inspection_tool class="PyPep8NamingInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true">
|
| 121 |
+
<option name="ignoredErrors">
|
| 122 |
+
<list>
|
| 123 |
+
<option value="N802" />
|
| 124 |
+
<option value="N803" />
|
| 125 |
+
</list>
|
| 126 |
+
</option>
|
| 127 |
+
</inspection_tool>
|
| 128 |
+
</profile>
|
| 129 |
+
</component>
|
.idea/inspectionProfiles/profiles_settings.xml
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<component name="InspectionProjectProfileManager">
|
| 2 |
+
<settings>
|
| 3 |
+
<option name="USE_PROJECT_PROFILE" value="false" />
|
| 4 |
+
<version value="1.0" />
|
| 5 |
+
</settings>
|
| 6 |
+
</component>
|
.idea/misc.xml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
| 2 |
+
<project version="4">
|
| 3 |
+
<component name="Black">
|
| 4 |
+
<option name="sdkName" value="Torcho" />
|
| 5 |
+
</component>
|
| 6 |
+
<component name="ProjectRootManager" version="2" project-jdk-name="Torcho" project-jdk-type="Python SDK" />
|
| 7 |
+
</project>
|
.idea/modules.xml
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
| 2 |
+
<project version="4">
|
| 3 |
+
<component name="ProjectModuleManager">
|
| 4 |
+
<modules>
|
| 5 |
+
<module fileurl="file://$PROJECT_DIR$/.idea/segformer-tf-transformers.iml" filepath="$PROJECT_DIR$/.idea/segformer-tf-transformers.iml" />
|
| 6 |
+
</modules>
|
| 7 |
+
</component>
|
| 8 |
+
</project>
|
.idea/segformer-tf-transformers.iml
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
| 2 |
+
<module type="PYTHON_MODULE" version="4">
|
| 3 |
+
<component name="NewModuleRootManager">
|
| 4 |
+
<content url="file://$MODULE_DIR$" />
|
| 5 |
+
<orderEntry type="jdk" jdkName="Torcho" jdkType="Python SDK" />
|
| 6 |
+
<orderEntry type="sourceFolder" forTests="false" />
|
| 7 |
+
</component>
|
| 8 |
+
</module>
|
.idea/vcs.xml
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
| 2 |
+
<project version="4">
|
| 3 |
+
<component name="VcsDirectoryMappings">
|
| 4 |
+
<mapping directory="" vcs="Git" />
|
| 5 |
+
</component>
|
| 6 |
+
</project>
|
ADE_val_00000001.jpeg
DELETED
|
Binary file (52.7 kB)
|
|
|
README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
---
|
| 2 |
-
title: SegFormer
|
| 3 |
emoji: 🏃
|
| 4 |
colorFrom: indigo
|
| 5 |
colorTo: gray
|
|
@@ -8,25 +8,31 @@ sdk_version: 5.49.0
|
|
| 8 |
app_file: app.py
|
| 9 |
pinned: false
|
| 10 |
license: apache-2.0
|
| 11 |
-
short_description:
|
| 12 |
---
|
| 13 |
|
| 14 |
-
|
| 15 |
|
| 16 |
-
This is demo
|
| 17 |
|
|
|
|
|
|
|
| 18 |
|
| 19 |
-
|
| 20 |
-
|
|
|
|
| 21 |
|
| 22 |
-
|
| 23 |
-
|
|
|
|
| 24 |
|
| 25 |
## Acknowledgments
|
| 26 |
This work integrates code and concepts from several repositories.
|
| 27 |
For proper attribution, please refer to the following sources (or notify us if any are missing):
|
| 28 |
-
- [
|
| 29 |
-
-
|
|
|
|
|
|
|
| 30 |
## Contact
|
| 31 |
For questions, comments, or feedback, please contact:
|
| 32 |
📧 **leonelhs@gmail.com**
|
|
|
|
| 1 |
---
|
| 2 |
+
title: SegFormer ONNX
|
| 3 |
emoji: 🏃
|
| 4 |
colorFrom: indigo
|
| 5 |
colorTo: gray
|
|
|
|
| 8 |
app_file: app.py
|
| 9 |
pinned: false
|
| 10 |
license: apache-2.0
|
| 11 |
+
short_description: SegFormer image segmentation ADE20k, Cloths & Fashion
|
| 12 |
---
|
| 13 |
|
| 14 |
+
# [SegFormer image segmentation ADE20k, Cloths & Fashion](https://huggingface.co/spaces/leonelhs/segformer-tf-transformers )
|
| 15 |
|
| 16 |
+
This is demo collects SegFormer implementations from several spaces
|
| 17 |
|
| 18 |
+
## Model ADE20k
|
| 19 |
+
This model is fine-tuned for images belonging to scene categories.
|
| 20 |
|
| 21 |
+
## Model Cloths
|
| 22 |
+
This model is fine-tuned for human cloth images.
|
| 23 |
+
Expected classes: Face, Hat, Hair, Upper_clothes, Skirt, Pants, Dress, Belt, shoe, leg, arm, Bag, Scarf
|
| 24 |
|
| 25 |
+
## Model Fashion
|
| 26 |
+
This model extends and complements human cloth model.
|
| 27 |
+
Expected classes: shirt, top, sweater, cardigan, jacket, vest, pants, shorts, skirt, coat, dress, jumpsuit, cape, glasses, hat, hairaccessory, tie, glove, watch, belt, legwarmer, tights, sock, shoe, bagwallet, scarf, umbrella, hood, collar, lapel, epaulette, sleeve, pocket, neckline, buckle, zipper, applique, bead, bow, flower, fringe, ribbon, rivet, ruffle, sequin, tassel
|
| 28 |
|
| 29 |
## Acknowledgments
|
| 30 |
This work integrates code and concepts from several repositories.
|
| 31 |
For proper attribution, please refer to the following sources (or notify us if any are missing):
|
| 32 |
+
- [github](https://github.com/deep-diver/segformer-tf-transformers)
|
| 33 |
+
- [huggingface](https://huggingface.co/spaces/chansung/segformer-tf-transformers)
|
| 34 |
+
- [ADE20k dataset](http://groups.csail.mit.edu/vision/datasets/ADE20K/)
|
| 35 |
+
- [nvidia](https://huggingface.co/nvidia/segformer-b5-finetuned-ade-640-640)
|
| 36 |
## Contact
|
| 37 |
For questions, comments, or feedback, please contact:
|
| 38 |
📧 **leonelhs@gmail.com**
|
__pycache__/labels.cpython-312.pyc
ADDED
|
Binary file (8.75 kB). View file
|
|
|
__pycache__/pallete.cpython-312.pyc
ADDED
|
Binary file (7.06 kB). View file
|
|
|
ade_palette.txt
DELETED
|
@@ -1,150 +0,0 @@
|
|
| 1 |
-
[120, 120, 120]
|
| 2 |
-
[180, 120, 120]
|
| 3 |
-
[6, 230, 230]
|
| 4 |
-
[80, 50, 50]
|
| 5 |
-
[4, 200, 3]
|
| 6 |
-
[120, 120, 80]
|
| 7 |
-
[140, 140, 140]
|
| 8 |
-
[204, 5, 255]
|
| 9 |
-
[230, 230, 230]
|
| 10 |
-
[4, 250, 7]
|
| 11 |
-
[224, 5, 255]
|
| 12 |
-
[235, 255, 7]
|
| 13 |
-
[150, 5, 61]
|
| 14 |
-
[120, 120, 70]
|
| 15 |
-
[8, 255, 51]
|
| 16 |
-
[255, 6, 82]
|
| 17 |
-
[143, 255, 140]
|
| 18 |
-
[204, 255, 4]
|
| 19 |
-
[255, 51, 7]
|
| 20 |
-
[204, 70, 3]
|
| 21 |
-
[0, 102, 200]
|
| 22 |
-
[61, 230, 250]
|
| 23 |
-
[255, 6, 51]
|
| 24 |
-
[11, 102, 255]
|
| 25 |
-
[255, 7, 71]
|
| 26 |
-
[255, 9, 224]
|
| 27 |
-
[9, 7, 230]
|
| 28 |
-
[220, 220, 220]
|
| 29 |
-
[255, 9, 92]
|
| 30 |
-
[112, 9, 255]
|
| 31 |
-
[8, 255, 214]
|
| 32 |
-
[7, 255, 224]
|
| 33 |
-
[255, 184, 6]
|
| 34 |
-
[10, 255, 71]
|
| 35 |
-
[255, 41, 10]
|
| 36 |
-
[7, 255, 255]
|
| 37 |
-
[224, 255, 8]
|
| 38 |
-
[102, 8, 255]
|
| 39 |
-
[255, 61, 6]
|
| 40 |
-
[255, 194, 7]
|
| 41 |
-
[255, 122, 8]
|
| 42 |
-
[0, 255, 20]
|
| 43 |
-
[255, 8, 41]
|
| 44 |
-
[255, 5, 153]
|
| 45 |
-
[6, 51, 255]
|
| 46 |
-
[235, 12, 255]
|
| 47 |
-
[160, 150, 20]
|
| 48 |
-
[0, 163, 255]
|
| 49 |
-
[140, 140, 140]
|
| 50 |
-
[250, 10, 15]
|
| 51 |
-
[20, 255, 0]
|
| 52 |
-
[31, 255, 0]
|
| 53 |
-
[255, 31, 0]
|
| 54 |
-
[255, 224, 0]
|
| 55 |
-
[153, 255, 0]
|
| 56 |
-
[0, 0, 255]
|
| 57 |
-
[255, 71, 0]
|
| 58 |
-
[0, 235, 255]
|
| 59 |
-
[0, 173, 255]
|
| 60 |
-
[31, 0, 255]
|
| 61 |
-
[11, 200, 200]
|
| 62 |
-
[255, 82, 0]
|
| 63 |
-
[0, 255, 245]
|
| 64 |
-
[0, 61, 255]
|
| 65 |
-
[0, 255, 112]
|
| 66 |
-
[0, 255, 133]
|
| 67 |
-
[255, 0, 0]
|
| 68 |
-
[255, 163, 0]
|
| 69 |
-
[255, 102, 0]
|
| 70 |
-
[194, 255, 0]
|
| 71 |
-
[0, 143, 255]
|
| 72 |
-
[51, 255, 0]
|
| 73 |
-
[0, 82, 255]
|
| 74 |
-
[0, 255, 41]
|
| 75 |
-
[0, 255, 173]
|
| 76 |
-
[10, 0, 255]
|
| 77 |
-
[173, 255, 0]
|
| 78 |
-
[0, 255, 153]
|
| 79 |
-
[255, 92, 0]
|
| 80 |
-
[255, 0, 255]
|
| 81 |
-
[255, 0, 245]
|
| 82 |
-
[255, 0, 102]
|
| 83 |
-
[255, 173, 0]
|
| 84 |
-
[255, 0, 20]
|
| 85 |
-
[255, 184, 184]
|
| 86 |
-
[0, 31, 255]
|
| 87 |
-
[0, 255, 61]
|
| 88 |
-
[0, 71, 255]
|
| 89 |
-
[255, 0, 204]
|
| 90 |
-
[0, 255, 194]
|
| 91 |
-
[0, 255, 82]
|
| 92 |
-
[0, 10, 255]
|
| 93 |
-
[0, 112, 255]
|
| 94 |
-
[51, 0, 255]
|
| 95 |
-
[0, 194, 255]
|
| 96 |
-
[0, 122, 255]
|
| 97 |
-
[0, 255, 163]
|
| 98 |
-
[255, 153, 0]
|
| 99 |
-
[0, 255, 10]
|
| 100 |
-
[255, 112, 0]
|
| 101 |
-
[143, 255, 0]
|
| 102 |
-
[82, 0, 255]
|
| 103 |
-
[163, 255, 0]
|
| 104 |
-
[255, 235, 0]
|
| 105 |
-
[8, 184, 170]
|
| 106 |
-
[133, 0, 255]
|
| 107 |
-
[0, 255, 92]
|
| 108 |
-
[184, 0, 255]
|
| 109 |
-
[255, 0, 31]
|
| 110 |
-
[0, 184, 255]
|
| 111 |
-
[0, 214, 255]
|
| 112 |
-
[255, 0, 112]
|
| 113 |
-
[92, 255, 0]
|
| 114 |
-
[0, 224, 255]
|
| 115 |
-
[112, 224, 255]
|
| 116 |
-
[70, 184, 160]
|
| 117 |
-
[163, 0, 255]
|
| 118 |
-
[153, 0, 255]
|
| 119 |
-
[71, 255, 0]
|
| 120 |
-
[255, 0, 163]
|
| 121 |
-
[255, 204, 0]
|
| 122 |
-
[255, 0, 143]
|
| 123 |
-
[0, 255, 235]
|
| 124 |
-
[133, 255, 0]
|
| 125 |
-
[255, 0, 235]
|
| 126 |
-
[245, 0, 255]
|
| 127 |
-
[255, 0, 122]
|
| 128 |
-
[255, 245, 0]
|
| 129 |
-
[10, 190, 212]
|
| 130 |
-
[214, 255, 0]
|
| 131 |
-
[0, 204, 255]
|
| 132 |
-
[20, 0, 255]
|
| 133 |
-
[255, 255, 0]
|
| 134 |
-
[0, 153, 255]
|
| 135 |
-
[0, 41, 255]
|
| 136 |
-
[0, 255, 204]
|
| 137 |
-
[41, 0, 255]
|
| 138 |
-
[41, 255, 0]
|
| 139 |
-
[173, 0, 255]
|
| 140 |
-
[0, 245, 255]
|
| 141 |
-
[71, 0, 255]
|
| 142 |
-
[122, 0, 255]
|
| 143 |
-
[0, 255, 184]
|
| 144 |
-
[0, 92, 255]
|
| 145 |
-
[184, 255, 0]
|
| 146 |
-
[0, 133, 255]
|
| 147 |
-
[255, 214, 0]
|
| 148 |
-
[25, 194, 194]
|
| 149 |
-
[102, 255, 0]
|
| 150 |
-
[92, 0, 255]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app-ade20k.py
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#######################################################################################
|
| 2 |
+
#
|
| 3 |
+
# MIT License
|
| 4 |
+
#
|
| 5 |
+
# Copyright (c) [2025] [leonelhs@gmail.com]
|
| 6 |
+
#
|
| 7 |
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
| 8 |
+
# of this software and associated documentation files (the "Software"), to deal
|
| 9 |
+
# in the Software without restriction, including without limitation the rights
|
| 10 |
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
| 11 |
+
# copies of the Software, and to permit persons to whom the Software is
|
| 12 |
+
# furnished to do so, subject to the following conditions:
|
| 13 |
+
#
|
| 14 |
+
# The above copyright notice and this permission notice shall be included in all
|
| 15 |
+
# copies or substantial portions of the Software.
|
| 16 |
+
#
|
| 17 |
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 18 |
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 19 |
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
| 20 |
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
| 21 |
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
| 22 |
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
| 23 |
+
# SOFTWARE.
|
| 24 |
+
#
|
| 25 |
+
#######################################################################################
|
| 26 |
+
#
|
| 27 |
+
# This project is one of several repositories exploring image segmentation techniques.
|
| 28 |
+
# All related projects and interactive demos can be found at:
|
| 29 |
+
# https://huggingface.co/spaces/leonelhs/removators
|
| 30 |
+
# huggingface: https://huggingface.co/spaces/leonelhs/segformer-tf-transformers
|
| 31 |
+
#
|
| 32 |
+
|
| 33 |
+
import csv
|
| 34 |
+
import os
|
| 35 |
+
import sys
|
| 36 |
+
from itertools import islice
|
| 37 |
+
|
| 38 |
+
import cv2
|
| 39 |
+
import numpy as np
|
| 40 |
+
import onnxruntime as ort
|
| 41 |
+
import gradio as gr
|
| 42 |
+
from PIL import Image
|
| 43 |
+
from huggingface_hub import hf_hub_download
|
| 44 |
+
|
| 45 |
+
ade_palette = []
|
| 46 |
+
labels_list = []
|
| 47 |
+
|
| 48 |
+
csv.field_size_limit(sys.maxsize)
|
| 49 |
+
|
| 50 |
+
with open(r"labels.txt", "r") as fp:
|
| 51 |
+
for line in fp:
|
| 52 |
+
labels_list.append(line[:-1])
|
| 53 |
+
|
| 54 |
+
with open(r"ade_palette.txt", "r") as fp:
|
| 55 |
+
for line in fp:
|
| 56 |
+
tmp_list = list(map(int, line[:-1].strip("][").split(", ")))
|
| 57 |
+
ade_palette.append(tmp_list)
|
| 58 |
+
|
| 59 |
+
colormap = np.asarray(ade_palette)
|
| 60 |
+
|
| 61 |
+
|
| 62 |
+
REPO_ID = "leonelhs/segmentators"
|
| 63 |
+
model_path = hf_hub_download(repo_id=REPO_ID, filename="segformer/segformer-b5-finetuned-ade-640-640.onnx")
|
| 64 |
+
|
| 65 |
+
|
| 66 |
+
sess_options = ort.SessionOptions()
|
| 67 |
+
sess_options.intra_op_num_threads = os.cpu_count()
|
| 68 |
+
sess = ort.InferenceSession(model_path, sess_options, providers=["CPUExecutionProvider"])
|
| 69 |
+
|
| 70 |
+
|
| 71 |
+
def label_to_color_image(label):
|
| 72 |
+
if label.ndim != 2:
|
| 73 |
+
raise ValueError("Expect 2-D input label")
|
| 74 |
+
|
| 75 |
+
if np.max(label) >= len(colormap):
|
| 76 |
+
raise ValueError("label value too large.")
|
| 77 |
+
|
| 78 |
+
return colormap[label]
|
| 79 |
+
|
| 80 |
+
def predict(input_img):
|
| 81 |
+
|
| 82 |
+
img = cv2.imread(input_img)
|
| 83 |
+
img = cv2.resize(img, (640, 640)).astype(np.float32)
|
| 84 |
+
img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
|
| 85 |
+
img_batch = np.expand_dims(img, axis=0)
|
| 86 |
+
img_batch = np.transpose(img_batch, (0, 3, 1, 2))
|
| 87 |
+
|
| 88 |
+
logits = sess.run(None, {"pixel_values": img_batch})[0]
|
| 89 |
+
|
| 90 |
+
logits = np.transpose(logits, (0, 2, 3, 1))
|
| 91 |
+
segmented_mask = np.argmax(logits, axis=-1)[0].astype("float32")
|
| 92 |
+
segmented_mask = cv2.resize(segmented_mask, (640, 640)).astype("uint8")
|
| 93 |
+
|
| 94 |
+
|
| 95 |
+
parts = []
|
| 96 |
+
unique_labels = np.unique(segmented_mask)
|
| 97 |
+
label_names = np.asarray(labels_list)
|
| 98 |
+
|
| 99 |
+
for label in unique_labels:
|
| 100 |
+
part = np.where(segmented_mask == label)
|
| 101 |
+
color_seg = np.full((640, 640, 3), 0, dtype=np.uint8)
|
| 102 |
+
color_seg[part[0], part[1], :] = colormap[label]
|
| 103 |
+
color_seg = cv2.cvtColor(color_seg, cv2.COLOR_BGR2GRAY)
|
| 104 |
+
parts.append((color_seg, label_names[label]))
|
| 105 |
+
|
| 106 |
+
return Image.fromarray(img.astype("uint8")), parts
|
| 107 |
+
|
| 108 |
+
with gr.Blocks(title="SegFormer") as app:
|
| 109 |
+
navbar = gr.Navbar(visible=True, main_page_name="Workspace")
|
| 110 |
+
gr.Markdown("## SegFormer(ADE20k) ONNX")
|
| 111 |
+
with gr.Row():
|
| 112 |
+
with gr.Column(scale=1):
|
| 113 |
+
inp = gr.Image(type="filepath", label="Upload Image")
|
| 114 |
+
btn_predict = gr.Button("Parse")
|
| 115 |
+
with gr.Column(scale=2):
|
| 116 |
+
out = gr.AnnotatedImage(label="Image parsed annotated")
|
| 117 |
+
|
| 118 |
+
btn_predict.click(predict, inputs=[inp], outputs=[out])
|
| 119 |
+
|
| 120 |
+
|
| 121 |
+
with app.route("About this", "/about"):
|
| 122 |
+
with open("README.md") as f:
|
| 123 |
+
for line in islice(f, 12, None):
|
| 124 |
+
gr.Markdown(line.strip())
|
| 125 |
+
|
| 126 |
+
app.launch(share=False, debug=True, show_error=True, mcp_server=True, pwa=True)
|
| 127 |
+
app.queue()
|
app.py
CHANGED
|
@@ -30,9 +30,7 @@
|
|
| 30 |
# huggingface: https://huggingface.co/spaces/leonelhs/segformer-tf-transformers
|
| 31 |
#
|
| 32 |
|
| 33 |
-
import csv
|
| 34 |
import os
|
| 35 |
-
import sys
|
| 36 |
from itertools import islice
|
| 37 |
|
| 38 |
import cv2
|
|
@@ -42,42 +40,35 @@ import gradio as gr
|
|
| 42 |
from PIL import Image
|
| 43 |
from huggingface_hub import hf_hub_download
|
| 44 |
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
csv.field_size_limit(sys.maxsize)
|
| 49 |
-
|
| 50 |
-
with open(r"labels.txt", "r") as fp:
|
| 51 |
-
for line in fp:
|
| 52 |
-
labels_list.append(line[:-1])
|
| 53 |
-
|
| 54 |
-
with open(r"ade_palette.txt", "r") as fp:
|
| 55 |
-
for line in fp:
|
| 56 |
-
tmp_list = list(map(int, line[:-1].strip("][").split(", ")))
|
| 57 |
-
ade_palette.append(tmp_list)
|
| 58 |
-
|
| 59 |
-
colormap = np.asarray(ade_palette)
|
| 60 |
-
|
| 61 |
|
| 62 |
REPO_ID = "leonelhs/segmentators"
|
| 63 |
-
model_path = hf_hub_download(repo_id=REPO_ID, filename="segformer/segformer-b5-finetuned-ade-640-640.onnx")
|
| 64 |
|
|
|
|
|
|
|
|
|
|
| 65 |
|
| 66 |
sess_options = ort.SessionOptions()
|
| 67 |
sess_options.intra_op_num_threads = os.cpu_count()
|
| 68 |
-
|
|
|
|
|
|
|
|
|
|
| 69 |
|
| 70 |
|
| 71 |
-
def
|
| 72 |
-
if label.ndim != 2:
|
| 73 |
-
raise ValueError("Expect 2-D input label")
|
| 74 |
|
| 75 |
-
|
| 76 |
-
|
| 77 |
|
| 78 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 79 |
|
| 80 |
-
def predict(input_img):
|
| 81 |
|
| 82 |
img = cv2.imread(input_img)
|
| 83 |
img = cv2.resize(img, (640, 640)).astype(np.float32)
|
|
@@ -85,37 +76,38 @@ def predict(input_img):
|
|
| 85 |
img_batch = np.expand_dims(img, axis=0)
|
| 86 |
img_batch = np.transpose(img_batch, (0, 3, 1, 2))
|
| 87 |
|
| 88 |
-
|
|
|
|
|
|
|
| 89 |
|
| 90 |
logits = np.transpose(logits, (0, 2, 3, 1))
|
| 91 |
segmented_mask = np.argmax(logits, axis=-1)[0].astype("float32")
|
| 92 |
segmented_mask = cv2.resize(segmented_mask, (640, 640)).astype("uint8")
|
| 93 |
|
| 94 |
-
|
| 95 |
parts = []
|
| 96 |
unique_labels = np.unique(segmented_mask)
|
| 97 |
-
label_names = np.asarray(labels_list)
|
| 98 |
|
| 99 |
for label in unique_labels:
|
| 100 |
part = np.where(segmented_mask == label)
|
| 101 |
color_seg = np.full((640, 640, 3), 0, dtype=np.uint8)
|
| 102 |
color_seg[part[0], part[1], :] = colormap[label]
|
| 103 |
color_seg = cv2.cvtColor(color_seg, cv2.COLOR_BGR2GRAY)
|
| 104 |
-
parts.append((color_seg,
|
| 105 |
|
| 106 |
return Image.fromarray(img.astype("uint8")), parts
|
| 107 |
|
| 108 |
with gr.Blocks(title="SegFormer") as app:
|
| 109 |
navbar = gr.Navbar(visible=True, main_page_name="Workspace")
|
| 110 |
-
gr.Markdown("## SegFormer
|
| 111 |
with gr.Row():
|
| 112 |
with gr.Column(scale=1):
|
| 113 |
inp = gr.Image(type="filepath", label="Upload Image")
|
|
|
|
| 114 |
btn_predict = gr.Button("Parse")
|
| 115 |
with gr.Column(scale=2):
|
| 116 |
out = gr.AnnotatedImage(label="Image parsed annotated")
|
| 117 |
|
| 118 |
-
btn_predict.click(predict, inputs=[inp], outputs=[out])
|
| 119 |
|
| 120 |
|
| 121 |
with app.route("About this", "/about"):
|
|
|
|
| 30 |
# huggingface: https://huggingface.co/spaces/leonelhs/segformer-tf-transformers
|
| 31 |
#
|
| 32 |
|
|
|
|
| 33 |
import os
|
|
|
|
| 34 |
from itertools import islice
|
| 35 |
|
| 36 |
import cv2
|
|
|
|
| 40 |
from PIL import Image
|
| 41 |
from huggingface_hub import hf_hub_download
|
| 42 |
|
| 43 |
+
from pallete import colormap
|
| 44 |
+
from labels import cloth_labels, fashion_labels, ADE20k_labels
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
|
| 46 |
REPO_ID = "leonelhs/segmentators"
|
|
|
|
| 47 |
|
| 48 |
+
ADE20k_path = hf_hub_download(repo_id=REPO_ID, filename="segformer/segformer-b5-finetuned-ade-640-640.onnx")
|
| 49 |
+
fashion_path = hf_hub_download(repo_id=REPO_ID, filename="segformer/segformer-b3-fashion.onnx")
|
| 50 |
+
clothes_path = hf_hub_download(repo_id=REPO_ID, filename="segformer/segformer_b2_clothes.onnx")
|
| 51 |
|
| 52 |
sess_options = ort.SessionOptions()
|
| 53 |
sess_options.intra_op_num_threads = os.cpu_count()
|
| 54 |
+
|
| 55 |
+
session_ade20k = ort.InferenceSession(fashion_path, sess_options, providers=["CPUExecutionProvider"])
|
| 56 |
+
session_cloth = ort.InferenceSession(clothes_path, sess_options, providers=["CPUExecutionProvider"])
|
| 57 |
+
session_fashion = ort.InferenceSession(fashion_path, sess_options, providers=["CPUExecutionProvider"])
|
| 58 |
|
| 59 |
|
| 60 |
+
def predict(input_img, model="ADE20k"):
|
|
|
|
|
|
|
| 61 |
|
| 62 |
+
session = session_ade20k
|
| 63 |
+
labels = ADE20k_labels
|
| 64 |
|
| 65 |
+
if model == "Cloth":
|
| 66 |
+
session = session_cloth
|
| 67 |
+
labels = cloth_labels
|
| 68 |
+
elif model == "Fashion":
|
| 69 |
+
session = session_fashion
|
| 70 |
+
labels = fashion_labels
|
| 71 |
|
|
|
|
| 72 |
|
| 73 |
img = cv2.imread(input_img)
|
| 74 |
img = cv2.resize(img, (640, 640)).astype(np.float32)
|
|
|
|
| 76 |
img_batch = np.expand_dims(img, axis=0)
|
| 77 |
img_batch = np.transpose(img_batch, (0, 3, 1, 2))
|
| 78 |
|
| 79 |
+
inputs = {'input': img_batch}
|
| 80 |
+
|
| 81 |
+
logits = session.run(None, inputs)[0]
|
| 82 |
|
| 83 |
logits = np.transpose(logits, (0, 2, 3, 1))
|
| 84 |
segmented_mask = np.argmax(logits, axis=-1)[0].astype("float32")
|
| 85 |
segmented_mask = cv2.resize(segmented_mask, (640, 640)).astype("uint8")
|
| 86 |
|
|
|
|
| 87 |
parts = []
|
| 88 |
unique_labels = np.unique(segmented_mask)
|
|
|
|
| 89 |
|
| 90 |
for label in unique_labels:
|
| 91 |
part = np.where(segmented_mask == label)
|
| 92 |
color_seg = np.full((640, 640, 3), 0, dtype=np.uint8)
|
| 93 |
color_seg[part[0], part[1], :] = colormap[label]
|
| 94 |
color_seg = cv2.cvtColor(color_seg, cv2.COLOR_BGR2GRAY)
|
| 95 |
+
parts.append((color_seg, labels[label]))
|
| 96 |
|
| 97 |
return Image.fromarray(img.astype("uint8")), parts
|
| 98 |
|
| 99 |
with gr.Blocks(title="SegFormer") as app:
|
| 100 |
navbar = gr.Navbar(visible=True, main_page_name="Workspace")
|
| 101 |
+
gr.Markdown("## SegFormer ONNX")
|
| 102 |
with gr.Row():
|
| 103 |
with gr.Column(scale=1):
|
| 104 |
inp = gr.Image(type="filepath", label="Upload Image")
|
| 105 |
+
mod = gr.Dropdown(choices=["ADE20k","Cloth","Fashion"], label="Model generator", value="ADE20k")
|
| 106 |
btn_predict = gr.Button("Parse")
|
| 107 |
with gr.Column(scale=2):
|
| 108 |
out = gr.AnnotatedImage(label="Image parsed annotated")
|
| 109 |
|
| 110 |
+
btn_predict.click(predict, inputs=[inp, mod], outputs=[out])
|
| 111 |
|
| 112 |
|
| 113 |
with app.route("About this", "/about"):
|
labels.py
ADDED
|
@@ -0,0 +1,223 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
cloth_labels = {
|
| 2 |
+
0: "background",
|
| 3 |
+
1: "Hat",
|
| 4 |
+
2: "Hair",
|
| 5 |
+
3: "Sunglasses",
|
| 6 |
+
4: "Upper-clothes",
|
| 7 |
+
5: "Skirt",
|
| 8 |
+
6: "Pants",
|
| 9 |
+
7: "Dress",
|
| 10 |
+
8: "Belt",
|
| 11 |
+
9: "Left-shoe",
|
| 12 |
+
10: "Right-shoe",
|
| 13 |
+
11: "Face",
|
| 14 |
+
12: "Left-leg",
|
| 15 |
+
13: "Right-leg",
|
| 16 |
+
14: "Left-arm",
|
| 17 |
+
15: "Right-arm",
|
| 18 |
+
16: "Bag",
|
| 19 |
+
17: "Scarf"
|
| 20 |
+
}
|
| 21 |
+
|
| 22 |
+
fashion_labels = {
|
| 23 |
+
0: "background",
|
| 24 |
+
1: "shirt",
|
| 25 |
+
2: "top",
|
| 26 |
+
3: "sweater",
|
| 27 |
+
4: "cardigan",
|
| 28 |
+
5: "jacket",
|
| 29 |
+
6: "vest",
|
| 30 |
+
7: "pants",
|
| 31 |
+
8: "shorts",
|
| 32 |
+
9: "skirt",
|
| 33 |
+
10: "coat",
|
| 34 |
+
11: "dress",
|
| 35 |
+
12: "jumpsuit",
|
| 36 |
+
13: "cape",
|
| 37 |
+
14: "glasses",
|
| 38 |
+
15: "hat",
|
| 39 |
+
16: "hairaccessory",
|
| 40 |
+
17: "tie",
|
| 41 |
+
18: "glove",
|
| 42 |
+
19: "watch",
|
| 43 |
+
20: "belt",
|
| 44 |
+
21: "legwarmer",
|
| 45 |
+
22: "tights",
|
| 46 |
+
23: "sock",
|
| 47 |
+
24: "shoe",
|
| 48 |
+
25: "bagwallet",
|
| 49 |
+
26: "scarf",
|
| 50 |
+
27: "umbrella",
|
| 51 |
+
28: "hood",
|
| 52 |
+
29: "collar",
|
| 53 |
+
30: "lapel",
|
| 54 |
+
31: "epaulette",
|
| 55 |
+
32: "sleeve",
|
| 56 |
+
33: "pocket",
|
| 57 |
+
34: "neckline",
|
| 58 |
+
35: "buckle",
|
| 59 |
+
36: "zipper",
|
| 60 |
+
37: "applique",
|
| 61 |
+
38: "bead",
|
| 62 |
+
39: "bow",
|
| 63 |
+
40: "flower",
|
| 64 |
+
41: "fringe",
|
| 65 |
+
42: "ribbon",
|
| 66 |
+
43: "rivet",
|
| 67 |
+
44: "ruffle",
|
| 68 |
+
45: "sequin",
|
| 69 |
+
46: "tassel"
|
| 70 |
+
}
|
| 71 |
+
|
| 72 |
+
ADE20k_labels = {
|
| 73 |
+
0: "wall",
|
| 74 |
+
1: "building;edifice",
|
| 75 |
+
2: "sky",
|
| 76 |
+
3: "floor;flooring",
|
| 77 |
+
4: "tree",
|
| 78 |
+
5: "ceiling",
|
| 79 |
+
6: "road;route",
|
| 80 |
+
7: "bed",
|
| 81 |
+
8: "windowpane;window",
|
| 82 |
+
9: "grass",
|
| 83 |
+
10: "cabinet",
|
| 84 |
+
11: "sidewalk;pavement",
|
| 85 |
+
12: "person;individual;someone;somebody;mortal;soul",
|
| 86 |
+
13: "earth;ground",
|
| 87 |
+
14: "door;double;door",
|
| 88 |
+
15: "table",
|
| 89 |
+
16: "mountain;mount",
|
| 90 |
+
17: "plant;flora;plant;life",
|
| 91 |
+
18: "curtain;drape;drapery;mantle;pall",
|
| 92 |
+
19: "chair",
|
| 93 |
+
20: "car;auto;automobile;machine;motorcar",
|
| 94 |
+
21: "water",
|
| 95 |
+
22: "painting;picture",
|
| 96 |
+
23: "sofa;couch;lounge",
|
| 97 |
+
24: "shelf",
|
| 98 |
+
25: "house",
|
| 99 |
+
26: "sea",
|
| 100 |
+
27: "mirror",
|
| 101 |
+
28: "rug;carpet;carpeting",
|
| 102 |
+
29: "field",
|
| 103 |
+
30: "armchair",
|
| 104 |
+
31: "seat",
|
| 105 |
+
32: "fence;fencing",
|
| 106 |
+
33: "desk",
|
| 107 |
+
34: "rock;stone",
|
| 108 |
+
35: "wardrobe;closet;press",
|
| 109 |
+
36: "lamp",
|
| 110 |
+
37: "bathtub;bathing;tub;bath;tub",
|
| 111 |
+
38: "railing;rail",
|
| 112 |
+
39: "cushion",
|
| 113 |
+
40: "base;pedestal;stand",
|
| 114 |
+
41: "box",
|
| 115 |
+
42: "column;pillar",
|
| 116 |
+
43: "signboard;sign",
|
| 117 |
+
44: "chest;of;drawers;chest;bureau;dresser",
|
| 118 |
+
45: "counter",
|
| 119 |
+
46: "sand",
|
| 120 |
+
47: "sink",
|
| 121 |
+
48: "skyscraper",
|
| 122 |
+
49: "fireplace;hearth;open;fireplace",
|
| 123 |
+
50: "refrigerator;icebox",
|
| 124 |
+
51: "grandstand;covered;stand",
|
| 125 |
+
52: "path",
|
| 126 |
+
53: "stairs;steps",
|
| 127 |
+
54: "runway",
|
| 128 |
+
55: "case;display;case;showcase;vitrine",
|
| 129 |
+
56: "pool;table;billiard;table;snooker;table",
|
| 130 |
+
57: "pillow",
|
| 131 |
+
58: "screen;door;screen",
|
| 132 |
+
59: "stairway;staircase",
|
| 133 |
+
60: "river",
|
| 134 |
+
61: "bridge;span",
|
| 135 |
+
62: "bookcase",
|
| 136 |
+
63: "blind;screen",
|
| 137 |
+
64: "coffee;table;cocktail;table",
|
| 138 |
+
65: "toilet;can;commode;crapper;pot;potty;stool;throne",
|
| 139 |
+
66: "flower",
|
| 140 |
+
67: "book",
|
| 141 |
+
68: "hill",
|
| 142 |
+
69: "bench",
|
| 143 |
+
70: "countertop",
|
| 144 |
+
71: "stove;kitchen;stove;range;kitchen;range;cooking;stove",
|
| 145 |
+
72: "palm;palm;tree",
|
| 146 |
+
73: "kitchen;island",
|
| 147 |
+
74: "computer;computing;machine;computing;device;data;processor;electronic;computer;information;processing;system",
|
| 148 |
+
75: "swivel;chair",
|
| 149 |
+
76: "boat",
|
| 150 |
+
77: "bar",
|
| 151 |
+
78: "arcade;machine",
|
| 152 |
+
79: "hovel;hut;hutch;shack;shanty",
|
| 153 |
+
80: "bus;autobus;coach;charabanc;double-decker;jitney;motorbus;motorcoach;omnibus;passenger;vehicle",
|
| 154 |
+
81: "towel",
|
| 155 |
+
82: "light;light;source",
|
| 156 |
+
83: "truck;motortruck",
|
| 157 |
+
84: "tower",
|
| 158 |
+
85: "chandelier;pendant;pendent",
|
| 159 |
+
86: "awning;sunshade;sunblind",
|
| 160 |
+
87: "streetlight;street;lamp",
|
| 161 |
+
88: "booth;cubicle;stall;kiosk",
|
| 162 |
+
89: "television;television;receiver;television;set;tv;tv;set;idiot;box;boob;tube;telly;goggle;box",
|
| 163 |
+
90: "airplane;aeroplane;plane",
|
| 164 |
+
91: "dirt;track",
|
| 165 |
+
92: "apparel;wearing;apparel;dress;clothes",
|
| 166 |
+
93: "pole",
|
| 167 |
+
94: "land;ground;soil",
|
| 168 |
+
95: "bannister;banister;balustrade;balusters;handrail",
|
| 169 |
+
96: "escalator;moving;staircase;moving;stairway",
|
| 170 |
+
97: "ottoman;pouf;pouffe;puff;hassock",
|
| 171 |
+
98: "bottle",
|
| 172 |
+
99: "buffet;counter;sideboard",
|
| 173 |
+
100: "poster;posting;placard;notice;bill;card",
|
| 174 |
+
101: "stage",
|
| 175 |
+
102: "van",
|
| 176 |
+
103: "ship",
|
| 177 |
+
104: "fountain",
|
| 178 |
+
105: "conveyer;belt;conveyor;belt;conveyer;conveyor;transporter",
|
| 179 |
+
106: "canopy",
|
| 180 |
+
107: "washer;automatic;washer;washing;machine",
|
| 181 |
+
108: "plaything;toy",
|
| 182 |
+
109: "swimming;pool;swimming;bath;natatorium",
|
| 183 |
+
110: "stool",
|
| 184 |
+
111: "barrel;cask",
|
| 185 |
+
112: "basket;handbasket",
|
| 186 |
+
113: "waterfall;falls",
|
| 187 |
+
114: "tent;collapsible;shelter",
|
| 188 |
+
115: "bag",
|
| 189 |
+
116: "minibike;motorbike",
|
| 190 |
+
117: "cradle",
|
| 191 |
+
118: "oven",
|
| 192 |
+
119: "ball",
|
| 193 |
+
120: "food;solid;food",
|
| 194 |
+
121: "step;stair",
|
| 195 |
+
122: "tank;storage;tank",
|
| 196 |
+
123: "trade;name;brand;name;brand;marque",
|
| 197 |
+
124: "microwave;microwave;oven",
|
| 198 |
+
125: "pot;flowerpot",
|
| 199 |
+
126: "animal;animate;being;beast;brute;creature;fauna",
|
| 200 |
+
127: "bicycle;bike;wheel;cycle",
|
| 201 |
+
128: "lake",
|
| 202 |
+
129: "dishwasher;dish;washer;dishwashing;machine",
|
| 203 |
+
130: "screen;silver;screen;projection;screen",
|
| 204 |
+
131: "blanket;cover",
|
| 205 |
+
132: "sculpture",
|
| 206 |
+
133: "hood;exhaust;hood",
|
| 207 |
+
134: "sconce",
|
| 208 |
+
135: "vase",
|
| 209 |
+
136: "traffic;light;traffic;signal;stoplight",
|
| 210 |
+
137: "tray",
|
| 211 |
+
138: "ashcan;trash;can;garbage;can;wastebin;ash;bin;ash-bin;ashbin;dustbin;trash;barrel;trash;bin",
|
| 212 |
+
139: "fan",
|
| 213 |
+
140: "pier;wharf;wharfage;dock",
|
| 214 |
+
141: "crt;screen",
|
| 215 |
+
142: "plate",
|
| 216 |
+
143: "monitor;monitoring;device",
|
| 217 |
+
144: "bulletin;board;notice;board",
|
| 218 |
+
145: "shower",
|
| 219 |
+
146: "radiator",
|
| 220 |
+
147: "glass;drinking;glass",
|
| 221 |
+
148: "clock",
|
| 222 |
+
149: "flag",
|
| 223 |
+
}
|
labels.txt
DELETED
|
@@ -1,150 +0,0 @@
|
|
| 1 |
-
wall
|
| 2 |
-
building;edifice
|
| 3 |
-
sky
|
| 4 |
-
floor;flooring
|
| 5 |
-
tree
|
| 6 |
-
ceiling
|
| 7 |
-
road;route
|
| 8 |
-
bed
|
| 9 |
-
windowpane;window
|
| 10 |
-
grass
|
| 11 |
-
cabinet
|
| 12 |
-
sidewalk;pavement
|
| 13 |
-
person;individual;someone;somebody;mortal;soul
|
| 14 |
-
earth;ground
|
| 15 |
-
door;double;door
|
| 16 |
-
table
|
| 17 |
-
mountain;mount
|
| 18 |
-
plant;flora;plant;life
|
| 19 |
-
curtain;drape;drapery;mantle;pall
|
| 20 |
-
chair
|
| 21 |
-
car;auto;automobile;machine;motorcar
|
| 22 |
-
water
|
| 23 |
-
painting;picture
|
| 24 |
-
sofa;couch;lounge
|
| 25 |
-
shelf
|
| 26 |
-
house
|
| 27 |
-
sea
|
| 28 |
-
mirror
|
| 29 |
-
rug;carpet;carpeting
|
| 30 |
-
field
|
| 31 |
-
armchair
|
| 32 |
-
seat
|
| 33 |
-
fence;fencing
|
| 34 |
-
desk
|
| 35 |
-
rock;stone
|
| 36 |
-
wardrobe;closet;press
|
| 37 |
-
lamp
|
| 38 |
-
bathtub;bathing;tub;bath;tub
|
| 39 |
-
railing;rail
|
| 40 |
-
cushion
|
| 41 |
-
base;pedestal;stand
|
| 42 |
-
box
|
| 43 |
-
column;pillar
|
| 44 |
-
signboard;sign
|
| 45 |
-
chest;of;drawers;chest;bureau;dresser
|
| 46 |
-
counter
|
| 47 |
-
sand
|
| 48 |
-
sink
|
| 49 |
-
skyscraper
|
| 50 |
-
fireplace;hearth;open;fireplace
|
| 51 |
-
refrigerator;icebox
|
| 52 |
-
grandstand;covered;stand
|
| 53 |
-
path
|
| 54 |
-
stairs;steps
|
| 55 |
-
runway
|
| 56 |
-
case;display;case;showcase;vitrine
|
| 57 |
-
pool;table;billiard;table;snooker;table
|
| 58 |
-
pillow
|
| 59 |
-
screen;door;screen
|
| 60 |
-
stairway;staircase
|
| 61 |
-
river
|
| 62 |
-
bridge;span
|
| 63 |
-
bookcase
|
| 64 |
-
blind;screen
|
| 65 |
-
coffee;table;cocktail;table
|
| 66 |
-
toilet;can;commode;crapper;pot;potty;stool;throne
|
| 67 |
-
flower
|
| 68 |
-
book
|
| 69 |
-
hill
|
| 70 |
-
bench
|
| 71 |
-
countertop
|
| 72 |
-
stove;kitchen;stove;range;kitchen;range;cooking;stove
|
| 73 |
-
palm;palm;tree
|
| 74 |
-
kitchen;island
|
| 75 |
-
computer;computing;machine;computing;device;data;processor;electronic;computer;information;processing;system
|
| 76 |
-
swivel;chair
|
| 77 |
-
boat
|
| 78 |
-
bar
|
| 79 |
-
arcade;machine
|
| 80 |
-
hovel;hut;hutch;shack;shanty
|
| 81 |
-
bus;autobus;coach;charabanc;double-decker;jitney;motorbus;motorcoach;omnibus;passenger;vehicle
|
| 82 |
-
towel
|
| 83 |
-
light;light;source
|
| 84 |
-
truck;motortruck
|
| 85 |
-
tower
|
| 86 |
-
chandelier;pendant;pendent
|
| 87 |
-
awning;sunshade;sunblind
|
| 88 |
-
streetlight;street;lamp
|
| 89 |
-
booth;cubicle;stall;kiosk
|
| 90 |
-
television;television;receiver;television;set;tv;tv;set;idiot;box;boob;tube;telly;goggle;box
|
| 91 |
-
airplane;aeroplane;plane
|
| 92 |
-
dirt;track
|
| 93 |
-
apparel;wearing;apparel;dress;clothes
|
| 94 |
-
pole
|
| 95 |
-
land;ground;soil
|
| 96 |
-
bannister;banister;balustrade;balusters;handrail
|
| 97 |
-
escalator;moving;staircase;moving;stairway
|
| 98 |
-
ottoman;pouf;pouffe;puff;hassock
|
| 99 |
-
bottle
|
| 100 |
-
buffet;counter;sideboard
|
| 101 |
-
poster;posting;placard;notice;bill;card
|
| 102 |
-
stage
|
| 103 |
-
van
|
| 104 |
-
ship
|
| 105 |
-
fountain
|
| 106 |
-
conveyer;belt;conveyor;belt;conveyer;conveyor;transporter
|
| 107 |
-
canopy
|
| 108 |
-
washer;automatic;washer;washing;machine
|
| 109 |
-
plaything;toy
|
| 110 |
-
swimming;pool;swimming;bath;natatorium
|
| 111 |
-
stool
|
| 112 |
-
barrel;cask
|
| 113 |
-
basket;handbasket
|
| 114 |
-
waterfall;falls
|
| 115 |
-
tent;collapsible;shelter
|
| 116 |
-
bag
|
| 117 |
-
minibike;motorbike
|
| 118 |
-
cradle
|
| 119 |
-
oven
|
| 120 |
-
ball
|
| 121 |
-
food;solid;food
|
| 122 |
-
step;stair
|
| 123 |
-
tank;storage;tank
|
| 124 |
-
trade;name;brand;name;brand;marque
|
| 125 |
-
microwave;microwave;oven
|
| 126 |
-
pot;flowerpot
|
| 127 |
-
animal;animate;being;beast;brute;creature;fauna
|
| 128 |
-
bicycle;bike;wheel;cycle
|
| 129 |
-
lake
|
| 130 |
-
dishwasher;dish;washer;dishwashing;machine
|
| 131 |
-
screen;silver;screen;projection;screen
|
| 132 |
-
blanket;cover
|
| 133 |
-
sculpture
|
| 134 |
-
hood;exhaust;hood
|
| 135 |
-
sconce
|
| 136 |
-
vase
|
| 137 |
-
traffic;light;traffic;signal;stoplight
|
| 138 |
-
tray
|
| 139 |
-
ashcan;trash;can;garbage;can;wastebin;ash;bin;ash-bin;ashbin;dustbin;trash;barrel;trash;bin
|
| 140 |
-
fan
|
| 141 |
-
pier;wharf;wharfage;dock
|
| 142 |
-
crt;screen
|
| 143 |
-
plate
|
| 144 |
-
monitor;monitoring;device
|
| 145 |
-
bulletin;board;notice;board
|
| 146 |
-
shower
|
| 147 |
-
radiator
|
| 148 |
-
glass;drinking;glass
|
| 149 |
-
clock
|
| 150 |
-
flag
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pallete.py
ADDED
|
@@ -0,0 +1,152 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
colormap = {
|
| 2 |
+
0: [120, 120, 120],
|
| 3 |
+
1: [180, 120, 120],
|
| 4 |
+
2: [6, 230, 230],
|
| 5 |
+
3: [80, 50, 50],
|
| 6 |
+
4: [4, 200, 3],
|
| 7 |
+
5: [120, 120, 80],
|
| 8 |
+
6: [140, 140, 140],
|
| 9 |
+
7: [204, 5, 255],
|
| 10 |
+
8: [230, 230, 230],
|
| 11 |
+
9: [4, 250, 7],
|
| 12 |
+
10: [224, 5, 255],
|
| 13 |
+
11: [235, 255, 7],
|
| 14 |
+
12: [150, 5, 61],
|
| 15 |
+
13: [120, 120, 70],
|
| 16 |
+
14: [8, 255, 51],
|
| 17 |
+
15: [255, 6, 82],
|
| 18 |
+
16: [143, 255, 140],
|
| 19 |
+
17: [204, 255, 4],
|
| 20 |
+
18: [255, 51, 7],
|
| 21 |
+
19: [204, 70, 3],
|
| 22 |
+
20: [0, 102, 200],
|
| 23 |
+
21: [61, 230, 250],
|
| 24 |
+
22: [255, 6, 51],
|
| 25 |
+
23: [11, 102, 255],
|
| 26 |
+
24: [255, 7, 71],
|
| 27 |
+
25: [255, 9, 224],
|
| 28 |
+
26: [9, 7, 230],
|
| 29 |
+
27: [220, 220, 220],
|
| 30 |
+
28: [255, 9, 92],
|
| 31 |
+
29: [112, 9, 255],
|
| 32 |
+
30: [8, 255, 214],
|
| 33 |
+
31: [7, 255, 224],
|
| 34 |
+
32: [255, 184, 6],
|
| 35 |
+
33: [10, 255, 71],
|
| 36 |
+
34: [255, 41, 10],
|
| 37 |
+
35: [7, 255, 255],
|
| 38 |
+
36: [224, 255, 8],
|
| 39 |
+
37: [102, 8, 255],
|
| 40 |
+
38: [255, 61, 6],
|
| 41 |
+
39: [255, 194, 7],
|
| 42 |
+
40: [255, 122, 8],
|
| 43 |
+
41: [0, 255, 20],
|
| 44 |
+
42: [255, 8, 41],
|
| 45 |
+
43: [255, 5, 153],
|
| 46 |
+
44: [6, 51, 255],
|
| 47 |
+
45: [235, 12, 255],
|
| 48 |
+
46: [160, 150, 20],
|
| 49 |
+
47: [0, 163, 255],
|
| 50 |
+
48: [140, 140, 140],
|
| 51 |
+
49: [250, 10, 15],
|
| 52 |
+
50: [20, 255, 0],
|
| 53 |
+
51: [31, 255, 0],
|
| 54 |
+
52: [255, 31, 0],
|
| 55 |
+
53: [255, 224, 0],
|
| 56 |
+
54: [153, 255, 0],
|
| 57 |
+
55: [0, 0, 255],
|
| 58 |
+
56: [255, 71, 0],
|
| 59 |
+
57: [0, 235, 255],
|
| 60 |
+
58: [0, 173, 255],
|
| 61 |
+
59: [31, 0, 255],
|
| 62 |
+
60: [11, 200, 200],
|
| 63 |
+
61: [255, 82, 0],
|
| 64 |
+
62: [0, 255, 245],
|
| 65 |
+
63: [0, 61, 255],
|
| 66 |
+
64: [0, 255, 112],
|
| 67 |
+
65: [0, 255, 133],
|
| 68 |
+
66: [255, 0, 0],
|
| 69 |
+
67: [255, 163, 0],
|
| 70 |
+
68: [255, 102, 0],
|
| 71 |
+
69: [194, 255, 0],
|
| 72 |
+
70: [0, 143, 255],
|
| 73 |
+
71: [51, 255, 0],
|
| 74 |
+
72: [0, 82, 255],
|
| 75 |
+
73: [0, 255, 41],
|
| 76 |
+
74: [0, 255, 173],
|
| 77 |
+
75: [10, 0, 255],
|
| 78 |
+
76: [173, 255, 0],
|
| 79 |
+
77: [0, 255, 153],
|
| 80 |
+
78: [255, 92, 0],
|
| 81 |
+
79: [255, 0, 255],
|
| 82 |
+
80: [255, 0, 245],
|
| 83 |
+
81: [255, 0, 102],
|
| 84 |
+
82: [255, 173, 0],
|
| 85 |
+
83: [255, 0, 20],
|
| 86 |
+
84: [255, 184, 184],
|
| 87 |
+
85: [0, 31, 255],
|
| 88 |
+
86: [0, 255, 61],
|
| 89 |
+
87: [0, 71, 255],
|
| 90 |
+
88: [255, 0, 204],
|
| 91 |
+
89: [0, 255, 194],
|
| 92 |
+
90: [0, 255, 82],
|
| 93 |
+
91: [0, 10, 255],
|
| 94 |
+
92: [0, 112, 255],
|
| 95 |
+
93: [51, 0, 255],
|
| 96 |
+
94: [0, 194, 255],
|
| 97 |
+
95: [0, 122, 255],
|
| 98 |
+
96: [0, 255, 163],
|
| 99 |
+
97: [255, 153, 0],
|
| 100 |
+
98: [0, 255, 10],
|
| 101 |
+
99: [255, 112, 0],
|
| 102 |
+
100: [143, 255, 0],
|
| 103 |
+
101: [82, 0, 255],
|
| 104 |
+
102: [163, 255, 0],
|
| 105 |
+
103: [255, 235, 0],
|
| 106 |
+
104: [8, 184, 170],
|
| 107 |
+
105: [133, 0, 255],
|
| 108 |
+
106: [0, 255, 92],
|
| 109 |
+
107: [184, 0, 255],
|
| 110 |
+
108: [255, 0, 31],
|
| 111 |
+
109: [0, 184, 255],
|
| 112 |
+
110: [0, 214, 255],
|
| 113 |
+
111: [255, 0, 112],
|
| 114 |
+
112: [92, 255, 0],
|
| 115 |
+
113: [0, 224, 255],
|
| 116 |
+
114: [112, 224, 255],
|
| 117 |
+
115: [70, 184, 160],
|
| 118 |
+
116: [163, 0, 255],
|
| 119 |
+
117: [153, 0, 255],
|
| 120 |
+
118: [71, 255, 0],
|
| 121 |
+
119: [255, 0, 163],
|
| 122 |
+
120: [255, 204, 0],
|
| 123 |
+
121: [255, 0, 143],
|
| 124 |
+
122: [0, 255, 235],
|
| 125 |
+
123: [133, 255, 0],
|
| 126 |
+
124: [255, 0, 235],
|
| 127 |
+
125: [245, 0, 255],
|
| 128 |
+
126: [255, 0, 122],
|
| 129 |
+
127: [255, 245, 0],
|
| 130 |
+
128: [10, 190, 212],
|
| 131 |
+
129: [214, 255, 0],
|
| 132 |
+
130: [0, 204, 255],
|
| 133 |
+
131: [20, 0, 255],
|
| 134 |
+
132: [255, 255, 0],
|
| 135 |
+
133: [0, 153, 255],
|
| 136 |
+
134: [0, 41, 255],
|
| 137 |
+
135: [0, 255, 204],
|
| 138 |
+
136: [41, 0, 255],
|
| 139 |
+
137: [41, 255, 0],
|
| 140 |
+
138: [173, 0, 255],
|
| 141 |
+
139: [0, 245, 255],
|
| 142 |
+
140: [71, 0, 255],
|
| 143 |
+
141: [122, 0, 255],
|
| 144 |
+
142: [0, 255, 184],
|
| 145 |
+
143: [0, 92, 255],
|
| 146 |
+
144: [184, 255, 0],
|
| 147 |
+
145: [0, 133, 255],
|
| 148 |
+
146: [255, 214, 0],
|
| 149 |
+
147: [25, 194, 194],
|
| 150 |
+
148: [102, 255, 0],
|
| 151 |
+
149: [92, 0, 255]
|
| 152 |
+
}
|
requirements.txt
CHANGED
|
@@ -1,4 +1,3 @@
|
|
| 1 |
onnxruntime==1.22.1
|
| 2 |
numpy==2.2.6
|
| 3 |
-
opencv-python
|
| 4 |
-
matplotlib== 3.10.6
|
|
|
|
| 1 |
onnxruntime==1.22.1
|
| 2 |
numpy==2.2.6
|
| 3 |
+
opencv-python
|
|
|