Configuration file, weight file, YOLOV5

1. Configuration file

The configuration file (also known as the model definition file or model structure file) contains the structural information of the model, such as the type, number, parameters, etc. of layers;

That is, the framework of YOLOV5

Insert image description here

 The picture comes from: yolov5-5.0 version (currently the latest) network structure diagram_yolov5 network structure_Zi Xing plus’s blog-CSDN blog

2. Weight file

The weight file (also known as the model parameter file or the model state file) contains the parameter information of the model, that is, the parameters such as weights and biases in each layer of the model.

3.YOLOV5 related

When using YOLOv5 for target detection, you need to combine the configuration file and the weight file , that is, first create the structure of the model based on the configuration file, and then load the parameters in the weight file into the model to obtain a complete detector. In this way, the detector can correctly identify objects in the input image and output information such as object category, location, and confidence.

In the latest YOLOV5 detect.py, the path to the configuration file is not explicitly specified. Instead, the configuration file is inferred based on the weight file. The specific code is as follows

#detect.py   
    ......
    # Load model
    device = select_device(device)
    model = DetectMultiBackend(weights, device=device, dnn=dnn, data=data, fp16=half)
    stride, names, pt = model.stride, model.names, model.pt
    imgsz = check_img_size(imgsz, s=stride)  # check image size
    ......

The DetectMultiBackend() function is this function.

If there are any mistakes, please point them out!

Guess you like

Origin blog.csdn.net/qq_62573253/article/details/129940751