Prerequisites
- Download mongo
- Download GO and Go libraries using go get link of library
- setting up Django environment a. Download and run yolo9000 b. Download and run TextBox++
To run
-
clone the git
-
Download both weights from :
-
https://drive.google.com/drive/folders/1pW4mKNOzOIf0Edyr4BppwnLpddCQ6Qch?usp=sharing
-
https://drive.google.com/open?id=1JupZYcQO7Jh5aiRQLwNzYZaX0uYGULdK
-
Place the weights in the Django/mlbackend folder with the other .py files
WebApp (Reactjs) : port-3000
- cd Client
- npm install
- npm start
API (Golang): port-8080
- cd API_Go
- go run main.go
MLSystem (Django): port-8000
- cd pythonbackend
- cd djangobackend
- python3 manage.py runserver
Server (NodeJS): port-4000
- cd NodeServer
- npm install
- npm install express-zip
- npm install multer
- npm install zip-folder
- npm install cors
- npm install express
- npm install serve-index
- node server.js
if npm build is failing, install by : npm install
For building yolo9000 :
- pip install Cython
- git clone https://github.com/thtrieu/darkflow.git
- cd darkflow
- python3 setup.py build_ext --inplace
- pip install .
To setup mongo collections :
- use GoDB
- db.createCollection("ImageNames")
- db.createCollection("UserData")
Feature list
- Upload Video
- Upload photos
- Draw boxes
- Check IoU
- Check ML output image
- Save output in .txt format
- Download ZIP a. Images b. Annotations c. IoU d. ML output
Process of measuring IoU
- Each bounding box with label : "people" is considered (Iterated through)
- The bounding box is checked with all the ground truths for IoU
- The maximum IoU is considered for that bounding box (non-max suppression)
- The above process is repeated for each bounding box detected by the YOLO algorithm
- To add the possibility that people in the ground truth are completely ignored by the yolo algorithm a.The difference between the number of people detected by yolo and the number of people annotated for ground truth is considered b.This is added as extra 0's to the list of the IoU's
- The average of all the maximum IoU's of each bounding box and the additional 0's is taken for overall IoU for an image
- The average of all the IoU's for each image is taken as the average IoU for the dataset (~400 images)
- check code in CheckIoU/iou.py for source code
Technologies used
- ReactJs for Frontend (3000)
- NodeJs for Backend (4000)
- Django to run the Machine learning algorithms in the background (8000)
- Golang for running GO API's to connect the application with the Database (8080)
- MongoDB as NoSQL Database (27017)
- OpenCV for drawing boxes and checking IoU and for dividing the video into frames
- DarkFlow for running yolo9000
- tensorflow, numpy, keras for assisting the machine learning application
- matplotlib is being used for testing images (display of images)
- Vanilla Js for functions and bits of React code
- Docker
- AWS EC2
- AWS S3
- Mongo Atlas
- Localtunnel
- AWS CloudFront
Downloading and processing video :
- If a video is already available, place it in the main folder or download a video from YouTube(Y2 downloader or In-House application)
- Run the dividevideo.py to split the video into frames at random intervals between 2-5 seconds (considering 30 fps)
- The divided frames will be available in the Dividedframes folder
Annotation System :
- The user signs up into the system by giving email,username,name and password
- Once the signUp is successful, the user is redirected to the upload page
- The user can upload upto 99 images at once and click viewimages
- Upon succeful upload of the images, the user is redirected to the EditPage
- EditPage contains the NavigationBar and the WorkingArea
- The user can draw boxes around the subject of interest and click save
- Upon clicking save, the coordinates of the boxes drawn will be saved in the backend
- The User has two options to check the IoU :
a. Check IoU at each image :
- The user can click on Check ml output yolo to check the IoU for that particular file
- Continue this process for each image and the individual IoU's will be saved in the IoU folder in IoU.txt
- Download/DownloadAll depending on the nature of output needed I.Download will only download the annotations II.DownloadAll will download the images,mloutputs,annotations,IoU and any aditional data present b. Continue the annotations for all images and check IoU together
- The user can just keep annotating images to have a smooth workflow
- DownloadAll once the annotations are done
- Place the images and the output in the checkIoU folder
- Run iou.py to check the IoU of all images and store it in the IoU folder in IoU.txt
- The output of the machine learning algorithms can be seen by running checkmloutput.py, images will be stored in the mlimages folder
To migrate the application to cloud, please check DeploymentReadme