|
@@ -1,20 +1,46 @@
|
|
-# 注:新数据应先放入下面路径的total_data中(total_data需新建,在本地导入数据放入;项目名称根据具体项目新建)
|
|
|
|
|
|
+# Object Detection Model Training and Deployment
|
|
|
|
|
|
-code and data location
|
|
|
|
-url:192.168.20.250
|
|
|
|
-directory:/data/object_detection
|
|
|
|
|
|
+This project involves training object detection models using the YOLOv5 framework, exporting the trained model from `.pt` format to `.pb` format, and testing the performance of the model. The new data should be imported to the appropriate directory as described below.
|
|
|
|
|
|
-训练模型执行步骤
|
|
|
|
-1、./object_detection.sh /data2/object_detection/data/image/项目名称/
|
|
|
|
|
|
+## Project Steps
|
|
|
|
|
|
-2、训练结束,保存.pt格式:
|
|
|
|
|
|
+### 1. Data Preparation
|
|
|
|
+- Create a new folder `total_data` under the project directory and place the newly imported data there.
|
|
|
|
+- **Code and Data Location**:
|
|
|
|
+ - **Server URL**: `192.168.20.250`
|
|
|
|
+ - **Directory**: `/data/object_detection`
|
|
|
|
|
|
-3、.pt格式模型导出为.pb格式模型
|
|
|
|
-获取pt文件路径:cat export.sh
|
|
|
|
-进入yolov5文件夹 (/data/object_detection/code/yolov5/)后运行
|
|
|
|
-python export.py --weights ./runs/train/helmet_fall_phone/weights/best.pt --include pb #修改项目名称
|
|
|
|
|
|
+### 2. Model Training
|
|
|
|
+- Run the following script to train the model, where `<project_name>` is the name of the newly created project:
|
|
|
|
+ ```bash
|
|
|
|
+ ./object_detection.sh /data2/object_detection/data/image/<project_name>/
|
|
|
|
+ ```
|
|
|
|
|
|
-转换为.pb格式,并保存
|
|
|
|
|
|
+### 3. Save the Model
|
|
|
|
+- Once training is complete, the model will be saved in `.pt` format.
|
|
|
|
+
|
|
|
|
+### 4. Export Model to `.pb` Format
|
|
|
|
+- To export the `.pt` model to `.pb` format, first find the `.pt` file path by running:
|
|
|
|
+ ```bash
|
|
|
|
+ cat export.sh
|
|
|
|
+ ```
|
|
|
|
+- Navigate to the YOLOv5 directory:
|
|
|
|
+ ```bash
|
|
|
|
+ cd /data/object_detection/code/yolov5/
|
|
|
|
+ ```
|
|
|
|
+- Run the export script to convert the `.pt` model to `.pb` format:
|
|
|
|
+ ```bash
|
|
|
|
+ python export.py --weights ./runs/train/helmet_fall_phone/weights/best.pt --include pb
|
|
|
|
+ ```
|
|
|
|
+ - *Note*: Change `helmet_fall_phone` to the correct project name before running the script.
|
|
|
|
+
|
|
|
|
+### 5. Model Testing
|
|
|
|
+- To test the model, run the following command:
|
|
|
|
+ ```bash
|
|
|
|
+ python detect.py --weights runs/train/safebelt_data/weights/best.pt --source /data2/object_detection/code/yolov5/safebelt_test --data /data2/object_detection/data/image/safebelt_data/yolo/safebelt_data.yaml --device 0
|
|
|
|
+ ```
|
|
|
|
+ - *Note*: Adjust the `--weights`, `--source`, and `--data` parameters to the correct project paths.
|
|
|
|
+
|
|
|
|
+## Contact
|
|
|
|
+For any inquiries or issues, please contact the development team.
|
|
|
|
|
|
-4、测试:
|
|
|
|
-python detect.py --weights runs/train/safebelt_data/weights/best.pt --source /data2/object_detection/code/yolov5/safebelt_test --data /data2/object_detection/data/image/safebelt_data/yolo/safebelt_data.yaml --device 0
|
|
|