Change fully connected layer for YOLO v4 network , analogous to GoogLeNet
2 次查看(过去 30 天)
显示 更早的评论
I have a challenging task here. I would like to train a YOLOv4 - network, but with the following adjustment:
In my previous implementation of CNNs, a pre-trained network was loaded, and the last layer was changed out (fully connected layer was adjusted to the appropriate number of labels present / normal transfer-learning procedure).
Now, I would like to implement this also with the YOLO v4 - network. This was - as far as my information is correct - pre-trained on the COCO - data set.
Can I do the layer-exchange for the YOLO v4 network, analogous to the procedure with the GoogLeNet? And if so, how do I proceed here?
(I have oriented with first tests on the following example:
Would appreciate a helpful answer, thanks!
0 个评论
回答(1 个)
T.Nikhil kumar
2023-9-26
Hey Osman,
I understand that you want to change the last layer for the YOLOv4 network that is pretrained on COCO dataset.
I assume that your motive to do so is to enable your network to detect objects of a new set of classes.
You can use the “yolov4ObjectDetector” function which creates a pretrained YOLO v4 object detector and configure it to perform transfer learning using a set of object classes and anchor boxes.
detector = yolov4ObjectDetector(name,classes,anchorBoxes) ;
Here, “name” is the name of a pretrained YOLO v4 deep learning network.
You can use “estimateAnchorBoxes” function to estimate anchor boxes for your data.”anchorBoxes” is a cell array of [Mx1], where M denotes the number of detection heads.
This would eliminate the need to change the last layer of the network. Note that you must train this detector on new training images using the “trainYOLOv4ObjectDetector” function before performing detection.
There are other ways where you can create a new custom “dlnetwork” and add your custom layer to it and then use it as a base network for creating a “yolov4ObjectDetector”. You can refer to the following documentation to learn more about how to perform transfer learning on a pretrained YOLOv4 deep learning network/ untrained YOLOv4 deep learning network.
You can refer to the “Create a YOLO v4 Object Detector Network” section in the following documentation for more information on estimating and specifying anchor boxes.
I hope this helps!
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!