Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
Collapse
Brand Logo

ModalAI Forum

  1. ModalAI Support Forum
  2. Ask your questions right here!
  3. Can anyone recommend a Tflite Colab Notebook for VOXL2 Training

Can anyone recommend a Tflite Colab Notebook for VOXL2 Training

Scheduled Pinned Locked Moved Ask your questions right here!
53 Posts 4 Posters 21.2k Views 4 Watching
  • 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

    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 Offline
    S Offline
    sansoy
    Contributor
    wrote on last edited by
    #34

    @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
    0
    • S sansoy

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

      ? Offline
      ? Offline
      A Former User
      wrote on last edited by
      #35

      @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")]))&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
      0
      • ? A Former User

        @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")]))&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 Offline
        S Offline
        sansoy
        Contributor
        wrote on last edited by
        #36

        @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
        0
        • S sansoy

          @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

          ? Offline
          ? Offline
          A Former User
          wrote on last edited by
          #37

          @sansoy

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

          Thomas

          ? 1 Reply Last reply
          0
          • ? A Former User

            @sansoy

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

            Thomas

            ? Offline
            ? Offline
            A Former User
            wrote on last edited by
            #38

            @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
            0
            • ? A Former User

              @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 Offline
              S Offline
              sansoy
              Contributor
              wrote on last edited by
              #39

              @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
              0
              • S sansoy

                @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?

                ? Offline
                ? Offline
                A Former User
                wrote on last edited by
                #40

                @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
                0
                • ? A Former User

                  @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 Offline
                  S Offline
                  sansoy
                  Contributor
                  wrote on last edited by
                  #41

                  @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
                  0
                  • S sansoy

                    @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?

                    ? Offline
                    ? Offline
                    A Former User
                    wrote on last edited by
                    #42

                    @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
                    0
                    • ? A Former User

                      @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 Offline
                      Darshit DesaiD Offline
                      Darshit Desai
                      Regular
                      wrote on last edited by
                      #43

                      @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
                      0
                      • Darshit DesaiD Darshit Desai

                        @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

                        ? Offline
                        ? Offline
                        A Former User
                        wrote on last edited by
                        #44

                        @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
                        0
                        • ? A Former User

                          @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 Offline
                          Darshit DesaiD Offline
                          Darshit Desai
                          Regular
                          wrote on last edited by
                          #45

                          @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.

                          Link Preview Image
                          Implementing Object Tracking for Computer Vision (+ Code) | Datature Blog

                          The complete guide to compare the performance of multiple object tracking algorithms and build your object tracker project on Datature's platform.

                          favicon

                          (www.datature.io)

                          Link Preview Image
                          Understanding Multiple Object Tracking using DeepSORT

                          Get an overview of Tracking, the different types of object trackers, how tracking works, and what evaluation metrics are used to measure their performance.

                          favicon

                          LearnOpenCV – Learn OpenCV, PyTorch, Keras, Tensorflow with code, & tutorials (learnopencv.com)

                          Darshit DesaiD 1 Reply Last reply
                          0
                          • Darshit DesaiD Darshit Desai

                            @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.

                            Link Preview Image
                            Implementing Object Tracking for Computer Vision (+ Code) | Datature Blog

                            The complete guide to compare the performance of multiple object tracking algorithms and build your object tracker project on Datature's platform.

                            favicon

                            (www.datature.io)

                            Link Preview Image
                            Understanding Multiple Object Tracking using DeepSORT

                            Get an overview of Tracking, the different types of object trackers, how tracking works, and what evaluation metrics are used to measure their performance.

                            favicon

                            LearnOpenCV – Learn OpenCV, PyTorch, Keras, Tensorflow with code, & tutorials (learnopencv.com)

                            Darshit DesaiD Offline
                            Darshit DesaiD Offline
                            Darshit Desai
                            Regular
                            wrote on last edited by
                            #46

                            @thomas Edit about upgrading the sdk to nightly build: I tried it on my starling v2 drone, but somehow the nighly build is unable to write px4 parameters and the upgrade ends up failing (firmware issue link I reverted the sdk back to sdk 1.0 and the drone fortunately works again, but how would I avoid the number of classes bug which you highlighted above. I also have modified yolo to detect just one class.

                            ? 1 Reply Last reply
                            0
                            • Darshit DesaiD Darshit Desai

                              @thomas Edit about upgrading the sdk to nightly build: I tried it on my starling v2 drone, but somehow the nighly build is unable to write px4 parameters and the upgrade ends up failing (firmware issue link I reverted the sdk back to sdk 1.0 and the drone fortunately works again, but how would I avoid the number of classes bug which you highlighted above. I also have modified yolo to detect just one class.

                              ? Offline
                              ? Offline
                              A Former User
                              wrote on last edited by
                              #47

                              @Darshit-Desai

                              The goal of voxl-tflite-server is to provide an example of how ML models can be used in the VOXL ecosystem, not as an in-depth, well-tested framework. Your custom YOLO model might work, it might not. At lot of the logic in the server for math regarding the raw tensor data that the model produces has been written specifically for the models we put onboard. A good example of this is how the module postprocesses our YoloV5 network here; if your output tensor is the same format then you'll probably get good results out. If not, then you won't.

                              So I would follow the steps we took above to get a custom YOLO model working. If it doesn't work, you'll need to write your own C++ module that subscribes to an input camera pipe using libmodal-pipe, creates a TFLite::Interpreter that works with your model, and then parses the output tensor from your YOLO model. I'm happy to help you out with whatever you need here.

                              No idea what's going on with the PX4 params, that's outside of my domain. However if you're having problems with TFLite server regardless, it might just be best to code up your own approach as outlined above.

                              Keep me in the loop, happy to help you out however you need!

                              Thomas Patton

                              Darshit DesaiD 1 Reply Last reply
                              0
                              • ? A Former User

                                @Darshit-Desai

                                The goal of voxl-tflite-server is to provide an example of how ML models can be used in the VOXL ecosystem, not as an in-depth, well-tested framework. Your custom YOLO model might work, it might not. At lot of the logic in the server for math regarding the raw tensor data that the model produces has been written specifically for the models we put onboard. A good example of this is how the module postprocesses our YoloV5 network here; if your output tensor is the same format then you'll probably get good results out. If not, then you won't.

                                So I would follow the steps we took above to get a custom YOLO model working. If it doesn't work, you'll need to write your own C++ module that subscribes to an input camera pipe using libmodal-pipe, creates a TFLite::Interpreter that works with your model, and then parses the output tensor from your YOLO model. I'm happy to help you out with whatever you need here.

                                No idea what's going on with the PX4 params, that's outside of my domain. However if you're having problems with TFLite server regardless, it might just be best to code up your own approach as outlined above.

                                Keep me in the loop, happy to help you out however you need!

                                Thomas Patton

                                Darshit DesaiD Offline
                                Darshit DesaiD Offline
                                Darshit Desai
                                Regular
                                wrote on last edited by Darshit Desai
                                #48

                                @thomas I used my custom dataset to retrain yolo v5 model and I get similar performance on my desktop. About the sdk is it possible to get the changes you did to the tflite server in a build closer to sdk 1.1.2 for the starling v2. I was able to upgrade and fly the drone till that version of the sdk 1.1.2 that means that whatever nightly releases happened after that might have same px4 related bugs.

                                About the Multi object tracking, if I have to rewrite the same thing which deepsort or any other algorithm did that would entirely have to be in C++? Also if I want to run any ML/AI model without the tflite server, lets say in a python script (running on docker container onboard voxl2) it would not get any of the gpu hardware acceleration? I ask this questions because writing a sdk level software is much difficult. Instead if we had drivers like in our desktop pcs (CUDA like drivers) which when invoked in a python script could readily make the acceleration available. It would make ML deployment much easier.

                                ? 1 Reply Last reply
                                0
                                • ModeratorM Moderator referenced this topic on
                                • Darshit DesaiD Darshit Desai

                                  @thomas I used my custom dataset to retrain yolo v5 model and I get similar performance on my desktop. About the sdk is it possible to get the changes you did to the tflite server in a build closer to sdk 1.1.2 for the starling v2. I was able to upgrade and fly the drone till that version of the sdk 1.1.2 that means that whatever nightly releases happened after that might have same px4 related bugs.

                                  About the Multi object tracking, if I have to rewrite the same thing which deepsort or any other algorithm did that would entirely have to be in C++? Also if I want to run any ML/AI model without the tflite server, lets say in a python script (running on docker container onboard voxl2) it would not get any of the gpu hardware acceleration? I ask this questions because writing a sdk level software is much difficult. Instead if we had drivers like in our desktop pcs (CUDA like drivers) which when invoked in a python script could readily make the acceleration available. It would make ML deployment much easier.

                                  ? Offline
                                  ? Offline
                                  A Former User
                                  wrote on last edited by
                                  #49

                                  @Darshit-Desai

                                  Check your other post for details on getting the nightly builds.

                                  VOXL can run any language you install on it, Python or C++ or whatever else. However if you want to read camera data in in real-time, our supported solution is through libmodal-pipe which is written in C++. As for the hardware acceleration, it may be possible to use it in Python but we only have it documented for C++ via the nnapi_delegate class in TFLite which you can see here. There might be other methods for acceleration but this is all we've used and tested so far.

                                  That is to say that we don't currently have hardware accelerators built into a general purpose library like CUDA. I would love to write a library like that but we simply don't have the business demand for it right now.

                                  Hope this helps,

                                  Thomas Patton

                                  Darshit DesaiD 1 Reply Last reply
                                  0
                                  • ? A Former User

                                    @Darshit-Desai

                                    Check your other post for details on getting the nightly builds.

                                    VOXL can run any language you install on it, Python or C++ or whatever else. However if you want to read camera data in in real-time, our supported solution is through libmodal-pipe which is written in C++. As for the hardware acceleration, it may be possible to use it in Python but we only have it documented for C++ via the nnapi_delegate class in TFLite which you can see here. There might be other methods for acceleration but this is all we've used and tested so far.

                                    That is to say that we don't currently have hardware accelerators built into a general purpose library like CUDA. I would love to write a library like that but we simply don't have the business demand for it right now.

                                    Hope this helps,

                                    Thomas Patton

                                    Darshit DesaiD Offline
                                    Darshit DesaiD Offline
                                    Darshit Desai
                                    Regular
                                    wrote on last edited by
                                    #50

                                    @thomas what is the purpose of the quantization script mentioned in the voxl docs, Is it the same as model conversion given in yolov5 documentation
                                    https://docs.modalai.com/voxl-tflite-server/#using-your-own-models

                                    Can I use the model conversion script given over here?

                                    https://docs.ultralytics.com/yolov5/tutorials/model_export/

                                    ? 1 Reply Last reply
                                    0
                                    • Darshit DesaiD Darshit Desai

                                      @thomas what is the purpose of the quantization script mentioned in the voxl docs, Is it the same as model conversion given in yolov5 documentation
                                      https://docs.modalai.com/voxl-tflite-server/#using-your-own-models

                                      Can I use the model conversion script given over here?

                                      https://docs.ultralytics.com/yolov5/tutorials/model_export/

                                      ? Offline
                                      ? Offline
                                      A Former User
                                      wrote on last edited by
                                      #51

                                      @Darshit-Desai

                                      I think that the yolov5 one will work as I'm pretty sure that's what I used to make a custom one at some point. I think the most important part is that the quantization is FP16 so make sure you add that --half arg. Definitely try it out and let me know how it goes.

                                      Thomas

                                      Darshit DesaiD 1 Reply Last reply
                                      0
                                      • ? A Former User

                                        @Darshit-Desai

                                        I think that the yolov5 one will work as I'm pretty sure that's what I used to make a custom one at some point. I think the most important part is that the quantization is FP16 so make sure you add that --half arg. Definitely try it out and let me know how it goes.

                                        Thomas

                                        Darshit DesaiD Offline
                                        Darshit DesaiD Offline
                                        Darshit Desai
                                        Regular
                                        wrote on last edited by Darshit Desai
                                        #52

                                        @thomas Actually I did it without the --half argument and it works onboard the voxl, here's the result
                                        0350ddea-b659-4949-af36-5fbef65a270a-image.png

                                        Also I don't know why but when I checked in netron the input image size was give 3,640,640 while voxl shows that the image resolution is 1024x768. I also read somewhere in the tflite documentation that the image size if changed needs to be updated in inference helper. I didn't do that too

                                        ? 1 Reply Last reply
                                        0
                                        • Darshit DesaiD Darshit Desai

                                          @thomas Actually I did it without the --half argument and it works onboard the voxl, here's the result
                                          0350ddea-b659-4949-af36-5fbef65a270a-image.png

                                          Also I don't know why but when I checked in netron the input image size was give 3,640,640 while voxl shows that the image resolution is 1024x768. I also read somewhere in the tflite documentation that the image size if changed needs to be updated in inference helper. I didn't do that too

                                          ? Offline
                                          ? Offline
                                          A Former User
                                          wrote on last edited by
                                          #53

                                          @Darshit-Desai

                                          Yeah, for reference almost all of the voxl-tflite-server code and documentation was written by a former employee so I don't always have the source of ground truth for things. I think there may be some logic in there that deals with reshaping the output tensors but I'm not fully sure. Same thing with the --half argument, I think we advise it but if you can get your model to work without quantization that's awesome. Glad to see it's working!! The results look good 🙂

                                          Keep me posted on how I can help,

                                          Thomas Patton

                                          1 Reply Last reply
                                          0
                                          • ModeratorM Moderator referenced this topic on
                                          • Ajay BidyarthyA Ajay Bidyarthy referenced this topic on

                                          Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                                          Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                                          With your input, this post could be even better 💗

                                          Register Login
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          ModalAI
                                          Categories Recent Tags ModalAI.com Docs
                                          © 2026 ModalAI® · Accelerating autonomy for smaller, smarter, safer drones · Powered by NodeBB
                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • Users
                                          • Groups