Update Tuberculosis_Dataset.py
Browse files- Tuberculosis_Dataset.py +4 -11
Tuberculosis_Dataset.py
CHANGED
@@ -92,18 +92,11 @@ class TuberculosisDataset(GeneratorBasedBuilder):
|
|
92 |
|
93 |
def _prepare_image_file_paths(self, images_zip_path):
|
94 |
image_file_paths = {}
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
if not os.path.exists(temp_dir):
|
99 |
-
os.makedirs(temp_dir)
|
100 |
-
# Iterate through each file in the ZIP
|
101 |
-
for file in z.namelist():
|
102 |
-
if file.endswith('.jpg') and not file.startswith('__MACOSX'):
|
103 |
key = file.split('_')[0]
|
104 |
if key not in image_file_paths:
|
105 |
-
#
|
106 |
-
extract_path = z.extract(file, temp_dir)
|
107 |
-
image_file_paths[key] = extract_path
|
108 |
return image_file_paths
|
109 |
|
|
|
92 |
|
93 |
def _prepare_image_file_paths(self, images_zip_path):
|
94 |
image_file_paths = {}
|
95 |
+
for root, _, files in os.walk(images_zip_path):
|
96 |
+
for file in files:
|
97 |
+
if file.endswith('.jpg'):
|
|
|
|
|
|
|
|
|
|
|
98 |
key = file.split('_')[0]
|
99 |
if key not in image_file_paths:
|
100 |
+
image_file_paths[key] = os.path.join(root, file) # Store only the first image path
|
|
|
|
|
101 |
return image_file_paths
|
102 |
|