Open di-jabil opened 5 years ago
Hi All,
Sorry for the vague question and little information provided yesterday. I just did more investigations and would like to provide more information.
_ANCHORS = utils.load_ssd_anchors('mobilenet_ssd_256res_0.125_person_cat_dog_anchors.txt') _NUM_ANCHORS = len(_ANCHORS) _NUM_LABELS = 2 #added
class Object: """Object detection result.""" BACKGROUND = 0 TARGET = 1
_LABELS = {
BACKGROUND: 'BACKGROUND',
TARGET: 'TARGET',
print(_NUM_ANCHORS, len(logit_scores), len(box_encodings) ) #added
assert len(logit_scores) == _NUM_LABELS * _NUM_ANCHORS
logits = logit_scores[_NUM_LABELS i: _NUM_LABELS (i + 1)]
File "/opt/aiy/projects-python/src/aiy/vision/models/object_detection.py", line 90, in _decode_detection_result assert len(logit_scores) == _NUM_LABELS * _NUM_ANCHORS #di added AssertionError
The printed values are: _NUM_ANCHORS = 1278, len(logit_scores) = 5112, len(logit_scores) = 2556
I decided to try another binaryproto. So I downloaded the binaryproto from the pikachu detector (https://github.com/giacomobartoli/vision-kit/tree/master/pikachu-detector) and loaded it up.
With the pikachu detector binaryproto, the assertion error goes away and the printed values are _NUM_ANCHORS = 1278, len(logit_scores) = 2556, len(logit_scores) = 5112
./bonnet_model_compiler.par \ --frozen_graph_path=my_detector.pb \ --output_graph_path=my_detector.binaryproto \ --input_tensor_name="Preprocessor/sub" \ --output_tensor_names="concat,concat_1" \ --input_tensor_size=256 \ --debug
So could you please help advise what could have gone wrong? I would much appreciate any comments. Thank you so much
My frozen graph is attached here target_detector.zip
Hi All,
I have retrained an embedded mobilenet v1 SSD following the AIY tutorial for training an object detection model (https://aiyprojects.withgoogle.com/vision/#makers-guide--tensorflow-model-compiler). The retrained model aims to detect one single object class.
The training went well. I was able to compile the model, load the binaryproto to the AIY kit, and test it with any_model_camera.py.
Then I decided to try this model with the object detection demo. I modified AIY-projects-python/src/aiy/vision/models/object_detection.py by changing _COMPUTE_GRAPH_NAME to my own binaryproto.
Then running the object detection demo ~/AIY-projects-python/src/examples/vision/object_detection.py --input input.jpg
main()
File "/home/pi/AIY-projects-python/src/examples/vision/object_detection.py", line 59, in main
objects = object_detection.get_objects(result, args.threshold, offset)
File "/opt/aiy/projects-python/src/aiy/vision/models/object_detection.py", line 269, in get_objects
objs = _decode_detection_result(logit_scores, box_encodings, threshold, size, offset)
File "/opt/aiy/projects-python/src/aiy/vision/models/object_detection.py", line 88, in _decode_detection_result
assert len(box_encodings) == 4 * _NUM_ANCHORS
AssertionError
got me the follow error: Traceback (most recent call last): File "/home/pi/AIY-projects-python/src/examples/vision/object_detection.py", line 73, in
Is there something wrong with my model? I would much appreciate your advice and comments. Please let me know if you need any further information. Thank you so much
The AIY image is AIY Kits Release 2018-11-16