Skip to content

Commit

Permalink
Added Self-Trained Classifications
Browse files Browse the repository at this point in the history
  • Loading branch information
hoangsonww committed Apr 3, 2024
1 parent 5a690af commit e4a3132
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 4 deletions.
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,30 @@ The main script will display a list of available classifiers. Enter the number c

To stop the script, press `Q`, `ESC`, or otherwise close the window.

Alternatively, you can also run the individual scripts in each subdirectory below to run the classifiers directly.

---

## Flask Web App

If you would like to use the interactive website version of this app, you can run the Flask web app. The web app allows you to use the classifiers through a web interface. You can choose a classifier and the app will run the selected classifier.

To run the Flask web app, use the following command:

```bash
python app.py
```

The web app will start running on `http://127.0.0.1:5000/`. Open this URL in your web browser to access the web app. You can then choose a classifier from the list of available classifiers and run it.

Here is what it looks like:

<p align="center">
<img src="flask-web-app.png" alt="Flask Web App" width="100%">
</p>

Note that the app has also been Deployed to Heroku [here](https://ai-multipurpose-classifier-b1655f2a20d4.herokuapp.com/). However, due to changes in Heroku's free tier regarding available Dynos (and I'm a broke college student), the app may not work as expected. If you encounter any issues, please run the app locally using the instructions above.

---

## Vehicle Classification
Expand Down
8 changes: 4 additions & 4 deletions Vehicle-Classification/vehicle_detection.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,12 @@ def process_input(source):

if source == 'webcam':
cap = cv2.VideoCapture(0)
while True:
while cap.isOpened():
ret, frame = cap.read()
if not ret:
break
process_frame(frame, model, classes, output_layers, colors)
if cv2.waitKey(1) == 27:
if cv2.waitKey(1) == 27 or cv2.getWindowProperty("Video", cv2.WND_PROP_VISIBLE) < 1:
break
cap.release()
elif source.endswith(('.png', '.jpg', '.jpeg')):
Expand All @@ -77,12 +77,12 @@ def process_input(source):
cv2.waitKey(0)
else:
cap = cv2.VideoCapture(source)
while True:
while cap.isOpened():
ret, frame = cap.read()
if not ret:
break
process_frame(frame, model, classes, output_layers, colors)
if cv2.waitKey(1) == 27:
if cv2.waitKey(1) == 27 or cv2.getWindowProperty("Video", cv2.WND_PROP_VISIBLE) < 1:
break
cap.release()

Expand Down
Binary file added flask-web-app.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit e4a3132

Please sign in to comment.