MhmdBarazi I've put them in the same folder, but it is still not working with the same error message. I know it would not be a solution, it was just a trial.
RuntimeError: Communication exception
- Edited
just an update. I built a yolov5 model, then I converted the file using the listed steps here: https://colab.research.google.com/github/luxonis/depthai-ml-training/blob/master/colab-notebooks/YoloV5_training.ipynb#scrollTo=g1eUou1F3O1z
I did every single step successfully, when I run the final code, I got this error:
for the conversion process I entered a train code on the google colab like this:
then, the converted file:
Any help please?
Hi MhmdBarazi
Looks like you incorrectly specified the blob path, that's why it's trying to pull one from artefacts. Change to code to fix this.
Thanks,
Jaka
- Edited
jakaskerl Hello
When the blob path is incorrect it gives an error like this:
FileNotFoundError: Required file/s not found, please run "/usr/bin/python3 install_requirements.py"
Furthermore, I defined the path in the same way as the original one is. Thank you
Hi MhmdBarazi
Hmm, might be an outdated version, could you check that please.
Link to a similar post: https://discuss.luxonis.com/d/1786-converting-yolo-to-blob/9
Thanks,
Jaka
jakaskerl Hello,
I changed the file name from best_openvino_2022.1_6shave.blob to best_openvino_2021.4_6shave.blob. Then I changed the whole line of opening path like this:
nnBlobPath = str((os.path.dirname(os.path.abspath("file")) / Path('/home/apakgrup/depthai-python/examples/spatial/best_openvino_2021.4_6shave.blob')).resolve().absolute())
Unfortunately, still not work. But the error has changed like this:
[194430105190FE1200] [1.1.2] [3.951] [SpatialDetectionNetwork(1)] [error] ROI x:0.66726685 y:0.8051758 width:0.034057617 height:0 is not a valid rectangle.
[194430105190FE1200] [1.1.2] [3.952] [SpatialDetectionNetwork(1)] [error] ROI x:0.716774 y:0.9003906 width:0.03199768 height:0 is not a valid rectangle.
[194430105190FE1200] [1.1.2] [4.149] [XLinkOut(6)] [error] Message has too much metadata (665313B) to serialize. Maximum is 51200B. Dropping message
[194430105190FE1200] [1.1.2] [4.472] [system] [critical] Fatal error. Please report to developers. Log: 'TlsfMemoryManager' '255'
Traceback (most recent call last):
File "<string>", line 103, in <module>
RuntimeError: Communication exception - possible device error/misconfiguration. Original message 'Couldn't read data from stream: 'detections' (X_LINK_ERROR)'
Any help ,please jakaskerl @erik
Thanks
- Edited
MhmdBarazi What you shared above (result(1).zip
) works for me.
python3 main.py --config barazi/barazi.json
(from depthai-experiments/gen2-yolo/device-decoding
), I just removed the Spatial=True
inside the create_nn, to improve the FPS.
erik thank you so much, But the problem is that I need spatial data(x,y,z) actually that is why I choose OAK device because I can locate the fire. Can I merge between fire detection and spatial data?
Yes, you can. I am using latest develop version of depthai-sdk, and have limited FPS to 8:
from depthai_sdk import OakCamera, ArgsParser
import argparse
def a(packet):
print(packet.detections)
# parse arguments
parser = argparse.ArgumentParser()
parser.add_argument("-conf", "--config", help="Trained YOLO json config path", default='model/yolo.json', type=str)
args = ArgsParser.parseArgs(parser)
with OakCamera(args=args) as oak:
stereo = oak.stereo(fps=8)
color = oak.create_camera('color', fps=8)
nn = oak.create_nn(args['config'], color, nn_type='yolo', spatial=stereo)
oak.visualize(nn, fps=True, scale=2/3)
oak.callback(nn.out.passthrough, a)
oak.start(blocking=True)
erik It worked, thank you so much, just last thing, you have used a different code, the code I have uploaded doesn't work at all it means. Does it? I want to get this spatial data to use it in another code. That is why am asking. thank you so much for helping me out.
MhmdBarazi I don't now, the code you used wasn't MRE and was badly formatted, so I haven't dug into it trying to debug it.
erik Thank you, can I get spatial detection data in a string format?
Hi MhmdBarazi ,
Yes, you can:
from depthai_sdk import OakCamera, ArgsParser
import argparse
import depthai as dai
def a(packet):
for det in packet.detections:
spatials = det.img_detection.spatialCoordinates
print(spatials.x, spatials.y, spatials.z)
# parse arguments
parser = argparse.ArgumentParser()
parser.add_argument("-conf", "--config", help="Trained YOLO json config path", default='model/yolo.json', type=str)
args = ArgsParser.parseArgs(parser)
with OakCamera(args=args) as oak:
stereo = oak.create_stereo(fps=8)
color = oak.create_camera('color', fps=8)
nn = oak.create_nn(args['config'], color, nn_type='yolo', spatial=stereo)
oak.visualize(nn, fps=True, scale=2/3)
oak.callback(nn.out.passthrough, a)
oak.start(blocking=True)
- Edited
erik thank you so much for helping me out.
Today, I have trained new model. then I used a new json file. but it didn't work. this error appeared:
y:1.2648584 width:0.057771206 height:-0.26485837 is not a valid rectangle.
[194430105190FE1200] [1.1.2] [31.289] [SpatialDetectionNetwork(8)] [error] ROI x:0.6353549 y:1.2649865 width:0.0572443 height:-0.26498652 is not a valid rectangle.
[194430105190FE1200] [1.1.2] [31.289] [SpatialDetectionNetwork(8)] [error] ROI x:0.030717716 y:1.1823903 width:0.023574337 height:-0.18239033 is not a valid rectangle.
And this is the json file:
thank you again
Hi MhmdBarazi
Did you test your model before converting it to .blob? The errors you are getting are due to height of ROI being negative. Looks like the model you have created had weird training or is incorrectly scaled (https://docs.luxonis.com/en/latest/pages/tutorials/deploying-custom-model/#deploying-custom-models). Could you recheck please?
Thanks,
Jaka
jakaskerl Thank you for your answer,
Yes, I tested my model before the conversion. Actually, I converted the model using this tool: DepthAI Tools (luxonis.com). Then these were all my inputs:
and I did the same steps as the previous one(which worked successfully)
erik Could you help me with it?
Update, I ran my blob and json files with the code "main_api" from this link:
depthai-experiments/gen2-yolo/device-decoding at master ยท luxonis/depthai-experiments (github.com)
It worked properly, but I want to see the spatial coordination like this:
I ran the same code but spatial coordination didn't appear
- Edited
erik This code was perfect and worked faster than the "main_api" code. But it couldn't read my new json file properly.
Hi MhmdBarazi
To view the spatial coordinates from the main api, you will have to use a spatial neural network instead of the regular one. The same is done in SDK with spatial=True
flag.
SDK likely doesn't work with your model because the parsing is different, that would mean you will need to manually write a callback function to parse the NN results.
Thanks,
Jaka