readme.md 1.9 KB

Object Detection Model Training and Deployment

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.

Project Steps

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

2. Model Training

  • Run the following script to train the model, where <project_name> is the name of the newly created project:

    ./object_detection.sh /data2/object_detection/data/image/<project_name>/
    

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:

    cat export.sh
    
  • Navigate to the YOLOv5 directory:

    cd /data/object_detection/code/yolov5/
    
  • Run the export script to convert the .pt model to .pb format:

    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:

    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.