Skip to content

Can't proccess input image in detector_inference_example.py #16

@shandytp

Description

@shandytp

hi, i can't do proccess my input image.
the error message is :

Traceback (most recent call last):
File "detector_inference_example.py", line 41, in
saver_all.restore(session, 'model/yolov3') #path to your downloaded big model
File "C:\Users\shand\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\training\saver.py", line 1322, in restore
err, "a mismatch between the current graph and the graph")
tensorflow.python.framework.errors_impl.InvalidArgumentError: Restoring from checkpoint failed. This is most likely due to a mismatch between the current graph and the graph from the checkpoint. Please ensure that you have not altered the graph expected based on the checkpoint. Original error:

2 root error(s) found.
(0) Invalid argument: Assign requires shapes of both tensors to match. lhs shape= [21] rhs shape= [255]
[[node save_1/Assign_288 (defined at detector_inference_example.py:38) ]]
(1) Invalid argument: Assign requires shapes of both tensors to match. lhs shape= [21] rhs shape= [255]
[[node save_1/Assign_288 (defined at detector_inference_example.py:38) ]]
[[save_1/RestoreV2/_410]]
0 successful operations.
0 derived errors ignored.

Errors may have originated from an input operation.

this is the piece of code where i'm gonna load my model
saver_all.restore(session, 'model/yolov3') #path to your downloaded big model

this is the code where the input image gonna be process

img_ = cv2.imread('images/car.jpeg')
img_ = cv2.resize(img_, (416, 416))
img = img_.reshape((1, 416, 416, 3)).astype(np.float32)
img = img/255.
detection_result = session.run(c.boxes_dicts, feed_dict={c.input_placeholder: img})
bboxes = c.nms(detection_result, 0.2, 0.1) #set the threshold to 0.2, you can modify it

FYI, the location of my model and my input image is in the same folder
in my opinion there's something wrong with the code when the image will be resize and reshape
thank you 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions