Skip to content

General Questions

2.2k Topics 11.3k Posts

Not sure where your question goes? Ask here. ModalAI engineers and the community answer questions about any VOXL product.

  • tflite-server with custom model?

    Unsolved
    3
    0 Votes
    3 Posts
    952 Views
    D
    Hello all, I was able to successfully train a MobileNet v2 (object detection mode), quantize it, and convert it into .tflite format. Basically, my custom model had to meet 3 criteria: The model is not too large (models should probably be below 17 KB) The model's input shape is [1 300 300 3] and the input data type is uint8 or numpy.uint8 The model's has four outputs in THIS ORDER: output one shape: [1 10 4] output two shape: [1 10] output three shape: [1 10] output four shape: [1] all of these outputs in float32 or numpy.float32 format From what I can best understand, the model architecture doesn't have to be an exact match, so long as the inputs and outputs are compatible. Here is my code: import tensorflow as tf from tensorflow.keras import layers, models Load the MobileNetV2 feature vector model directly from TensorFlow base_model = tf.keras.applications.MobileNetV2( input_shape=(300, 300, 3), # Use 300x300 input shape as required include_top=False, weights='imagenet') Freezing the base model base_model.trainable = False Adjust input shape to 300x300x3 and use uint8 data type inputs = tf.keras.Input(shape=(300, 300, 3), dtype='uint8') Use Lambda layer to cast inputs to float32 x = layers.Lambda(lambda image: tf.cast(image, tf.float32))(inputs) Pass the cast inputs through the base model x = base_model(x) x = layers.GlobalAveragePooling2D()(x) x = layers.Dense(1280, activation='relu')(x) Bounding box output (10 detections, 4 coordinates each) bbox_outputs = layers.Dense(40, activation='sigmoid')(x) bbox_outputs = layers.Lambda(lambda t: tf.reshape(t, [1, 10, 4]), name="bbox_outputs")(bbox_outputs) Class ID output (10 detections) class_outputs = layers.Dense(10, activation='softmax')(x) class_outputs = layers.Lambda(lambda t: tf.reshape(t, [1, 10]), name="class_outputs")(class_outputs) Confidence score output (10 detections) confidence_outputs = layers.Dense(10, activation='sigmoid')(x) confidence_outputs = layers.Lambda(lambda t: tf.reshape(t, [1, 10]), name="confidence_outputs")(confidence_outputs) Number of detections (single value) num_detections = layers.Lambda(lambda t: tf.constant([10], dtype=tf.float32))(x) num_detections = layers.Lambda(lambda t: tf.reshape(t, [1]), name="num_detections")(num_detections) Define the outputs explicitly in the order you want: 1. Bounding boxes 2. Class IDs 3. Confidence scores 4. Number of detections model = tf.keras.Model(inputs, [bbox_outputs, class_outputs, confidence_outputs, num_detections]) Compile the model model.compile(optimizer='adam', loss='mean_squared_error') Define a ConcreteFunction for the model with explicit output signatures @tf.function(input_signature=[tf.TensorSpec([1, 300, 300, 3], tf.uint8)]) def model_signature(input_tensor): outputs = model(input_tensor) return { 'bbox_outputs': outputs[0], 'class_outputs': outputs[1], 'confidence_outputs': outputs[2], 'num_detections': outputs[3] } Convert the model to TensorFlow Lite using signatures converter = tf.lite.TFLiteConverter.from_concrete_functions([model_signature.get_concrete_function()]) Apply float16 quantization converter.optimizations = [tf.lite.Optimize.DEFAULT] converter.target_spec.supported_types = [tf.float16] # Use float16 quantization Convert the model tflite_model = converter.convert() Save the TensorFlow Lite model with open('/content/mobilenet_v2_custom_quantized.tflite', 'wb') as f: f.write(tflite_model) Load the TFLite model and check the input/output details to confirm correct mapping interpreter = tf.lite.Interpreter(model_content=tflite_model) interpreter.allocate_tensors() Get the input and output details to verify correct input/output structure input_details = interpreter.get_input_details() output_details = interpreter.get_output_details() print("Input Details:", input_details) print("Output Details:", output_details)
  • Replace the voxl-tflite-server Yolov5 model

    Unsolved
    1
    0 Votes
    1 Posts
    229 Views
    No one has replied
  • Core Metrics

    Unsolved
    2
    0 Votes
    2 Posts
    407 Views
    ModeratorM
    @Ezekiel-Kaplan have you looked here: https://docs.modalai.com/voxl-inspect-cpu/ ?
  • VOXL camera server hires large & small frames in HAL3 PerCameraMgr

    Unsolved
    2
    0 Votes
    2 Posts
    489 Views
    ModeratorM
    All output pipes that begin with "hires" should have the same timestamp for each frame as they all come from the same image frame. the small and large pipes are simply different resolutions being encoded for different use cases from the same source camera frame
  • Low number of GPS satellites

    Unsolved
    8
    0 Votes
    8 Posts
    1k Views
    groupoG
    @Vinny I had to QDL the drone again. I am not sure why this is happening. The first time was extremely obvious but these last two I am not sure what has went wrong. I will be extremely explicit about 'poweroff -f' going forward. Anyway I wiped and flashed it again. I am getting 13 satellites on one now and 20 on the other. This is obviously an improvement. A theory I had is maybe they are looking at different constellations? that would not make sense as I just wiped the 'bad' drone and do not recall ever seeing an option to change the constellation, let alone changing it. I asked earlier.... if I cannot resolve this can we either order a new antenna or send the drone back to have the antenna swapped? I am worried our pilots will not fly if the GPS is sub-optimal
  • Learning how to lock a thread to a CPU core

    cpu resource-aware threads
    1
    0 Votes
    1 Posts
    1k Views
    No one has replied
  • voxl-open-vins-server How to Use, Overall Questions, ROS/ROS2 Findings

    11
    1 Votes
    11 Posts
    4k Views
    C
    @zauberflote1 said in voxl-open-vins-server How to Use, Overall Questions, ROS/ROS2 Findings: decision reduced the sampling jitter b Thank you for sharing your insights and great work!
  • Starling 2 and Starling 2 Max

    Unsolved
    2
    0 Votes
    2 Posts
    339 Views
    tomT
    @Harith-Dzikri I would definitely recommend Starling 2 for this application. You can see our opencv implementation here: https://gitlab.com/voxl-public/voxl-sdk/third-party/voxl-opencv
  • VOXL2 Wifi+Doodle

    Unsolved
    5
    0 Votes
    5 Posts
    840 Views
    VinnyV
    Hi @ctitus OK great! I am glad you picked that detail up! M0062 was a rather early design that we almost stopped making, so we never documented it nicely. But, there is so much demand for an RJ-45 that we decided to make a few more
  • TOF sensor quailty down after upgrading to VOXL 1.3

    Unsolved
    2
    2
    1 Votes
    2 Posts
    518 Views
    Alex KushleyevA
    @Shivam-Sehgal , I believe the TOF processing settings may have changed between SDK 1.1 and 1.3 (more noise filtering was added). In both cases, the ground is visible (although hard to see in the black image). In the 1.3.0 case, the other vehicle is not visible in TOF output, but there is less noise. Are you able to test the two SDK versions with some easy features for TOF sensor to pick up? Some large objects with simple geometry and some small objects. Alex
  • Sales Contact

    Unsolved
    1
    0 Votes
    1 Posts
    284 Views
    No one has replied
  • Starling 2 Image Sensor Front-end Adapter M0173 support on VOXL2 mini

    Unsolved
    2
    0 Votes
    2 Posts
    401 Views
    modaltbM
    Hi @waqaskhan2000 , The M0173 was brought into our lineup to support our Starling2 product lines. We haven't released a reference drone (yet) using VOXL2 mini so the internal requirement to create one hasn't come up. We will likely create something similar but we don't have a timeline right now for that....
  • VOXL 2 Developer Test Board For Purchase?

    Unsolved
    2
    0 Votes
    2 Posts
    403 Views
    modaltbM
    Hi @Janelletran , Because this board exposes pins directly from the 865 SIP, we make it kind of hard to find so folks know it will be easier to damage the VOXL2 product with this add on if you're not careful. This board: https://docs.modalai.com/voxl2-dev-test-board/ Has a hidden purchase link here: https://www.modalai.com/pages/beta-voxl-2-b2b-breakout-board Happy hacking!
  • Qualcomm Flight RB5 stuck in fastboot

    Unsolved
    10
    0 Votes
    10 Posts
    2k Views
    tomT
    @royb If you have another SOM sitting around it wouldn't hurt to try
  • Installing PX4?

    Unsolved
    3
    3
    0 Votes
    3 Posts
    546 Views
    Kiazoa JoaoK
    @tom thank you for clarifying that.
  • VOXL2 5G + Doodle Labs?

    Unsolved
    3
    0 Votes
    3 Posts
    601 Views
    P
    @guyzoler Don't set a default gateway on the interface with a static IP.
  • Propellers spin and then stop

    Unsolved
    6
    0 Votes
    6 Posts
    974 Views
    Kiazoa JoaoK
    @Alex-Kushleyev sounds good
  • Starling Drone not showing up in ADB devices

    Unsolved starling2 usb voxl linux help
    23
    0 Votes
    23 Posts
    7k Views
    tomT
    @ijones2 This is great news! It looks like everything is functioning as expected so no need to go through the unbricking process at this point. It does appear that there is a fairly old SDK loaded on there so I would recommend flashing the latest SDK (1.3.3) from downloads.modalai.com under "VOXL 2 Platform Releases" Just follow the instructions here to do so: https://docs.modalai.com/flash-system-image/#flashing-a-voxl-sdk-release
  • ROS2 StarlingV2 image streaming

    Unsolved
    3
    1 Votes
    3 Posts
    677 Views
    ModeratorM
    @gitcoder You really shouldn't use ROS for this, especially when network bandwidth is limited. ROS and ROS 2 add significant network bandwidth both local to the device and over the network. If you really need it over ROS 2, you should use a compressimage sensor message. Here's some code we found through a search https://answers.ros.org/question/385599/how-to-publish-a-compressedimage-in-ros2-foxy/
  • HW Accelerated VP8/VP9 encoding on VOXL2

    Unsolved
    3
    0 Votes
    3 Posts
    480 Views
    M
    Thank you for your help and hints Alex. We will definitely try to use voxl-streamer and modify it for VP8. Thank again, Milan