EasyOCR-Trainer
Browse files
app.py
CHANGED
@@ -39,15 +39,15 @@ def calculate_iou(bbox1, bbox2):
|
|
39 |
return iou
|
40 |
|
41 |
|
42 |
-
cropped_dir = "./cropped_images/"
|
43 |
if os.path.exists(cropped_dir):
|
44 |
shutil.rmtree(cropped_dir)
|
45 |
os.makedirs(cropped_dir, exist_ok=True)
|
46 |
|
47 |
-
output_dir1 = "./Folder1"
|
48 |
-
output_dir2 = "./Folder2"
|
49 |
-
output_dir3 = "./Folder3"
|
50 |
-
UPLOAD_FOLDER = "./data1"
|
51 |
os.makedirs(output_dir1, exist_ok=True)
|
52 |
os.makedirs(output_dir2, exist_ok=True)
|
53 |
os.makedirs(output_dir3, exist_ok=True)
|
@@ -101,7 +101,7 @@ def process_image():
|
|
101 |
detections = sv.Detections.from_ultralytics(results)
|
102 |
annotated_image = bounding_box_annotator.annotate(scene=random_image_data, detections=detections)
|
103 |
annotated_image = label_annotator.annotate(scene=annotated_image, detections=detections)
|
104 |
-
save_path = "./Folder1/" + "detection" + ii
|
105 |
cv2.imwrite(save_path, annotated_image)
|
106 |
print(f"Annotated image saved at {save_path}")
|
107 |
bounding_boxes = results.boxes.xyxy.cpu().numpy()
|
|
|
39 |
return iou
|
40 |
|
41 |
|
42 |
+
cropped_dir = "./mnt/cropped_images/"
|
43 |
if os.path.exists(cropped_dir):
|
44 |
shutil.rmtree(cropped_dir)
|
45 |
os.makedirs(cropped_dir, exist_ok=True)
|
46 |
|
47 |
+
output_dir1 = "./mnt/Folder1"
|
48 |
+
output_dir2 = "./mnt/Folder2"
|
49 |
+
output_dir3 = "./mnt/Folder3"
|
50 |
+
UPLOAD_FOLDER = "./mnt/data1"
|
51 |
os.makedirs(output_dir1, exist_ok=True)
|
52 |
os.makedirs(output_dir2, exist_ok=True)
|
53 |
os.makedirs(output_dir3, exist_ok=True)
|
|
|
101 |
detections = sv.Detections.from_ultralytics(results)
|
102 |
annotated_image = bounding_box_annotator.annotate(scene=random_image_data, detections=detections)
|
103 |
annotated_image = label_annotator.annotate(scene=annotated_image, detections=detections)
|
104 |
+
save_path = "./mnt/Folder1/" + "detection" + ii
|
105 |
cv2.imwrite(save_path, annotated_image)
|
106 |
print(f"Annotated image saved at {save_path}")
|
107 |
bounding_boxes = results.boxes.xyxy.cpu().numpy()
|