Commit a93c1407 authored by Nina Montana Brown's avatar Nina Montana Brown

Added new console entry and changed conditional statement for group masks

parent 6bc47025
Pipeline #4686 failed with stages
in 37 seconds
......@@ -42,7 +42,10 @@ def group_masks(input_dir, store_dir, format_im='png'):
if len(base) > 3:
# Hyphenated characters present in ID, rejoin to get
# unique file id.
file_id = '_'.join(base[:-(len(base)-1)])
if base[0].isalpha(): # if the first element is an id like image
file_id = '_'.join(base[:-(len(base)-3)])
else:
file_id = '_'.join(base[:-(len(base)-2)])
else:
file_id = base[0]
......@@ -89,12 +92,12 @@ def group_masks(input_dir, store_dir, format_im='png'):
out_im = out_im.astype(np.uint8)
# # Generating the file name
if "image" in unique_id:
unique_id = unique_id.replace("image", "mask")
if "image_" in unique_id:
new_id = unique_id.replace("image_", "mask_")
else:
unique_id = "mask_" + unique_id
new_id = "mask_" + unique_id
final_mask_path = os.path.join(class_path, (unique_id))
final_mask_path = os.path.join(class_path, (new_id))
# Write im to dir
out_im = Image.fromarray(out_im)
......
......@@ -60,7 +60,8 @@ setup(
entry_points={
'console_scripts': [
'labelbox_export_json=labelboxutils.ui.labelbox_export_json_command_line:main',
'labelbox_group_masks=labelboxutils.ui.labelbox_group_masks_command_line:main'
'labelbox_group_masks=labelboxutils.ui.labelbox_group_masks_command_line:main',
'labelbox_get_zeros=labelboxutils.ui.labelbox_get_zeros_command:main'
],
},
)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment