윤영준 윤영준 05-21
fixing a critical bug
@274c631087c330f8013b9fd7f611db6c0f297487
yoloseg/inference_.py
--- yoloseg/inference_.py
+++ yoloseg/inference_.py
@@ -207,7 +207,7 @@
 
     # Path to your ONNX model and classes text file
     model_path = 'yoloseg/weight/best.onnx'
-    classes_txt_file = 'yoloseg/config_files/yolo_config.txt'
+    classes_txt_file = 'config_files/yolo_config.txt'
     image_path = 'yoloseg/img3.jpg'
 
     model_input_shape = (640, 640)
@@ -254,50 +254,51 @@
         cv2.waitKey(0)
         cv2.destroyAllWindows()
 
-def test2():
-    import time
-    import glob
-
-    # Path to your ONNX model and classes text file
-    model_path = 'yoloseg/weight/best.onnx'
-    classes_txt_file = 'yoloseg/config_files/yolo_config.txt'
-
-    model_input_shape = (640, 640)
-    inference_engine = Inference(
-        onnx_model_path=model_path,
-        model_input_shape=model_input_shape,
-        classes_txt_file=classes_txt_file,
-        run_with_cuda=True
-    )
-
-    image_dir = glob.glob("/home/juni/사진/sample_data/ex1/*.png")
-
-    for iteration, image_path in enumerate(image_dir):
-        img = cv2.imread(image_path)
-        if img is None:
-            print("Error loading image_binary")
-            return
-        img = cv2.resize(img, model_input_shape)
-        # Run inference
-        t1 = time.time()
-        detections, mask_maps = inference_engine.run_inference(img)
-        t2 = time.time()
-
-        print(t2-t1)
-
-        # Display results
-        # for detection in detections:
-        #     x, y, w, h = detection['box']
-        #     class_name = detection['class_name']
-        #     confidence = detection['confidence']
-        #     cv2.rectangle(img, (x, y), (x+w, y+h), detection['color'], 2)
-        #     label = f"{class_name}: {confidence:.2f}"
-        #     cv2.putText(img, label, (x, y - 10), cv2.FONT_HERSHEY_SIMPLEX, 0.5, detection['color'], 2)
-        #
-        # if len(mask_maps) > 0 :
-        #     seg_image = overlay_mask(img, mask_maps[0], color=(0, 255, 0), alpha=0.3)
-        #     cv2.imwrite(f"result/{iteration}.png", seg_image)
+# def test2():
+#     import time
+#     import glob
+#
+#     # Path to your ONNX model and classes text file
+#     model_path = 'yoloseg/weight/best.onnx'
+#     classes_txt_file = 'config_files/yolo_config.txt'
+#
+#     model_input_shape = (640, 640)
+#     inference_engine = Inference(
+#         onnx_model_path=model_path,
+#         model_input_shape=model_input_shape,
+#         classes_txt_file=classes_txt_file,
+#         run_with_cuda=True
+#     )
+#
+#     image_dir = glob.glob("/home/juni/사진/sample_data/ex1/*.png")
+#
+#     for iteration, image_path in enumerate(image_dir):
+#         img = cv2.imread(image_path)
+#         if img is None:
+#             print("Error loading image_binary")
+#             return
+#         img = cv2.resize(img, model_input_shape)
+#         # Run inference
+#         t1 = time.time()
+#         detections, mask_maps = inference_engine.run_inference(img)
+#         t2 = time.time()
+#
+#         print(t2-t1)
+#
+#         # Display results
+#         # for detection in detections:
+#         #     x, y, w, h = detection['box']
+#         #     class_name = detection['class_name']
+#         #     confidence = detection['confidence']
+#         #     cv2.rectangle(img, (x, y), (x+w, y+h), detection['color'], 2)
+#         #     label = f"{class_name}: {confidence:.2f}"
+#         #     cv2.putText(img, label, (x, y - 10), cv2.FONT_HERSHEY_SIMPLEX, 0.5, detection['color'], 2)
+#         #
+#         if len(mask_maps) > 0 :
+#             seg_image = overlay_mask(img, mask_maps[0], color=(0, 255, 0), alpha=0.3)
+#             cv2.imwrite(f"result/{iteration}.png", seg_image)
 
 
 if __name__ == "__main__":
-    test2()
(파일 끝에 줄바꿈 문자 없음)
+    pass
+    # test2()
(파일 끝에 줄바꿈 문자 없음)
Add a comment
List