質問編集履歴
2
未定義のnを修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -54,7 +54,7 @@
|
|
54
54
|
|
55
55
|
width,height=128,96 #resizeの大きさ
|
56
56
|
|
57
|
-
X=np.zeros((
|
57
|
+
X=np.zeros((X_pre.shape[0],width*height)) #Xの用意。
|
58
58
|
|
59
59
|
|
60
60
|
|
1
コードの挿入、およびimport文追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -36,12 +36,30 @@
|
|
36
36
|
|
37
37
|
|
38
38
|
|
39
|
+
```python
|
40
|
+
|
41
|
+
from PIL import Image
|
42
|
+
|
43
|
+
import numpy as np
|
44
|
+
|
45
|
+
import pandas as pd
|
46
|
+
|
47
|
+
|
48
|
+
|
39
49
|
test=pd.read_csv('XXXXX.csv') #csv fileを読み込む
|
40
50
|
|
41
51
|
X_pre=test['file name'] #(データ数、file name)となる。
|
42
52
|
|
43
53
|
|
44
54
|
|
55
|
+
width,height=128,96 #resizeの大きさ
|
56
|
+
|
57
|
+
X=np.zeros((n,width*height)) #Xの用意。
|
58
|
+
|
59
|
+
|
60
|
+
|
45
61
|
for i in range(X_pre.shape[0]): #データ数分
|
46
62
|
|
47
63
|
X[i:]=np.array(Image.open(X_pre[i])).ravel() #ファイルを開き二次元配列に変換したあとにflattenで一次元配列に
|
64
|
+
|
65
|
+
```
|