Skip to content

Commit

Permalink
Testing things
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandrebedel committed Apr 11, 2024
2 parents 60d2e1a + de87bf5 commit 867c715
Show file tree
Hide file tree
Showing 21,487 changed files with 3,662,847 additions and 1,872 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,6 @@ venv/
.vscode/c_cpp_properties.json
.vscode/launch.json
.vscode/ipch
.DS_Store
.DS_Store

input/cleanDataset
4 changes: 3 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{
"files.associations": {
"vector": "cpp"
}
},
"python.analysis.typeCheckingMode": "basic",
"python.analysis.autoImportCompletions": false
}
Binary file added ai/model.h5
Binary file not shown.
18 changes: 11 additions & 7 deletions ai/predict.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
import sys
import os
import numpy as np
from tensorflow.keras.preprocessing import image
import cv2
# from tensorflow.keras.preprocessing import image
from tensorflow.keras.models import load_model

class_labels = ["cardboard", "glass", "metal", "paper", "plastic", "trash"]


def get_class(img_path: str, model) -> str:
img = image.load_img(img_path, target_size=(512, 384))
img_array = image.img_to_array(img)
img_array = np.expand_dims(img_array, axis=0)
img_array /= 255.0 # Normalisation des pixels
img = cv2.imread(img_path)
img = cv2.resize(img, (256, 256))

# Prédiction de la classe
prediction = model.predict(img_array, verbose=0)
prediction = model.predict(np.expand_dims(img, axis=0), verbose=0)
predicted_class = class_labels[np.argmax(prediction)]
if predicted_class in ["plastic", "cardboard", "paper"]:
return "recyclable"
Expand All @@ -30,8 +28,14 @@ def main():
print("No such image found on the arguments list")
return -1

<<<<<<< HEAD
model = load_model(os.path.dirname(
os.path.abspath(__file__)) + "/alex.keras",
compile=False
=======
model = load_model(
os.path.dirname(os.path.abspath(__file__)) + "/trash_detection_model.keras"
>>>>>>> develop
)
print(get_class(sys.argv[1], model))
return 0
Expand Down
6 changes: 4 additions & 2 deletions ai/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
numpy
tensorflow
pillow
tensorflow==2.15.1
pillow
opencv-python
matplotlib
Binary file added ai/test-images/cardboard47.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ai/test-images/metal17.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ai/test-images/paper403.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ai/test-images/paper404.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ai/test-images/test.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ai/test-images/test.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ai/test-images/trash1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1,405 changes: 927 additions & 478 deletions ai/training.ipynb

Large diffs are not rendered by default.

1,383 changes: 0 additions & 1,383 deletions ai/training2.ipynb

This file was deleted.

2 changes: 2 additions & 0 deletions mobile/ios/.xcode.env.local
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export NODE_BINARY=/Users/alexandrebedel/.nvm/versions/node/v20.9.0/bin/node

26 changes: 26 additions & 0 deletions mobile/ios/Pods/DoubleConversion/LICENSE

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

54 changes: 54 additions & 0 deletions mobile/ios/Pods/DoubleConversion/README

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 867c715

Please sign in to comment.