andrey-kireev-1 / Recognizer

Image&Video Recognizer with Yolov5

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Image&Video Weapon Recognizer by Yolov5

First, you can run my example code, and then train your own model and use it in the program.

Weapon Recognizer

Program consist of yolov5 model, user interface form on Qt and recognize script.

To run Recognizer clone repo:

git clone https://github.com/andrey-kireev-1/Recognizer.git

Install python requirements:

pip install -r requirements.txt

Open and run app.py. Here you can select recognition accuracy and files (images: .jpg, .png; videos: .avi, .mp4).

menu

After selecting a file, object recognition will start. 4 categories of weapons can be recognized: pistol, machine gun, knife, hand grenade. For example, the input and output image could be like this:

example

And video:

image

Download different photos and videos with weapons and try to recognize them. Enjoy :)

How to create your own model to recognize:

Collect a set of images with your object. Label your images (for example, with: Make Sense).

Divide the collected and labeled set of images into 3 folders: train, valid, test. (Further, I recommend using Google Colab, but you can also work locally.) Create a folder in Google Drive, put the folders train, valid, test and dataset.yaml file there (replace the folder paths according to your Google Drive).

Next: Upload on Google Drive train_model.ipynb, open it in Google Colab, change folders paths and run this file. The model will start training.

train

After completing the training of the model, download the file best.pt from the path /content/yolov5/runs/train/exp/weights/best.pt. Close Google Colab. Place your best.pt file into your cloning repo local folder. Now your program will recognize your own object.


Kireev 2022

About

Image&Video Recognizer with Yolov5


Languages

Language:Python 68.7%Language:Jupyter Notebook 31.3%