Hi, from the task information of the this challenge, I think the unique values of the type mask should be within the range of 0 to 10. but the unique ID values for instrument types is [0, 1, 2, 5, 6, 7, 8, 9, 10]. I have performed the unique operation on the mask of instrument type using the provided code. After mapping the unique RGB values to color IDs and counting the number of files that contain each color, the resulting type mask is as follows: {(121, 59, 57): 213, (163, 84, 82): 1310, (207, 110, 107): 536, (222, 158, 156): 0, (57, 121, 99): 0, (82, 162, 140): 1282, (107, 207, 181): 397, (156, 219, 206): 95, (49, 109, 140): 38, (57, 158, 189): 90, (82, 186, 231): 43, (148, 203, 231): 0, (57, 60, 132): 0, (74, 73, 173): 0, (107, 97, 214): 0, (156, 150, 231): 0, (115, 65, 123): 0, (148, 81, 165): 0, (189, 109, 206): 0, (214, 158, 222): 0, (189, 130, 49): 0, (214, 174, 107): 0, (225, 202, 158): 0, (239, 219, 198): 0, (13, 85, 230): 0, (60, 141, 253): 0, (107, 174, 253): 0, (162, 208, 253): 0, (84, 163, 49): 0, (118, 196, 116): 0, (155, 217, 161): 0, (192, 233, 199): 0, (177, 107, 117): 0, (200, 154, 158): 0, (220, 189, 188): 0, (235, 218, 218): 0, (99, 99, 99): 0, (150, 150, 150): 0, (189, 189, 189): 0, (217, 217, 217): 0} From the count results, it can be observed that the colors (222, 158, 156) and (57, 121, 99) do not exist in the unique values of the intrument type mask, which the mapping color id is 3 and 4 . Furthermore, the unique statistical information of the subtype of instruments is as follows: {(121, 59, 57): 208, (163, 84, 82): 8, (207, 110, 107): 2, (222, 158, 156): 731, (57, 121, 99): 399, (82, 162, 140): 98, (107, 207, 181): 422, (156, 219, 206): 1, (49, 109, 140): 28, (57, 158, 189): 508, (82, 186, 231): 0, (148, 203, 231): 0, (57, 60, 132): 0, (74, 73, 173): 0, (107, 97, 214): 0, (156, 150, 231): 4, (115, 65, 123): 570, (148, 81, 165): 246, (189, 109, 206): 16, (214, 158, 222): 6, (189, 130, 49): 43, (214, 174, 107): 8, (225, 202, 158): 85, (239, 219, 198): 56, (13, 85, 230): 6, (60, 141, 253): 89, (107, 174, 253): 247, (162, 208, 253): 8, (84, 163, 49): 397, (118, 196, 116): 95, (155, 217, 161): 38, (192, 233, 199): 90, (177, 107, 117): 43, (200, 154, 158): 0, (220, 189, 188): 2, (235, 218, 218): 1, (99, 99, 99): 0, (150, 150, 150): 0, (189, 189, 189): 0, (217, 217, 217): 0} The Python code corresponding to the above statistical results is as follows: from PIL import Image import numpy as np import glob from multiprocessing import Pool def count_unique_pixels(image_path): image = Image.open(image_path) image_array = np.array(image) if image_array.shape[2] == 4: image_array = image_array[:, :, :3] flattened_array = image_array.reshape(-1, image_array.shape[2]) unique_counts = np.unique(flattened_array, axis=0) return unique_counts def process_images(directory): png_files = glob.glob(directory) print(len(png_files)) type_palette={1: (121, 59, 57), 2:(163, 84, 82), 3:(207, 110, 107), 4:(222, 158, 156), 5:(57, 121, 99), 6:(82, 162, 140), 7:(107, 207, 181), 8:(156, 219, 206), 9:(49, 109, 140), 10:(57, 158, 189), 11:(82, 186, 231), 12:(148, 203, 231), 13:(57, 60, 132), 14:(74, 73, 173), 15:(107, 97, 214), 16:(156, 150, 231), 17:(115, 65, 123), 18:(148, 81, 165), 19:(189, 109, 206), 20:(214, 158, 222), 21:(189, 130, 49), 22:(214, 174, 107), 23:(225, 202, 158), 24:(239, 219, 198), 25:(13, 85, 230), 26:(60, 141, 253), 27:(107, 174, 253), 28:(162, 208, 253), 29:(84, 163, 49), 30:(118, 196, 116), 31:(155, 217, 161), 32:(192, 233, 199), 33:(177, 107, 117), 34:(200, 154, 158), 35:(220, 189, 188), 36:(235, 218, 218), 37:(99, 99, 99), 38:(150, 150, 150), 39:(189, 189, 189), 40:(217, 217, 217)} type_invert_palette_count_dict = {v: 0 for k, v in type_palette.items()} unique_vals = set() #[file for file in os.listdir(directory) if file.lower().endswith('.png')] pool = Pool(processes=40) for chunks_data in pool.imap_unordered(count_unique_pixels, png_files): for data in chunks_data: if (0, 0, 0) == tuple(data): continue type_invert_palette_count_dict [tuple(data)] += 1 unique_vals.add(tuple(data)) print(len(unique_vals)) print(unique_vals) print(type_invert_palette_count_dict ) process_images("EndoVis2023-SIMS/*/*/*/masks/*_type.png") process_images("EndoVis2023-SIMS/*/*/*/masks/*_type_complex.png")

Created by tianbin li litianbin
Yes, this is correct, don't worry about it. Originally we thought the data would include these instruments, so we created the IDs. Later it turned out we were mistaken, but we still kept them, because we didn't want to change things and risk confusing people with different labels. Thanks!

the unique id of instrument type is [0,1,2,5,6,7,8,9,10] page is loading…