10
$\begingroup$

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[
   "https://www.wolframcloud.com/objects/9c57ab39-52e2-40d3-84e6-80c9ee9a42a4"];
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.

References:

$\endgroup$
14
  • 1
    $\begingroup$ I can change the to allow for any architecture, Yolo v2 is actually old anyway. $\endgroup$
    – M.R.
    Commented Mar 28, 2019 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.
    Commented Mar 28, 2019 at 19:25
  • 2
    $\begingroup$ I agree, this is another case where it's frustrating there is no example in the documentation! I believe this network was trained elsewhere and then imported to WL, but I have no evidence to back it up. $\endgroup$
    – Carl Lange
    Commented Mar 28, 2019 at 22:03
  • 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
    Commented Mar 28, 2019 at 23:15
  • 4
    $\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
    Commented Apr 5, 2019 at 16:20

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.