-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathcheck_images.py
59 lines (54 loc) · 1.95 KB
/
check_images.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
from imageio import imread, imwrite
import numpy as np
import glob
import shutil as sh
import os
name = "Task06_Lungs_RGB_2D_512_Balanced"
tr_root_img_folder = f"data/MSD/{name}/images/training"
val_root_img_folder = f"data/MSD/{name}/images/validation"
tr_root_annot_folder = f"data/MSD/{name}/annotations/training"
val_root_annot_folder = f"data/MSD/{name}/annotations/validation"
for ind, image_path in enumerate(glob.glob(f"{tr_root_img_folder}/*.png")):
image_bg = imread(image_path)
if not isinstance(image_bg, np.ndarray):
print("-----------------")
print(image_path)
print(type(image_bg))
else:
if image_bg.shape != (512, 512, 3):
print("-----------------")
print(image_path)
print(type(image_bg))
for ind, image_path in enumerate(glob.glob(f"{val_root_img_folder}/*.png")):
image_bg = imread(image_path)
if not isinstance(image_bg, np.ndarray):
print("-----------------")
print(image_path)
print(type(image_bg))
else:
if image_bg.shape != (512, 512, 3):
print("-----------------")
print(image_path)
print(type(image_bg))
for ind, image_path in enumerate(glob.glob(f"{tr_root_annot_folder}/*.png")):
image_bg = imread(image_path)
if not isinstance(image_bg, np.ndarray):
print("-----------------")
print(image_path)
print(type(image_bg))
else:
if image_bg.shape != (512, 512):
print("-----------------")
print(image_path)
print(type(image_bg))
for ind, image_path in enumerate(glob.glob(f"{val_root_annot_folder}/*.png")):
image_bg = imread(image_path)
if not isinstance(image_bg, np.ndarray):
print("-----------------")
print(image_path)
print(type(image_bg))
else:
if image_bg.shape != (512, 512):
print("-----------------")
print(image_path)
print(type(image_bg))