개정판 69c8fbf0
issue #1366: fix label load
Change-Id: I11bd31b4d61fbd7cab892f404606d177be518433
DTI_PID/WebServer/symbol_training/src/doftech_dataset.py | ||
---|---|---|
25 | 25 |
self.img_path_list = sorted([item for sublist in [glob.glob(self.img_path + ext) for ext in ["*.jpg", "*.png"]] for item in sublist])#sorted(glob.glob(os.path.join(self.img_path, '*.jpg'))) |
26 | 26 |
|
27 | 27 |
self.img_list = [] |
28 |
for img_path in self.img_path_list: |
|
29 |
self.img_list.append(cv2.imread(img_path)) |
|
28 |
#for img_path in self.img_path_list:
|
|
29 |
# self.img_list.append(cv2.imread(img_path))
|
|
30 | 30 |
|
31 | 31 |
self.img_list_new = [] |
32 | 32 |
self.anno_list_new = [] |
... | ... | |
34 | 34 |
self.anno_path_list = sorted([item for sublist in [glob.glob(self.xml_path + ext) for ext in ["*.xml"]] for item in sublist])#sorted(glob.glob(os.path.join(self.xml_path, '*.xml'))) |
35 | 35 |
self.anno_list = [] |
36 | 36 |
|
37 |
for anno_path in self.anno_path_list: |
|
37 |
#for anno_path in self.anno_path_list: |
|
38 |
for index in range(self.anno_path_list): |
|
39 |
anno_path = self.anno_path_list[index] |
|
38 | 40 |
annot = ET.parse(anno_path) |
39 | 41 |
objects = [] |
40 | 42 |
for obj in annot.findall('object'): |
... | ... | |
44 | 46 |
#label = self.classes.index(obj.find('name').text.lower().strip()) |
45 | 47 |
label = self.classes.index(obj.find('name').text) |
46 | 48 |
objects.append([xmin, ymin, xmax, ymax, label]) |
47 |
self.anno_list.append(objects) |
|
49 |
if objects: |
|
50 |
self.anno_list.append(objects) |
|
51 |
img_path = self.img_path_list[index] |
|
52 |
self.img_list.append(cv2.imread(img_path)) |
|
48 | 53 |
|
49 | 54 |
if self.is_training==True: |
50 | 55 |
if self.use_rescale == True: |
내보내기 Unified diff