回答編集履歴
1
回答例追記
test
CHANGED
@@ -1,3 +1,35 @@
|
|
1
1
|
[https://docs.python.org/ja/3.7/library/shutil.html](https://docs.python.org/ja/3.7/library/shutil.html)
|
2
2
|
|
3
3
|
の、`shutil.move`
|
4
|
+
|
5
|
+
#追記
|
6
|
+
|
7
|
+
こういうことでは?最初のコードに2行追加。
|
8
|
+
|
9
|
+
```Python
|
10
|
+
|
11
|
+
def count_resol(directory):
|
12
|
+
|
13
|
+
print(directory)
|
14
|
+
|
15
|
+
files = glob.glob(directory)
|
16
|
+
|
17
|
+
d={}
|
18
|
+
|
19
|
+
for file in files:
|
20
|
+
|
21
|
+
width,height,channels = get_resolution(file)
|
22
|
+
|
23
|
+
info = str(width) + "," + str(height) + "," +str(channels)
|
24
|
+
|
25
|
+
d.setdefault(info,0)
|
26
|
+
|
27
|
+
d[info] += 1
|
28
|
+
|
29
|
+
if width==512 and height==496: # 追加
|
30
|
+
|
31
|
+
move('./train/NORMAL/' + file, './train_NORMAL_resize/') # 追加
|
32
|
+
|
33
|
+
print(d)
|
34
|
+
|
35
|
+
```
|