This project aims to detect changes in scenes captured in two distinct datasets (test.npz
and base.npz
). Using image processing techniques and deep learning, we trained a YOLOv8 neural network to detect objects in the images and compare the detections between the scenes.
/
โโโ train/
โ โโโ pre_process/
โ โ โโโ dataset/ # Images extracted from NPZ files
โ โ โโโ images
โ โ โ โโโ labelled # Labeling files generated by labelImg
โ โ โโโ export_imgs.py # Script to export images from NPZ
โ โ โโโ splitTrainAndTest.py # Script divide dataset to train
โ โ โโโ train.sh # ShellScript to train YOLOv8
โ โโโ results_custom/ # YOLOv8 training results
โ โ โโโ weights/
โ โ โโโ confusion_matrix.png
โ โ โโโ results.png
โ โโโ results_default/ # Default YOLOv8 weights file
โ โ โโโ weights/
โโโ server/
โ โโโ static/ # Project static files: images, gifs, etc
โ โโโ templates/ # Project HTML files
โ โ โโโ index.html
โ โโโ app.py # Contains Flask information
โ โโโ config.py # Project configurations
โ โโโ frame_processor.py # Data processing
โ โโโ object_detector.py # Object detection with YOLOv8
โ โโโ utils.py # Utilities
โโโ play_yolo_simple.py # Script for local display of detections
โโโ play_yolo_server.py # Flask web service for displaying detections
โโโ play_yolo_streamlit.py # Streamlit script for displaying detections
โโโ README.md
โโโ best.pt # File weights from YOLOv8
โโโ base.npz # Dataset
โโโ test.npz # Dataset
๐ฆ Video Install - Tutorial.
If you don't have Anaconda installed yet, download and install Anaconda to manage Python packages and environments.
conda info --envs # show environments
conda env remove --name ktp # remove enviroment
conda create --name ktp pip python=3.9 # create enviroment
conda create --name ktp pip python=3.10.12 # create enviroment (mac os)
conda activate ktp # access enviroment
conda deactivate
Install the necessary libraries using requirements.txt
:
pip install -r requirements.txt
To train the YOLOv8 neural network, you need an environment with Ubuntu 20.04 and a GPU with CUDA installed. Follow the instructions from NVIDIA to install CUDA.
It's ideal to have CUDA installed for detection as well, as it will make the detection process faster. If you don't have a GPU, it will be possible to run via CPU.
You need to download the files base.npz
, test.npz
, and best.pt
for the project to work! These files are in a shared folder on OneDrive, which you can find in the Downloads section of this README.md. They are mandatory for the project to work! Download them and move them to the root of this project.
Inside the train
directory (see topic Downloads in this README.md), you should download the datasets (base.npz
and test.npz
) that contain the images for training and testing. The images were extracted from these files and saved in .png
format. We used the labelImg
tool to label the images before training the YOLOv8 neural network.
The training results, including model weights, confusion matrices, and other metrics, are available in the results_custom
folder.
- Extract the images from the NPZ files and save them in
.png
format. - Use
labelImg
to label the images.
To train the YOLOv8 model, follow the instructions in the official YOLOv8 repository.
The play_yolo_simple.py
script displays object detections in windows of the operating system itself, allowing for quick and direct analysis of the results.
python play_yolo_simple.py
The play_yolo_streamlit.py
script displays object detections in the browser, allowing for quick and direct analysis of the results via the web.
streamlit run play_yolo_streamlit.py
For a more accessible and interactive interface, use the web service implemented with Flask (play_yolo_server.py
). This service allows the results to be accessed remotely through a web browser.
python play_yolo_server.py
Access the web interface at http://localhost:5001.
This project demonstrates the application of deep neural networks for change detection in scenes captured by different datasets. Through the use of YOLOv8 and the Flask framework, we created a robust solution to identify and visualize changes in images efficiently and accessibly.
This README provides essential instructions for configuring and running the project. Make sure to follow all steps carefully to ensure that the environment is correctly configured and that all scripts work as expected. For more details on environment setup and tool usage, refer to the official documentation of the libraries and frameworks used.
Download at the root of the project.
Download and Extract train.zip
at the root of the project. Optional (only for train):
- Name: Gabriel Tavares
- Email: [email protected]
- Portfolio: https://gabrieltavaresmelo.github.io/portifolio
We hope this project is helpful and provides a clear understanding of change detection in scenes using advanced deep learning techniques. For any questions or issues, feel free to open an issue or contact me.
๐ฅ๏ธ๐ฉโ๐ป๐