Spaces:
Runtime error
Runtime error
Update similarity_inference.py
Browse files- similarity_inference.py +2 -0
similarity_inference.py
CHANGED
@@ -30,6 +30,7 @@ def similarity_inference(directory):
|
|
30 |
colors_array = np.array(colors)
|
31 |
average_color_value = tuple(np.mean(colors_array, axis=0).astype(int))
|
32 |
color_dict[each_image] = average_color_value
|
|
|
33 |
|
34 |
convert_images_to_grayscale(directory)
|
35 |
crop_center_largest_contour(directory)
|
@@ -68,6 +69,7 @@ def similarity_inference(directory):
|
|
68 |
for i, each_component in enumerate(test_ds['train']):
|
69 |
query_image = each_component["image"]
|
70 |
component_label = label_filenames['train'][i]['image']['path'].split('_')[-1].split("\\")[-1]
|
|
|
71 |
rgb_color = color_dict[component_label]
|
72 |
match = re.search(r"([a-zA-Z]+)(\d*)\.png", component_label)
|
73 |
component_label = match.group(1)
|
|
|
30 |
colors_array = np.array(colors)
|
31 |
average_color_value = tuple(np.mean(colors_array, axis=0).astype(int))
|
32 |
color_dict[each_image] = average_color_value
|
33 |
+
print(color_dict)
|
34 |
|
35 |
convert_images_to_grayscale(directory)
|
36 |
crop_center_largest_contour(directory)
|
|
|
69 |
for i, each_component in enumerate(test_ds['train']):
|
70 |
query_image = each_component["image"]
|
71 |
component_label = label_filenames['train'][i]['image']['path'].split('_')[-1].split("\\")[-1]
|
72 |
+
print(component_label)
|
73 |
rgb_color = color_dict[component_label]
|
74 |
match = re.search(r"([a-zA-Z]+)(\d*)\.png", component_label)
|
75 |
component_label = match.group(1)
|