ModalAI Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    Can anyone recommend a Tflite Colab Notebook for VOXL2 Training

    Ask your questions right here!
    4
    53
    4966
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • ?
      A Former User @sansoy
      last edited by

      @sansoy

      Of these 4 models which is the custom trained YOLO model you mentioned above? I can't even get the edgetpu.tflite model to load so I need a little bit more information on how each of these files was generated.

      Thomas

      S 1 Reply Last reply Reply Quote 0
      • S
        sansoy @Guest
        last edited by

        @thomas here's a yolov5 trained model.
        https://drive.google.com/file/d/1wRbIXdylgx-EOGDLnuWnsytGd2DcTNeY/view?usp=drive_link

        I used this instruction set to train a yolov5 model which works well on my mac, rPI4, linux box and nvidia jetson.
        https://docs.ultralytics.com/yolov5/tutorials/train_custom_data/#23-organize-directories

        S 1 Reply Last reply Reply Quote 0
        • S
          sansoy @sansoy
          last edited by

          @thomas here's the colab notebook i used to create the tflites and quantized tflites
          https://colab.research.google.com/drive/1QdgpSl63OSQdLTnFwOyP8dxLQ7W0HtmW?usp=sharing

          ? 1 Reply Last reply Reply Quote 0
          • ?
            A Former User @sansoy
            last edited by

            @sansoy

            I found the bug in our code that's causing the issue. You can see on this line that a for YOLO models a former employee hardcoded the number of classes to be 80 leading to a segfault when we only have a single class like in your case. Here's what your model looks like on our server with the fix:

            7b4e7252-e3f7-4204-be81-abacde3b5c4b-image.png

            What I'm going to do is write a patch for voxl-tflite-server that more intelligently reads the number from the labels file. This will be available in our SDK Nightlies and so you'll be able to use the fix tomorrow morning. If you'd like the fix sooner, what I can do is package the new voxl-tflite-server into a .deb so you can deploy it manually to your VOXL. I can help you out with this process if you're not familiar.

            Thanks,
            Thomas Patton
            thomas.patton@modalai.com

            ? S 2 Replies Last reply Reply Quote 1
            • ?
              A Former User @Guest
              last edited by

              @thomas

              https://gitlab.com/voxl-public/voxl-sdk/services/voxl-tflite-server/-/merge_requests/22

              Here's the merge request with the fix, this will be published both in tonight's nightly and new SDK releases.

              Thomas

              S 1 Reply Last reply Reply Quote 1
              • S
                sansoy @Guest
                last edited by

                @thomas you rock! awesome! thanks for troubleshooting.

                1 Reply Last reply Reply Quote 0
                • S
                  sansoy @Guest
                  last edited by

                  @thomas thanks thomas. will download tomorrow and test either in evening or next day. Really appreciate your help with this.
                  Great job! Sabri

                  ? 1 Reply Last reply Reply Quote 0
                  • ?
                    A Former User @sansoy
                    last edited by

                    @sansoy

                    Yeah of course, glad I could be of assistance! Be sure to let me know if you need any more help with this.

                    Two things I was thinking about on my drive home that you should know - First, when you're on that page I linked above for the software nightlies make sure you sort the files by date descending so that you get the most recent one. I always make the mistake of getting the wrong one. Secondly, when you flash that nightly SDK it will overwrite anything not in the /data/ directory and so you will need to put your model file and labels txt back into /usr/bin/dnn/.

                    Thomas

                    S 1 Reply Last reply Reply Quote 0
                    • S
                      sansoy @Guest
                      last edited by

                      @thomas Morning Thomas, just getting back to this. I couldnt find any SDK that had a 2024 stamp. Was this uploaded somewhere else?
                      Sabri

                      ? 1 Reply Last reply Reply Quote 0
                      • ?
                        A Former User @sansoy
                        last edited by

                        @sansoy

                        Here's the one from last night:

                        https://console.cloud.google.com/storage/browser/_details/platform-nightlies/voxl2/voxl2_SDK_nightly_20240117.tar.gz?pageState=("StorageObjectListTable":("s":[("i":"objectListDisplayFields%2FtimeLastModified","s":"1"),("i":"displayName","s":"0")%5D))&organizationId=517175400245&project=modalai-core-services

                        You just have to make sure when you're on this page that you sort date modified by descending.

                        Thanks,
                        Thomas

                        S 1 Reply Last reply Reply Quote 0
                        • S
                          sansoy @Guest
                          last edited by

                          @thomas

                          installed voxl2_SDK_nightly_20240117.tar.gz
                          per https://docs.modalai.com/flash-system-image/

                          still not getting any detection even with your default yolov5. ive tried with hires large color, small color and grey.

                          tflite_1705597671.png

                          ? 1 Reply Last reply Reply Quote 0
                          • ?
                            A Former User @sansoy
                            last edited by

                            @sansoy

                            Checking this out right now, will let you know when I have something.

                            Thomas

                            ? 1 Reply Last reply Reply Quote 0
                            • ?
                              A Former User @Guest
                              last edited by

                              @thomas @sansoy

                              So I was able to get our YOLO model running immediately, am about to try yours next. All I did was:

                              1. Flash the nightly SDK from last night using the steps you linked above
                              2. Edited /etc/modalai/voxl-tflite-server.conf so that the model was /usr/bin/dnn/yolov5_float16_quant.tflite and the input pipe was /run/mpa/hires_small_color.

                              You should definitely try to reproduce this result as if you can't it might indicate a deeper problem.

                              Then to use your custom model:

                              1. adb shell and then cd /usr/bin/dnn and then cp yolov5_labels.txt yolov5_labels.txt.bak && cp yolov5_float16_quant.tflite yolov5_float16_quant.tflite.bak to back up the existing model and label files.
                              2. vi yolov5_labels.txt and change to only have ar15 as a class
                              3. From outside ADB, adb push yolo5_fp16_quant.tflite /usr/bin/dnn/yolov5_float16_quant.tflite
                              4. voxl-tflite-server

                              e2ee78d8-8d17-4863-ad90-8917442727b5-image.png

                              Thomas
                              thomas.patton@modalai.com

                              S 1 Reply Last reply Reply Quote 0
                              • S
                                sansoy @Guest
                                last edited by

                                @thomas WORKED! i did most of what you stated except for renaming my file to your filename. !tflite_1705605919.png

                                in a future release would be able to use the original filename vs renaming it to something that is hardcoded?

                                ? 1 Reply Last reply Reply Quote 0
                                • ?
                                  A Former User @sansoy
                                  last edited by

                                  @sansoy

                                  Glad you got it working!

                                  It's important to note that voxl-tflite-server isn't intended to be a high-grade tool for running any ML model with great configurations and optimizations; it's just an example of how you can use the VOXL ecosystem to run models. As much as I would enjoy building such a tool and implementing your request (and the others I get), there just isn't enough of a business demand for it right now.

                                  That being said, the code is open source and right here is the line that does the string comparison. If you want to put out a merge request to add a new field for model_type to the /etc/modalai/voxl-tflite-server.conf JSON and have it select an inference method based on that, you can tag me and I'll review it.

                                  Thanks,
                                  Thomas Patton
                                  thomas.patton@modalai.com

                                  S 1 Reply Last reply Reply Quote 0
                                  • S
                                    sansoy @Guest
                                    last edited by

                                    @thomas said in Can anyone recommend a Tflite Colab Notebook for VOXL2 Training:

                                    It's important to note that voxl-tflite-server isn't intended to be a high-grade tool for running any ML model with great configurations and optimizations; it's just an example of how you can use the VOXL ecosystem to run models. As much as I would enjoy building such a tool and implementing your request (and the others I get), there just isn't enough of a business demand for it right now.

                                    Thanks for the info. how can i get access to the box coordinates in the image?

                                    ? 1 Reply Last reply Reply Quote 0
                                    • ?
                                      A Former User @sansoy
                                      last edited by

                                      @sansoy

                                      Check out https://gitlab.com/voxl-public/voxl-sdk/services/voxl-tflite-server/-/blob/master/include/ai_detection.h?ref_type=heads , this defines the detection output. This is streamed out to a pipe in /run/mpa

                                      Thomas

                                      Darshit DesaiD 1 Reply Last reply Reply Quote 0
                                      • Darshit DesaiD
                                        Darshit Desai @Guest
                                        last edited by

                                        @thomas @sansoy Has anyone tried integrating a yolov8n model, I have a tflite fp16 quantized model but this line in the modal ai documentation says that any other model architecture apart from the ones mentioned here cannot be used,

                                        6991e349-2c7a-4562-9033-649a3f0a604f-Screenshot from 2024-01-27 21-34-41.png file:///home/swarm_researchers/Pictures/Screenshots/Screenshot%20from%202024-01-27%2021-34-41.png

                                        ? 1 Reply Last reply Reply Quote 0
                                        • ?
                                          A Former User @Darshit Desai
                                          last edited by

                                          @Darshit-Desai

                                          @sansoy has been able to get custom models working, but you'll have to follow the steps we took in the posts above. Let me know how I can best help!

                                          Thomas

                                          Darshit DesaiD 1 Reply Last reply Reply Quote 0
                                          • Darshit DesaiD
                                            Darshit Desai @Guest
                                            last edited by

                                            @thomas Also the model which @sansoy used was yolov5n, and I checked most of the code of inference helper it was related to yolov5, is the tflite server compatible to any yolo model?

                                            Actually in a separate post I asked about object tracking with yolo models, from the article I read here and referring to the individual tracker documentations, somehow I need to have access to the tflite model to run these trackers, is there a way to integrate the trackers into the voxl-tflite-server, as the documentation says it provides hardware acceleration.

                                            https://www.datature.io/blog/implementing-object-tracking-for-computer-vision

                                            https://learnopencv.com/understanding-multiple-object-tracking-using-deepsort/#DeepSORT-Implementation

                                            Darshit DesaiD 1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post
                                            Powered by NodeBB | Contributors