|
11 | 11 | from pathlib import Path |
12 | 12 | from typing import Any |
13 | 13 | from typing import Optional |
| 14 | +from tqdm import tqdm |
14 | 15 |
|
15 | 16 | import lib.core as constances |
16 | 17 | import pandas as pd |
@@ -152,17 +153,19 @@ def upload_image(image_path: str): |
152 | 153 | set(filtered_paths), |
153 | 154 | [item for item in duplication_counter if duplication_counter[item] > 1], |
154 | 155 | ) |
155 | | - with concurrent.futures.ThreadPoolExecutor(max_workers=10) as executor: |
156 | | - results = [ |
157 | | - executor.submit(upload_image, image_path) |
158 | | - for image_path in images_to_upload |
159 | | - ] |
160 | | - for future in concurrent.futures.as_completed(results): |
161 | | - processed_image = future.result() |
162 | | - if processed_image.uploaded and processed_image.entity: |
163 | | - uploaded_image_entities.append(processed_image.entity) |
164 | | - else: |
165 | | - failed_images.append(processed_image.path) |
| 156 | + with tqdm(total=len(images_to_upload)) as progress_bar: |
| 157 | + with concurrent.futures.ThreadPoolExecutor(max_workers=10) as executor: |
| 158 | + results = [ |
| 159 | + executor.submit(upload_image, image_path) |
| 160 | + for image_path in images_to_upload |
| 161 | + ] |
| 162 | + for future in concurrent.futures.as_completed(results): |
| 163 | + processed_image = future.result() |
| 164 | + if processed_image.uploaded and processed_image.entity: |
| 165 | + uploaded_image_entities.append(processed_image.entity) |
| 166 | + else: |
| 167 | + failed_images.append(processed_image.path) |
| 168 | + progress_bar.update(1) |
166 | 169 |
|
167 | 170 | for i in range(0, len(uploaded_image_entities), 500): |
168 | 171 | self.controller.upload_images( |
@@ -248,7 +251,7 @@ def _upload_annotations( |
248 | 251 | project_name, folder_name = split_project_path(project) |
249 | 252 | project = self.controller.get_project_metadata(project_name=project_name).data |
250 | 253 | if not format: |
251 | | - format = "COCO" |
| 254 | + format = "SuperAnnotate" |
252 | 255 | if not data_set_name and format == "COCO": |
253 | 256 | raise Exception("Data-set name is required") |
254 | 257 | elif not data_set_name: |
|
0 commit comments