Apparently, this still isn't possible in v12?

I'd like to add a new class to one of the standard object detection architectures. Consider the YOLO v2 detector from the Neural Net Repo.

NetModel["YOLO V2 Trained on MS-COCO Data"]

Which currently has 80 classes:

labels = {"person", "bicycle", "car", "motorcycle", "airplane", "bus",
    "train", "truck", "boat", "traffic light", "fire hydrant", 
   "stop sign", "parking meter", "bench", "bird", "cat", "dog", 
   "horse", "sheep", "cow", "elephant", "bear", "zebra", "giraffe", 
   "backpack", "umbrella", "handbag", "tie", "suitcase", "frisbee", 
   "skis", "snowboard", "sports ball", "kite", "baseball bat", 
   "baseball glove", "skateboard", "surfboard", "tennis racket", 
   "bottle", "wine glass", "cup", "fork", "knife", "spoon", "bowl", 
   "banana", "apple", "sandwich", "orange", "broccoli", "carrot", 
   "hot dog", "pizza", "donut", "cake", "chair", "couch", 
   "potted plant", "bed", "dining table", "toilet", "tv", "laptop", 
   "mouse", "remote", "keyboard", "cell phone", "microwave", "oven", 
   "toaster", "sink", "refrigerator", "book", "clock", "vase", 
   "scissors", "teddy bear", "hair drier", "toothbrush"};

As a minimal workable example, here is a toy set of training data for an additional class 'Fish', consisting of image and bounding-box coordinate pairs:

{fish, bboxes} = 
  CloudGet @ CloudObject[
HighlightImage[fish[[1]], Rectangle @@ bboxes[[1]]]

enter image description here

Unfortunately, I can't find any information on the training net:

enter image description here

If I have to, I can download the original training data:

enter image description here

I also looked on the community but couldn't find any guidance for NetTrain'ing bounding box detection networks.


  • $\begingroup$ I can change the to allow for any architecture, Yolo v2 is actually old anyway. $\endgroup$ – M.R. Mar 28 at 19:16
  • 1
    $\begingroup$ @C.E. And it is always possible that someone else on SE knows or a developer might be about to answer with a short tutorial. $\endgroup$ – M.R. Mar 28 at 19:25
  • 3
    $\begingroup$ I and a colleague have been working on implementing the training version of the Yolo 2 for a while (it's a complicated loss function) but haven't successfully got NetTrain to run, a divergence error arises. I have been in contact with WRI about the error but not solution yet. It was mentioned in passing by them that the weights were imported rather than training the net in MMA . If anyone is interested in comparing notes on building the training version of Yolo 2 I'd be open to sharing what we've done so far. $\endgroup$ – EstabanW Mar 28 at 23:15
  • 3
    $\begingroup$ @M.R. I'm going to wait for version 12 to be released (imminent I think) and test our training version of Yolo 2 on that. I would consider posting the code on Github if there's interest from others in it, interested? $\endgroup$ – EstabanW Apr 5 at 16:20
  • 1
    $\begingroup$ @EstabanW sure thanks I’ll take a look $\endgroup$ – M.R. Apr 5 at 16:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.