Spaces:
Running
Running
phyloforfun
commited on
Commit
•
34c6d2f
1
Parent(s):
1881d06
mammal collage for Field Museum
Browse files
vouchervision/general_utils.py
CHANGED
@@ -1308,6 +1308,15 @@ def create_specimen_collage(cfg, logger, dir_home, Project, Dirs):
|
|
1308 |
validate_dir(os.path.dirname(save_destination))
|
1309 |
cv2.imwrite(save_destination, cv2.imread(os.path.join(Dirs.save_original, filename)))
|
1310 |
logger.info(f"Saved original image: {save_destination}")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1311 |
|
1312 |
def crop_component_from_yolo_coords(anno_type, Dirs, analysis, all_detections, full_image, filename, save_per_image, save_per_class, save_list):
|
1313 |
height = analysis['height']
|
|
|
1308 |
validate_dir(os.path.dirname(save_destination))
|
1309 |
cv2.imwrite(save_destination, cv2.imread(os.path.join(Dirs.save_original, filename)))
|
1310 |
logger.info(f"Saved original image: {save_destination}")
|
1311 |
+
|
1312 |
+
# After processing, delete the original images, leaving only the _collage images
|
1313 |
+
# This is used just in case the HF version puts them there
|
1314 |
+
for filename in filenames:
|
1315 |
+
if not filename.endswith('_collage.jpg'):
|
1316 |
+
file_path = os.path.join(Dirs.save_original, filename)
|
1317 |
+
if os.path.exists(file_path):
|
1318 |
+
os.remove(file_path)
|
1319 |
+
logger.info(f"Deleted original image: {file_path}")
|
1320 |
|
1321 |
def crop_component_from_yolo_coords(anno_type, Dirs, analysis, all_detections, full_image, filename, save_per_image, save_per_class, save_list):
|
1322 |
height = analysis['height']
|