簡體   English   中英

Tensorflow 在 Object 檢測 session 運行中拋出“TypeError: unhashable type: 'list'”錯誤

[英]Tensorflow throws “TypeError: unhashable type: 'list'” error in Object detection session run

input_tensors=["import/image_tensor:0"],
output_tensors=['import/detection_boxes:0', 'import/detection_scores:0',
                        'import/detection_classes:0', 'import/num_detections:0']

_input = [graph.get_tensor_by_name(tensor_name) for tensor_name in input_tensors]
_output_ops = [graph.get_tensor_by_name(tensor_name) for tensor_name in output_tensors]
sess = tf.Session(graph=graph, config=_config_proto)

image_expanded = np array of size specific to model (1, 512, 512, 1)

(boxes, scores, classes, num_detections) = sess.run(self._output_ops, feed_dict={_input: image_expanded})

當我運行 sess.run 時出現錯誤

-------------------------------------------------- ------------------------- TypeError Traceback (最近一次調用最后一次) in 3 image_np = load_image_into_numpy_array(image) 4 image_np_expanded = np.expand_dims(image_np, axis=0) ----> 5 (boxes, scores, classes, num_detections) = sess.run(_output_ops, feed_dict={_input: image_np_expanded}) 6 print(boxes) 7 break

類型錯誤:不可散列類型:“列表”

在這種情況下,_input 是一個列表。 所以 sess.run 應該有 _input[0]

(boxes, scores, classes, num_detections) = sess.run(self._output_ops, feed_dict={_input[0]: image_expanded})

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM