/yolov8-streamlit-fireant-tracking

Web Application using YOLOv8 algorithm for fire ant and nests detection in pair with Streamlit framework for Real-Time Object Detection and tracking in video streams. Detects rifa nest and ants easily!

Primary LanguagePythonMIT LicenseMIT

๐ŸŒŸ๐Ÿœ Real-time Fire Ants and Nests Detection and Tracking with YOLOv8 and Streamlit ๐ŸŽ‰๐Ÿ‘€

Get ready for cutting-edge object detection magic! This web app combines the power of YOLOv8 ๐Ÿ” for object detection and segmentation with the simplicity of the Streamlit framework to deliver real-time object detection and tracking in video streams. โœจ๐ŸŽฅ

Announcements

  • ๐Ÿ†๐ŸŽ‰ We are excited to announce that our team, MyInvictIA, has secured the third position in the Huawei ICT Competition at the Innovate Stage 2023-24! We are honored by this achievement and also pleased for participating in the last Castilla y Leรณn's Boards Innovation Contest 2024.

๐Ÿ“โŒ› To Do

  • Examples of the app running.
  • Examples of API usage.
  • ๐Ÿ”„ Migrate the application to a new Dashboard based on Vue.js and Flask among others.

๐Ÿš€๐Ÿ’ป Demo WebApp

Demonstration of WebApp

  • Check out this app in action ๐Ÿƒโ€โ™‚๏ธ โ€“ it's up and running on the Streamlit cloud server! โ˜๏ธ Thanks to the fantastic folks at Streamlit for supporting the community with cloud uploads. Here's where you can see it live:
  • Demo Web App Avaidable
  • โš ๏ธ Note: The cloud server may take a few seconds to load the app. Please be patient! ๐Ÿ•ฐ๏ธ

๐Ÿ•ต๏ธโ€โ™€๏ธ๐Ÿ”Ž Tracking with Object Detection Demo Video

Coming soon! ๐Ÿ“น Stay tuned for a demo showcasing this awesome feature

๐Ÿ“ธ๐Ÿ“ท Demo Pics

  • Home page ๐Ÿ 

Picture Home Page

๐Ÿ“ธ๐Ÿ” Page after uploading an image and object detection

๐Ÿ“ธ๐Ÿ”Example using the API

curl -X 'POST' 'http://local-ip-address:8000/detect_img' -H 'accept: application/json' -F 'image=@IMAGE_NAME.jpg;type=image/jepg'

img.png

๐Ÿ“ฆ๐Ÿ”จ Python's Requirements and Versions

  • aiofiles==23.2.1
  • fastapi==0.110.2
  • numpy==1.24.4
  • opencv_contrib_python_headless==4.9.0.80
  • lapx==0.5.7
  • python-multipart==0.0.9
  • python-dateutil==2.8.2
  • DateTime==5.5
  • pandas==2.0.3
  • Pillow==10.3.0
  • pytube==15.0.0
  • Requests==2.31.0
  • streamlit==1.33.0
  • ultralytics==8.2.22
  • uvicorn==0.29.0
  • torch==2.2.2+cpu
  • torchvision==0.17.2+cpu

๐ŸŒŸ๐Ÿ”ญ๐Ÿ”ง How to Install Python 3.10 in Ubuntu

  1. If you already have Python installed, you can skip the following steps until cloning the repo, if not run the following commands to install Python 3.10 in Ubuntu.
  2. Update Ubuntu before installing Python: sudo apt update && sudo apt upgrade
  3. Import Python PPA on Ubuntu: sudo add-apt-repository ppa:deadsnakes/ppa
  4. Refresh APT Sources List for Python PPA on Ubuntu: sudo apt update
  5. Install Python 3.10 on Ubuntu: sudo apt install python3.10 && sudo apt install python3.10-venv
  6. Verify Python 3.10 Installation on Ubuntu: python3.10 --version

๐ŸŒŸ๐Ÿ”ญ๐Ÿ”ง How to Run Locally just with Python and Virtual Environment

  1. Clone this repo: git clone https://github.com/MyInvictIA/yolov8-streamlit-fireant-tracking.git
  2. Hop into the directory: cd yolov8-streamlit-fireant-tracking/yolov8_app/
  1. Run the following command to create a python environment: python3.10 -m venv env
  2. Activate the environment with: source env/bin/activate
  3. Install the requirements: pip install -r requirements.txt
  4. Run the app: streamlit run app.py --server.port 8501 & uvicorn main:app --host 0.0.0.0 --port 8000 --reload
  5. Open a browser and get into the following URL for the Web App: http://localhost:8501
  6. Open a browser and get into the following URL for the API: http://localhost:8000/docs

๐ŸŒŸ๐Ÿ”ญ๐Ÿ‹ How to Run Locally with Docker Compose

  1. Clone this repo: git clone https://github.com/MyInvictIA/yolov8-streamlit-fireant-tracking.git
  2. Hop into the directory: cd yolov8-streamlit-fireant-tracking/
  1. Launch the app: docker-compose -f ./docker-compose.yml up -d
  2. And if you want to sync changes in real-time: docker-compose -f .\docker-compose.yml watch
  3. Open a browser and get into the following URL for the Web App: http://localhost:8501
  4. Open a browser and get into the following URL for the API: http://localhost:8000/docs

๐Ÿ”ง๐Ÿงฐ ML Model Config

  • Task time! Choose your mission: ๐ŸŽฏ Segmentation* supported only.
  • Set your confidence level for the model, using the slider to adjust the confidence threshold (25-100).
  • Once the model config is good to go, pick your source.

๐Ÿ–ผ๐Ÿ” Image Detection

  • The default image and its object-detected counterpart are proudly displayed on the main page.
  • Choose your source (the "Image" radio button โ€“ ready for local uploads or internet images).
  • Click "Browse files" to upload your image.
  • Hit the "Detect Objects" button, and watch the object detection algorithm work its magic on your image with your chosen confidence threshold.
  • The result โ€“ your image with detected objects โ€“ will appear. Click "Download Image" to save it!

๐ŸŽฌ๐Ÿ”Ž Detection in Videos

  • Demo Coming soon!. Video
  • Press on Detect Objects in Video button and the selected task will start on the selected video.

๐ŸŒ๐Ÿ” Detection on RTSP

  • Select the RTSP stream button
  • Enter the RTSP URL and press the "Detect Objects" button

โ–ถ๏ธ๐Ÿ”ฎ Detection on YouTube Video URL

  • Choose YouTube as your source
  • Paste the URL into the text box.
  • Let the detection/segmentation task do its thing on the YouTube video! Video

๐Ÿ™โ˜บ๏ธ Acknowledgements

โš ๏ธ๐Ÿ˜… Disclaimer

  • This project is currently rockin' the educational world. Hold tight before deploying it in production environments! ๐Ÿš€
  • If you love this repo, don't forget to leave a star! โญ

๐Ÿ†๐ŸŒ Contests and Competitions

This project has taken part in the following contests and competitions: