Vue front-end target detection and training visualization system based on Yolov5

1. Object recognition (detection)

1. Choose weights

 illustrate:

  1. yolov5s.pt, yolov5m.pt, yolov5l.pt, yolov5x.pt are built-in pre-training weights, which can recognize common objects such as: people, cats, dogs, cars, etc.
  2. You can choose self-training weights to identify and detect specific objects

2. Upload identification

2. Object training

1. Image annotation

1.1 Create a new dataset

 Note: Try not to use Chinese!

1.2 Upload pictures

 Note: The picture name cannot appear in Chinese!

1.3 Select the labeled dataset

1.4 Create a new label class

  

1.5 Labeling

Note that you must save the current picture every time you mark it!

2. Weight training

2.1 Select Dataset

Note: The data set must be fully labeled, that is, each picture needs to have corresponding labeling information.

2.2 Select pre-training weights

2.3 Other training parameters

2.4 Start training

If the training log output exceeds the memory limit, please reduce the Batch size parameter appropriately:

3. Performance and loss

3.1 View training log

3.2 Training weight detection

3. Project deployment

1. Environmental requirements

1.1 Docker container

  • The system test environment is Ubuntu 16.04.6 LTS, and the Linux kernel is 4.15.0:
   Static hostname: 304
         Icon name: computer-desktop
           Chassis: desktop
        Machine ID: 1d0f19d8da7049cdaa13ef3402ecdc18
           Boot ID: a07e6032ce044fac872d74c61b339b8f
  Operating System: Ubuntu 16.04.6 LTS
            Kernel: Linux 4.15.0-70-generic
      Architecture: x86-64
  • The Docker container version is 19.03, try to use a newer version of Docker:
Docker version 19.03.13, build 4484c46d9d

1.2 Required images

  • mysql:5.7 mysql database mirroring
docker pull mysql:5.7
  • flasktrain:latest project mirror
docker pull registry.cn-hangzhou.aliyuncs.com/lvjune/yolov5_train_system:latest

or build from Dockerfile:

docker build . -t yolov5-train-system:latest

UPDATE : Removed use of mysql database in favor of locally stored sqlite3 database.

2. Project configuration

2.1 Database configuration

  • Start a mysql database container, mapped to host port 33066, root password 123456
docker run -d -e MYSQL_ROOT_PASSWORD=123456 -p 33066:3306 mysql:5.7
  • Start and enter the container, create a database
mysql -uroot -p123456
create database train_system;

2.2 Training System Configuration

  • Start a flasktrain container and map three ports, namely: 5050 corresponds to the back-end access port, 6060 corresponds to the Tensorboard access port, and 8080 corresponds to the front-end access port
docker run -d -p 5050:5000 -p 6060:6006 -p 8080:80 flasktrain
  • Start and enter the container, modify the front-end access server address:
vim /train/vue/config.js
FLASK_CONFIG.baseUrl = "http://服务器IP地址:5050"
FLASK_CONFIG.tensorboardUrl = "http://服务器IP地址:6060/"

Update : Using nginx as a reverse proxy solves the problem of front-end and back-end cross-domain access inside the container. For details, see the proxy content of the nginx.conf file. There is no need to manually modify port and address access configurations.

3. Project running

3.1 Running the front end

service nginx start

3.2 Running the backend

cd /train && python run.py

3.3 Browser access

http://服务IP地址:8080/

Update : Write the startup command to the startup.sh file as follows:

#!/bin/bash

# cd /train
host=`cat /etc/hosts | awk 'END {print}' | cut -f 1`
sed -i "s/127.0.0.1/${host}/g" nginx.conf
nginx -c /train/nginx.conf
python run.py

# docker run -d -p 80:80 yolov5trainsystem ./startup.sh
# set ff=unix
# chmod +x ./startup.sh

First obtain the virtual address allocated by docker in the container, replace the 127.0.0.1 of nginx proxy for host access, and then start the nginx front-end and flask back-end.

Start the container command:

docker run -d -p 80:80 yolov5trainsystem:latest

The browser accesses port 80.

4. System source code

Source code download link: https://download.csdn.net/download/weixin_47367099/85441361

Guess you like

Origin blog.csdn.net/weixin_47367099/article/details/124920115#comments_27174135