• DepthAI
  • Easy?? Object Detector Training

Russ76

I feel your pain Russ.
I've gone through plenty of enormous Juypter notebooks- only for some cryptic & unsolvable error right at the end

I'd recommend YOLOv5 for a relatively easy object detection https://github.com/ultralytics/yolov5
It is well documented and works well- I suggest using the Docker option

Ultralytics HUB https://ultralytics.com/hub is by the same people- although not the same as Roboflow, it makes training an OD model easy, and will export to a number of formats, including TFLite
You can train your model with a very simple COLAB notebook, or with a local agent

Andrew

Tensorflow Lite is not too bad to train a model, the script for that is only a half page. Too bad it's hard to convert the Tflite model into the Myriad blob! I'm using sections of 640 x 300 for detection, and three of those makes the full width of RGB camera, 1920. But this technique won't work in the Oak-D camera, to take the image apart in the Raspberry Pi and send it back to the camera for examination! Too slow!

    erik Roboflow does make it pretty easy, they have a great system. But to purchase it is beyond my budget at this point. I did take advantage of their image augmentation and exporting models. That doesn't require training credits.

    Is there a reason to use the full width and split image into patches @Russ76 ? Are you dealing with extremely small objects? Otherwise you could just resize the images to something smaller (512 x 288, which preserves 16:9 aspect ratio) and do inference on this input shape, which should work on OAK.

    As for training, if YoloV5 training notebook is too complex, I think it might be best to use something like https://ultralytics.com/hub as @barney2074 pointed out. You can then download the weights and use tools.luxonis.com to obtain a blob. In tutorial we link to: https://github.com/ultralytics/yolov5/wiki/Train-Custom-Data#train-on-custom-data, which best explains how to prepare your dataset (see manually prepare your dataset) and also how it should be organized. This folder should be put in the corresponding path in Colab.

      Russ76

      Ultralytics HUB is currently in beta and is free

      Unlike Roboflow- you don't train on their server-, but use either local hardware or in Colab
      I've got a spare PI somewhere- I might try the TFlite export as a comparison

      Andrew

      Matija Yes, I need the full width since the camera is mounted 18 inches above the lawn, and from there can capture the 20 inches of width of the robot. The AI is searching for weeds in the lawn. The height of desired image is narrow because the spray wand timing, to hit the weed, will need to be similar for each detection. The wand swings from side to side only, no fore and aft movement. Thanks for asking

      erik I got a start trying to do this. Had to download and install several packages and change my path statements and bashrc file. There is a lot going on with this system! Still it ended with an error, a file not found.

      • erik replied to this.

        Hi Russ76 ,
        I agree, it's hard to setup and still quite tricky to get it right. Unfortunately these AI tools are all like this - that's why we created blobconverter for openvino conversion and blob compile (as those are tasks are complex as well, see here). We might add the tflite2tensorflow tool to our blobconverter in the future, especially if we will "officially support" a particular model (like we currently support yolov5).
        Thanks, Erik

        2 months later

        Did you change the Blobconverter? I used it on a Yolo5 model, but I don't see that option now!?

        • erik replied to this.
          6 days later

          That's right. I was looking for tools.luxonis.com and the not the blob converter page. I don't know that there are enough references or links to the former. Is that in your documentation? Trying to use onnx or openvino for conversion is difficult. Thanks

          • erik replied to this.

            Hi Russ76 ,
            In the training notebooks it's mentioned step-by-step what to do in order to get going. Have you followed that tutorial?
            Thanks, Erik

            The notebook page has so many steps that I found I didn't need! tools.luxonis.com will take the weights file (best.pt) from Yolov5 and convert that into the needed blob. Why work with Onnx and Openvino installations when it's not necessary? Or am I missing something here?

            • erik replied to this.

              Hi Russ76, I believe you don't need to work with onnx/openvino, and it's mentioned that you can just use tools.luxonis.com instead:

              Thanks, Erik