Last active
October 20, 2020 21:48
-
-
Save savan77/74d82b6f533ba884763390bca94ac812 to your computer and use it in GitHub Desktop.
TF Inference Script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| scores = detection_graph.get_tensor_by_name('detection_scores:0') | |
| classes = detection_graph.get_tensor_by_name('detection_classes:0') | |
| num_detections = detection_graph.get_tensor_by_name('num_detections:0') | |
| (boxes, scores, classes, num_detections) = sess.run([boxes, scores, classes, num_detections], feed_dict={image_tensor: image_np_expanded}) | |
| result = [] | |
| for i in range(len(classes[0])): | |
| if scores[0][i] >= 0.5: | |
| xmin, ymin, xmax, ymax = _normalize_box(boxes[0][i], width, height) | |
| label = CLASSES[classes[0][i]] | |
| result.append({'label':label, 'xmin': xmin, 'ymin':ymin, 'xmax':xmax, 'ymax':ymax}) | |
| output['annotations'][imagePath] = result |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment