Download weights from model repo; drop unused deps
Browse filesLoad the model from the FathomNet/MBARI-benthic-supercategory-detector
model repo via huggingface_hub instead of bundling the 303MB weight
file. Drop tator and pip-chill (unused at runtime) and the redundant
gradio pin (already managed via sdk_version) from requirements.txt,
and remove stray .idea/ IDE config files. The Detectron2
build-from-source logic in app.py is untouched since this Space is
currently healthy and that path is fragile. Bump gradio to 6.9.0.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
- .idea/MBARI_Benthic_Supercategory_Object_Detector.iml +0 -12
- .idea/inspectionProfiles/Project_Default.xml +0 -22
- .idea/inspectionProfiles/profiles_settings.xml +0 -6
- .idea/misc.xml +0 -4
- .idea/modules.xml +0 -8
- .idea/vcs.xml +0 -6
- .idea/workspace.xml +0 -79
- README.md +1 -1
- inference.py +5 -1
- model_final.pth +0 -3
- requirements.txt +1 -3
.idea/MBARI_Benthic_Supercategory_Object_Detector.iml
DELETED
|
@@ -1,12 +0,0 @@
|
|
| 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="inheritedJdk" />
|
| 6 |
-
<orderEntry type="sourceFolder" forTests="false" />
|
| 7 |
-
</component>
|
| 8 |
-
<component name="PyDocumentationSettings">
|
| 9 |
-
<option name="format" value="PLAIN" />
|
| 10 |
-
<option name="myDocStringFormat" value="Plain" />
|
| 11 |
-
</component>
|
| 12 |
-
</module>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.idea/inspectionProfiles/Project_Default.xml
DELETED
|
@@ -1,22 +0,0 @@
|
|
| 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="9">
|
| 8 |
-
<item index="0" class="java.lang.String" itemvalue="gradio" />
|
| 9 |
-
<item index="1" class="java.lang.String" itemvalue="scikit-image" />
|
| 10 |
-
<item index="2" class="java.lang.String" itemvalue="opencv-python" />
|
| 11 |
-
<item index="3" class="java.lang.String" itemvalue="scikit-learn" />
|
| 12 |
-
<item index="4" class="java.lang.String" itemvalue="cython" />
|
| 13 |
-
<item index="5" class="java.lang.String" itemvalue="tator" />
|
| 14 |
-
<item index="6" class="java.lang.String" itemvalue="torch" />
|
| 15 |
-
<item index="7" class="java.lang.String" itemvalue="numpy" />
|
| 16 |
-
<item index="8" class="java.lang.String" itemvalue="pip-chill" />
|
| 17 |
-
</list>
|
| 18 |
-
</value>
|
| 19 |
-
</option>
|
| 20 |
-
</inspection_tool>
|
| 21 |
-
</profile>
|
| 22 |
-
</component>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.idea/inspectionProfiles/profiles_settings.xml
DELETED
|
@@ -1,6 +0,0 @@
|
|
| 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
DELETED
|
@@ -1,4 +0,0 @@
|
|
| 1 |
-
<?xml version="1.0" encoding="UTF-8"?>
|
| 2 |
-
<project version="4">
|
| 3 |
-
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.10 (MBARI_Benthic_Supercategory_Object_Detector)" project-jdk-type="Python SDK" />
|
| 4 |
-
</project>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.idea/modules.xml
DELETED
|
@@ -1,8 +0,0 @@
|
|
| 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/MBARI_Benthic_Supercategory_Object_Detector.iml" filepath="$PROJECT_DIR$/.idea/MBARI_Benthic_Supercategory_Object_Detector.iml" />
|
| 6 |
-
</modules>
|
| 7 |
-
</component>
|
| 8 |
-
</project>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.idea/vcs.xml
DELETED
|
@@ -1,6 +0,0 @@
|
|
| 1 |
-
<?xml version="1.0" encoding="UTF-8"?>
|
| 2 |
-
<project version="4">
|
| 3 |
-
<component name="VcsDirectoryMappings">
|
| 4 |
-
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
| 5 |
-
</component>
|
| 6 |
-
</project>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.idea/workspace.xml
DELETED
|
@@ -1,79 +0,0 @@
|
|
| 1 |
-
<?xml version="1.0" encoding="UTF-8"?>
|
| 2 |
-
<project version="4">
|
| 3 |
-
<component name="AnalysisUIOptions">
|
| 4 |
-
<option name="SCOPE_TYPE" value="3" />
|
| 5 |
-
</component>
|
| 6 |
-
<component name="ChangeListManager">
|
| 7 |
-
<list default="true" id="e4d9959f-0c5b-4a80-8b43-a006df26f93a" name="Changes" comment="" />
|
| 8 |
-
<option name="SHOW_DIALOG" value="false" />
|
| 9 |
-
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
| 10 |
-
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
| 11 |
-
<option name="LAST_RESOLUTION" value="IGNORE" />
|
| 12 |
-
</component>
|
| 13 |
-
<component name="FileTemplateManagerImpl">
|
| 14 |
-
<option name="RECENT_TEMPLATES">
|
| 15 |
-
<list>
|
| 16 |
-
<option value="Python Script" />
|
| 17 |
-
</list>
|
| 18 |
-
</option>
|
| 19 |
-
</component>
|
| 20 |
-
<component name="Git.Settings">
|
| 21 |
-
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
| 22 |
-
</component>
|
| 23 |
-
<component name="MarkdownSettingsMigration">
|
| 24 |
-
<option name="stateVersion" value="1" />
|
| 25 |
-
</component>
|
| 26 |
-
<component name="ProjectId" id="2Gb8uoHwbYstJh8EiSXdznDXYLe" />
|
| 27 |
-
<component name="ProjectLevelVcsManager" settingsEditedManually="true">
|
| 28 |
-
<ConfirmationsSetting value="2" id="Add" />
|
| 29 |
-
</component>
|
| 30 |
-
<component name="ProjectViewState">
|
| 31 |
-
<option name="hideEmptyMiddlePackages" value="true" />
|
| 32 |
-
<option name="showLibraryContents" value="true" />
|
| 33 |
-
</component>
|
| 34 |
-
<component name="PropertiesComponent">{
|
| 35 |
-
"keyToString": {
|
| 36 |
-
"ASKED_ADD_EXTERNAL_FILES": "true",
|
| 37 |
-
"ASKED_SHARE_PROJECT_CONFIGURATION_FILES": "true",
|
| 38 |
-
"RunOnceActivity.OpenProjectViewOnStart": "true",
|
| 39 |
-
"RunOnceActivity.ShowReadmeOnStart": "true",
|
| 40 |
-
"SHARE_PROJECT_CONFIGURATION_FILES": "true",
|
| 41 |
-
"WebServerToolWindowFactoryState": "false",
|
| 42 |
-
"settings.editor.selected.configurable": "com.jetbrains.python.configuration.PyActiveSdkModuleConfigurable"
|
| 43 |
-
}
|
| 44 |
-
}</component>
|
| 45 |
-
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
|
| 46 |
-
<component name="TaskManager">
|
| 47 |
-
<task active="true" id="Default" summary="Default task">
|
| 48 |
-
<changelist id="e4d9959f-0c5b-4a80-8b43-a006df26f93a" name="Changes" comment="" />
|
| 49 |
-
<created>1666646148268</created>
|
| 50 |
-
<option name="number" value="Default" />
|
| 51 |
-
<option name="presentableId" value="Default" />
|
| 52 |
-
<updated>1666646148268</updated>
|
| 53 |
-
<workItem from="1666646160771" duration="3554000" />
|
| 54 |
-
<workItem from="1666649813029" duration="426000" />
|
| 55 |
-
<workItem from="1666707251602" duration="12000" />
|
| 56 |
-
</task>
|
| 57 |
-
<servers />
|
| 58 |
-
</component>
|
| 59 |
-
<component name="TypeScriptGeneratedFilesManager">
|
| 60 |
-
<option name="version" value="3" />
|
| 61 |
-
</component>
|
| 62 |
-
<component name="UnknownFeatures">
|
| 63 |
-
<option featureType="com.intellij.fileTypeFactory" implementationName="requirements.txt" />
|
| 64 |
-
</component>
|
| 65 |
-
<component name="Vcs.Log.Tabs.Properties">
|
| 66 |
-
<option name="TAB_STATES">
|
| 67 |
-
<map>
|
| 68 |
-
<entry key="MAIN">
|
| 69 |
-
<value>
|
| 70 |
-
<State />
|
| 71 |
-
</value>
|
| 72 |
-
</entry>
|
| 73 |
-
</map>
|
| 74 |
-
</option>
|
| 75 |
-
</component>
|
| 76 |
-
<component name="VcsManagerConfiguration">
|
| 77 |
-
<option name="ADD_EXTERNAL_FILES_SILENTLY" value="true" />
|
| 78 |
-
</component>
|
| 79 |
-
</project>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
README.md
CHANGED
|
@@ -4,7 +4,7 @@ emoji: 🚀
|
|
| 4 |
colorFrom: red
|
| 5 |
colorTo: yellow
|
| 6 |
sdk: gradio
|
| 7 |
-
sdk_version:
|
| 8 |
app_file: app.py
|
| 9 |
pinned: false
|
| 10 |
---
|
|
|
|
| 4 |
colorFrom: red
|
| 5 |
colorTo: yellow
|
| 6 |
sdk: gradio
|
| 7 |
+
sdk_version: 6.9.0
|
| 8 |
app_file: app.py
|
| 9 |
pinned: false
|
| 10 |
---
|
inference.py
CHANGED
|
@@ -6,6 +6,7 @@ import detectron2
|
|
| 6 |
import torchvision
|
| 7 |
import cv2
|
| 8 |
import torch
|
|
|
|
| 9 |
|
| 10 |
from detectron2 import model_zoo
|
| 11 |
from detectron2.data import Metadata
|
|
@@ -31,7 +32,10 @@ from PIL import Image
|
|
| 31 |
# SCORE_THRESH - This is where you can set the model score threshold
|
| 32 |
|
| 33 |
CONFIG_FILE = "fathomnet_config_v2_1280.yaml"
|
| 34 |
-
WEIGHTS_FILE =
|
|
|
|
|
|
|
|
|
|
| 35 |
NMS_THRESH = 0.45 #
|
| 36 |
SCORE_THRESH = 0.3 #
|
| 37 |
|
|
|
|
| 6 |
import torchvision
|
| 7 |
import cv2
|
| 8 |
import torch
|
| 9 |
+
from huggingface_hub import hf_hub_download
|
| 10 |
|
| 11 |
from detectron2 import model_zoo
|
| 12 |
from detectron2.data import Metadata
|
|
|
|
| 32 |
# SCORE_THRESH - This is where you can set the model score threshold
|
| 33 |
|
| 34 |
CONFIG_FILE = "fathomnet_config_v2_1280.yaml"
|
| 35 |
+
WEIGHTS_FILE = hf_hub_download(
|
| 36 |
+
repo_id="FathomNet/MBARI-benthic-supercategory-detector",
|
| 37 |
+
filename="model_final.pth",
|
| 38 |
+
)
|
| 39 |
NMS_THRESH = 0.45 #
|
| 40 |
SCORE_THRESH = 0.3 #
|
| 41 |
|
model_final.pth
DELETED
|
@@ -1,3 +0,0 @@
|
|
| 1 |
-
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:fa6fc822bea91ce7b84d8314f979ebbcc1041cf18ab0cdabde33569185289f8d
|
| 3 |
-
size 303011247
|
|
|
|
|
|
|
|
|
|
|
|
requirements.txt
CHANGED
|
@@ -1,11 +1,9 @@
|
|
| 1 |
cython
|
| 2 |
numpy
|
| 3 |
opencv-python
|
| 4 |
-
pip-chill
|
| 5 |
scikit-image
|
| 6 |
scikit-learn
|
| 7 |
-
tator
|
| 8 |
torch
|
| 9 |
-
gradio
|
| 10 |
pillow
|
| 11 |
torchvision
|
|
|
|
|
|
| 1 |
cython
|
| 2 |
numpy
|
| 3 |
opencv-python
|
|
|
|
| 4 |
scikit-image
|
| 5 |
scikit-learn
|
|
|
|
| 6 |
torch
|
|
|
|
| 7 |
pillow
|
| 8 |
torchvision
|
| 9 |
+
huggingface_hub
|