Spaces:
Sleeping
Sleeping
Add latest updates and clean up
Browse files- fix_model_config.py +0 -30
- requirements.txt +9 -5
- src/TrashSort_Training_Notebook.ipynb +0 -0
- src/confusion_matrix.png +0 -0
- src/models/trashsort_cnn.h5 +2 -2
- src/training_history.png +0 -0
fix_model_config.py
DELETED
|
@@ -1,30 +0,0 @@
|
|
| 1 |
-
import h5py
|
| 2 |
-
import json
|
| 3 |
-
|
| 4 |
-
model_path = 'src/models/trashsort_cnn.h5'
|
| 5 |
-
|
| 6 |
-
with h5py.File(model_path, 'r+') as f:
|
| 7 |
-
config_raw = f.attrs.get('model_config')
|
| 8 |
-
|
| 9 |
-
# If bytes, decode; if string, use as is
|
| 10 |
-
if isinstance(config_raw, bytes):
|
| 11 |
-
config_str = config_raw.decode('utf-8')
|
| 12 |
-
else:
|
| 13 |
-
config_str = config_raw
|
| 14 |
-
|
| 15 |
-
config = json.loads(config_str)
|
| 16 |
-
|
| 17 |
-
def fix_config(cfg):
|
| 18 |
-
if isinstance(cfg, dict):
|
| 19 |
-
if cfg.get('class_name') == 'InputLayer' and 'config' in cfg and 'batch_shape' in cfg['config']:
|
| 20 |
-
cfg['config'].pop('batch_shape')
|
| 21 |
-
for v in cfg.values():
|
| 22 |
-
fix_config(v)
|
| 23 |
-
elif isinstance(cfg, list):
|
| 24 |
-
for item in cfg:
|
| 25 |
-
fix_config(item)
|
| 26 |
-
|
| 27 |
-
fix_config(config)
|
| 28 |
-
f.attrs['model_config'] = json.dumps(config).encode('utf-8')
|
| 29 |
-
|
| 30 |
-
print("Model config fixed successfully.")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
requirements.txt
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
|
|
| 1 |
streamlit==1.32.0
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
tensorflow==2.18.0
|
| 2 |
streamlit==1.32.0
|
| 3 |
+
ml-dtypes==0.4.0
|
| 4 |
+
tensorboard==2.18.0
|
| 5 |
+
numpy
|
| 6 |
+
pillow
|
| 7 |
+
opencv-python
|
| 8 |
+
scikit-learn
|
| 9 |
+
matplotlib
|
| 10 |
+
seaborn
|
src/TrashSort_Training_Notebook.ipynb
CHANGED
|
The diff for this file is too large to render.
See raw diff
|
|
|
src/confusion_matrix.png
CHANGED
|
|
src/models/trashsort_cnn.h5
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:7cd9b5afbba6ad13ccc5e085e350151e025131dd2d72b7492823e7bbeafaf0d6
|
| 3 |
+
size 9646640
|
src/training_history.png
CHANGED
|
|