質問編集履歴
1
コードの追加、参考にしているサイト
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,6 +1,110 @@
|
|
1
|
-
|
1
|
+
```cls_names = []
|
2
2
|
|
3
|
+
total_images = 0
|
4
|
+
|
5
|
+
for gov in govs:
|
6
|
+
|
7
|
+
|
8
|
+
|
9
|
+
file_list = os.listdir(base_path + gov + '/Annotations/')
|
10
|
+
|
11
|
+
|
12
|
+
|
13
|
+
for file in file_list:
|
14
|
+
|
15
|
+
|
16
|
+
|
17
|
+
total_images = total_images + 1
|
18
|
+
|
19
|
+
if file =='.DS_Store':
|
20
|
+
|
21
|
+
pass
|
22
|
+
|
23
|
+
else:
|
24
|
+
|
25
|
+
infile_xml = open(base_path + gov + '/Annotations/' +file)
|
26
|
+
|
27
|
+
tree = ElementTree.parse(infile_xml)
|
28
|
+
|
29
|
+
root = tree.getroot()
|
30
|
+
|
31
|
+
for obj in root.iter('object'):
|
32
|
+
|
3
|
-
|
33
|
+
cls_name = obj.find('name').text
|
34
|
+
|
35
|
+
cls_names.append(cls_name)
|
36
|
+
|
37
|
+
print("total")
|
38
|
+
|
39
|
+
print("# of images:" + str(total_images))
|
40
|
+
|
41
|
+
print("# of labels:" + str(len(cls_names)))
|
42
|
+
|
43
|
+
コード
|
44
|
+
|
45
|
+
```---------------------------------------------------------------------------
|
46
|
+
|
47
|
+
UnicodeDecodeError Traceback (most recent call last)
|
48
|
+
|
49
|
+
<ipython-input-43-73bb8957341c> in <module>()
|
50
|
+
|
51
|
+
13 else:
|
52
|
+
|
53
|
+
14 infile_xml = open(base_path + gov + '/Annotations/' +file)
|
54
|
+
|
55
|
+
---> 15 tree = ElementTree.parse(infile_xml)
|
56
|
+
|
57
|
+
16 root = tree.getroot()
|
58
|
+
|
59
|
+
17 for obj in root.iter('object'):
|
60
|
+
|
61
|
+
|
62
|
+
|
63
|
+
/anaconda3/lib/python3.6/xml/etree/ElementTree.py in parse(source, parser)
|
64
|
+
|
65
|
+
1194 """
|
66
|
+
|
67
|
+
1195 tree = ElementTree()
|
68
|
+
|
69
|
+
-> 1196 tree.parse(source, parser)
|
70
|
+
|
71
|
+
1197 return tree
|
72
|
+
|
73
|
+
1198
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
/anaconda3/lib/python3.6/xml/etree/ElementTree.py in parse(self, source, parser)
|
78
|
+
|
79
|
+
595 # It can be used to parse the whole source without feeding
|
80
|
+
|
81
|
+
596 # it with chunks.
|
82
|
+
|
83
|
+
--> 597 self._root = parser._parse_whole(source)
|
84
|
+
|
85
|
+
598 return self._root
|
86
|
+
|
87
|
+
599 while True:
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
/anaconda3/lib/python3.6/codecs.py in decode(self, input, final)
|
92
|
+
|
93
|
+
319 # decode input (taking the buffer into account)
|
94
|
+
|
95
|
+
320 data = self.buffer + input
|
96
|
+
|
97
|
+
--> 321 (result, consumed) = self._buffer_decode(data, self.errors, final)
|
98
|
+
|
99
|
+
322 # keep undecoded input until the next call
|
100
|
+
|
101
|
+
323 self.buffer = data[consumed:]
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb0 in position 45: invalid start byte
|
106
|
+
|
107
|
+
コード
|
4
108
|
|
5
109
|
### 前提・実現したいこと
|
6
110
|
|
@@ -55,3 +159,7 @@
|
|
55
159
|
|
56
160
|
|
57
161
|
ここにより詳細な情報を記載してください。
|
162
|
+
|
163
|
+
参考にしているgithubです
|
164
|
+
|
165
|
+
https://github.com/sekilab/RoadDamageDetector/blob/master/RoadDamageDatasetTutorial.ipynb
|