Hi,
Trying to run the MobilenetSSD models for inference. I was able to successfully convert the caffe mobilenetSSD model to DLC.
But when I use "spne-net-run", it outputs an empty detection_out.raw file.
Model Conversion:
snpe-caffe-to-dlc --input_network caffe/deploy.prototxt -b caffe/model.caffemodel -o dlc/model.dlclibdc1394 error: Failed to initialize libdc13942019-12-16 22:03:13,549 - 169 - INFO - INFO_DLC_SAVE_LOCATION: Saving model at dlc/model.dlc/root/snpe/lib/python/snpe/converters/common/converter_ir/ir_to_dlc.py:323: RuntimeWarning: info_code=1000; message=Layer is not supported. Layer detection_out of type SsdDetectionOutput not supported by GPU runtime; component=Model Validation; line_no=345; thread_id=140634264520512node.op.confidence_threshold2019-12-16 22:03:14,862 - 169 - INFO - INFO_CONVERSION_SUCCESS: Conversion completed successfully
Inference:
snpe-net-run --container dlc/model.dlc --input_list data/cropped/raw_list.txt --runtime_order cpu_float32 --enable_cpu_fallback-------------------------------------------------------------------------------Model String: N/ASNPE v1.33.1.608-------------------------------------------------------------------------------Processing DNN input(s):/root/snpe/models/mobilenet_ssd/data/cropped/img1.rawProcessing DNN input(s):/root/snpe/models/mobilenet_ssd/data/cropped/img2.raw
Any idea what I might be doing wrong?
Hi zainmsud,
I had been converted the SSD model to DLC successfully in the link below
https://github.com/zeusees/Mobilenet-SSD-License-Plate-Detection
Hi dangvhb,
Did you get the output for this? Is it possible to show the mobilnet-ssd's Result? I too am stuck at this point. Is it possible to get bounding boxes?
Hi zainmsud,
Is it possible to get bounding boxes from Mobilenet-ssd on snpe? i got some .raw files as output.
Hi piyalgeorge,
Kindly read the date from the raw file generated with the following python code and find the explanation below on how to parse the output.
Explanation:
res[0, 1] will be ID for the label, as it was trained on VOC Label 6 which belongs to the bus.
res[0, 2] represents the probability of the predicted object, it is 0.9992 here
res[0, 3:7] are the scaled X1, Y1 & X2, Y2 Values respectively.
For re-scaling it Multiply X1 & X2 with Width of image & Y1 & Y2 with the Height of the image and cast it to the Integer.
This gives the bounding box for the object predicted.
Command to convert the caffe model to dlc:
$ snpe-caffe-to-dlc --input_network MobileNetSSD_deploy.prototxt --caffe_bin MobileNetSSD_deploy.caffemodel --output_path caffe_mobilenet_ssd.dlc
Hi zainmsud,
Kindly download the model file from this link and use the following for converting to DLC file.
Observing the error you posted, it seems to be an issue with the image to raw conversion, find the instructions set to convert am image to raw type
$ snpe-caffe-to-dlc --input_network MobileNetSSD_deploy.prototxt --caffe_bin MobileNetSSD_deploy.caffemodel --output_path caffe_mobilenet_ssd.dlc
Image to raw conversion using python
$ python
>> img_name = "test.jpg"
>> img = cv2.imread(img_name, 1)
>> img = cv2.resize(img, (X_SIZE, Y_SIZE))
>> img = np.array(img, dtype="float32")
>> img = np.reshape(img,(1,X_SIZE,Y_SIZE,3))
>> ofile = (img_name.split(".")[0])+".raw"
>> fp = open(ofile, 'wb')
>> img.tofile(fp)