New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Deepstream 5.1 python ssd mobilenet x86 #11
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @undefined-references. it is a great feature.
I just left some comments :)
cd ssd_mobilenet_v2 && mkdir -p 1 | ||
cp /repo/deepstream-data/frozen_inference_graph.pb 1/model.graphdef | ||
|
||
label_file_path="/repo/deepstream/5.1/ssd_mobilenet_v2/labels.txt" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since Adaptive Learning API return a label_map.pbtxt
, I would get label_map.pbtxt
from user and parse and save it to required format.
for parsing this file you can use these modules:
https://github.com/neuralet/adaptive-object-detection/blob/main/utils/parse_label_map.py
https://github.com/neuralet/adaptive-object-detection/blob/main/protos/label_map_pb2.py
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
fi | ||
|
||
cd .. | ||
python3 deepstream_ssd_parser.py $videoPath $label_file_path |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be nice if you get an output_directory
argument and save the output video in this directory
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
fi | ||
|
||
videoPath="file://$videoPath" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please add another argument which takes the frozen_inference_graph.pb
path from user. if the user doesn't provide a file we can download default COCO model from TensorFlow.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added. Thanks
MIN_BOX_HEIGHT = 32 | ||
TOP_K = 20 | ||
IOU_THRESHOLD = 0.3 | ||
OUTPUT_VIDEO_NAME = "./out.mp4" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Based on provided output_directory
and the file name you can create an unique address for the output video path:
for example if the user provides /home/deepstream_output/
as the output directory and the input video file is softbio.mp4
the OUTPUT_VIDEO_NAME
will be /home/deepstream_output/softbio_neuralet_deepstream.mp4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
MIN_BOX_WIDTH, MIN_BOX_HEIGHT) | ||
nms_param = NmsParam(TOP_K, IOU_THRESHOLD) | ||
|
||
label_names = get_label_names_from_file("ssd_mobilenet_v2/labels.txt") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please don't use hard coded path. Put the input argument instead even if this is a constant address.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
modified, thanks.
# allocated string. Use pyds.get_string() to get the string content. | ||
id_dict = { | ||
val: index | ||
for index, val in enumerate(get_label_names_from_file("ssd_mobilenet_v2/labels.txt")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please don't use hard coded path. Put the input argument instead even if this is a constant address.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
Improvements:
Please don't merge until I push modifications to documents.