Using custom weights and cfg file, is there a clear documentation in Matlab to use them for yolov3 object detection?

11 visualizaciones (últimos 30 días)
The code below is working if we are using the pretrained model but not your own weights and cfg files.
% Load YOLOv3 model
yolov3 = yolov3ObjectDetector('darknet53-coco');
  2 comentarios
Cris LaPierre
Cris LaPierre el 19 de En. de 2024
It is my understanding that, if you want to use custom weights, you will need to retrain the model. Can you say more about what you want to do? What type of data is in your cfg file?
Hanes Ongos
Hanes Ongos el 21 de En. de 2024
Hi Cris, I have the images to be used. I also have done the annotations. I have done the training in google Colab and have generated the weights, the cfg and the .names files. I only want to detect person so I have modified my cf and .names files. Is there a way to use these files in Matlab for human detection? It seems I can't find any clear documentation on this. Thanks!

Iniciar sesión para comentar.

Respuestas (1)

Aastha
Aastha el 25 de Nov. de 2024 a las 5:11
I understand that you want to use your custom weights and configuration files in a YOLOv3 model in MATLAB.
To get started, you first need to load the YOLOv3 model with the correct architecture. You may refer to the MATLAB code given below to do this:
% Load YOLOv3 model
name = 'darknet53-coco';
detector = yolov3ObjectDetector(name);
disp(detector);
The output of the above code will show properties of the “detector”:
yolov3ObjectDetector with properties:
Network: [1x1 dlnetwork]
AnchorBoxes: {2x1 cell}
ClassNames: [80x1 categorical]
InputSize: [416 416 3]
PredictedBoxType: 'axis-aligned'
ModelName: 'tiny-yolov3-coco'
In the above code snippet, the detector has a “Network” property of type “dlnetwork”. You can access this using the dot operator as illustrated in the MATLAB code snippet below:
Net = detector.Network;
To visualize the architecture, use the “plot” function as shown in the MATLAB code below:
plot(Net);
The “Net” variable contains a “layers” property, which holds all the weights and biases. You may refer to the code snippet below to access it:
Layers = Net.Layers;
You can then iterate through the layers to set the weights and biases based on the custom weights obtained from Google Colab training.
To modify the number of output classes, you can specify the arguments when creating the YOLOv3 detector object:
detector = yolov3ObjectDetector(name, classes, aboxes);
This command creates a pretrained YOLOv3 object detector and configures it using the specified set of object classes and anchor boxes.
For more information about the YOLOv3 model, you may refer to the following link of MathWorks documentation on YOLOv3 Object Detector:
I hope this helps!

Categorías

Más información sobre Image Data Workflows en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by