|
11 | 11 | import httpx |
12 | 12 |
|
13 | 13 |
|
| 14 | +async def download_single_image(client, url, filename): |
| 15 | + image = await client.get(url) |
| 16 | + with Path(filename).open("wb") as im: |
| 17 | + im.write(image.content) |
| 18 | + |
| 19 | + |
14 | 20 | async def download_images(data_dir): |
15 | 21 | async with httpx.AsyncClient(timeout=20.0) as client: |
16 | | - COCO128_URL = "https://ultralytics.com/assets/coco128.zip" |
| 22 | + COCO128_URL = "https://storage.geti.intel.com/geti_predict/test/images/coco128.zip" |
17 | 23 | archive = await client.get(COCO128_URL, follow_redirects=True) |
18 | 24 | with ZipFile(BytesIO(archive.content)) as zfile: |
19 | 25 | zfile.extractall(data_dir) |
20 | | - image = await client.get( |
21 | | - "https://raw.githubusercontent.com/Shenggan/BCCD_Dataset/master/BCCD/JPEGImages/BloodImage_00007.jpg", |
22 | | - ) |
23 | | - with Path(data_dir / "BloodImage_00007.jpg").open("wb") as im: |
24 | | - im.write(image.content) |
| 26 | + |
| 27 | + image_downloads = [ |
| 28 | + ( |
| 29 | + "https://storage.geti.intel.com/geti_predict/test/images/BloodImage_00007.jpg", |
| 30 | + data_dir / "BloodImage_00007.jpg", |
| 31 | + ), |
| 32 | + ("https://storage.geti.intel.com/geti_predict/test/images/cards.png", data_dir / "cards.png"), |
| 33 | + ] |
| 34 | + |
| 35 | + await asyncio.gather(*[download_single_image(client, url, filename) for url, filename in image_downloads]) |
25 | 36 |
|
26 | 37 |
|
27 | 38 | async def stream_file(client, url, filename): |
@@ -155,6 +166,7 @@ async def main(): |
155 | 166 | download_otx_model(client, otx_models_dir, "sam_vit_b_zsl_decoder"), |
156 | 167 | download_otx_model(client, otx_models_dir, "rtmpose_tiny"), |
157 | 168 | download_otx_model(client, otx_models_dir, "segnext_t_tiling"), |
| 169 | + download_otx_model(client, otx_models_dir, "ssd-card-detection"), |
158 | 170 | download_anomalib_model(client, anomalib_models_dir, "padim"), |
159 | 171 | download_anomalib_model(client, anomalib_models_dir, "stfpm"), |
160 | 172 | download_anomalib_model(client, anomalib_models_dir, "uflow"), |
|
0 commit comments