質問編集履歴
5
写真の追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -175,3 +175,9 @@
|
|
175
175
|
|
176
176
|
|
177
177
|
![イメージ説明](02d7381ece0bf28cf7bd68a37f62a080.png)
|
178
|
+
|
179
|
+
|
180
|
+
|
181
|
+
4,melianさんへの返信
|
182
|
+
|
183
|
+
![イメージ説明](ffcda7591c321cc97e9b5fb0677ef3b8.png)
|
4
コードの変更
test
CHANGED
File without changes
|
test
CHANGED
@@ -76,27 +76,23 @@
|
|
76
76
|
|
77
77
|
|
78
78
|
|
79
|
-
from glob import glob
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
A=glob('/content/drive/MyDrive/神様/sartorius-inserted/train_masks_npz/*.npz')
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
79
|
|
90
80
|
|
91
81
|
for idx, f in enumerate(A):
|
92
82
|
|
93
83
|
from PIL import Image
|
94
84
|
|
95
|
-
|
85
|
+
# f = np.asarray(f)
|
96
86
|
|
97
|
-
|
87
|
+
# f = Image.fromarray(f.astype('uint8'))
|
98
88
|
|
89
|
+
f=np.load(f)
|
99
90
|
|
91
|
+
|
92
|
+
|
93
|
+
f = Image.fromarray(f.astype(np.uint8))
|
94
|
+
|
95
|
+
im.save(f"/content/drive/MyDrive/神様/sartorius-inserted/train_sample_npy_to_pnp/{f[-16:-4]}.jpeg")
|
100
96
|
|
101
97
|
|
102
98
|
|
3
文字追加
test
CHANGED
@@ -1 +1 @@
|
|
1
|
-
npzから、pngに直したい次第です。
|
1
|
+
npzから、pngに直したい次第です。(編集済み)
|
test
CHANGED
@@ -163,3 +163,19 @@
|
|
163
163
|
2,
|
164
164
|
|
165
165
|
[rgbで変化なしです。](https://stackoverflow.com/questions/43229482/image-fromarray-cannot-be-used-with-array-array)
|
166
|
+
|
167
|
+
|
168
|
+
|
169
|
+
|
170
|
+
|
171
|
+
3,
|
172
|
+
|
173
|
+
|
174
|
+
|
175
|
+
[こちらに複数のやりかたってかいてあるので、その通りにやっています。](https://note.nkmk.me/en/python-numpy-image-processing/)
|
176
|
+
|
177
|
+
|
178
|
+
|
179
|
+
|
180
|
+
|
181
|
+
![イメージ説明](02d7381ece0bf28cf7bd68a37f62a080.png)
|
2
文字追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -156,4 +156,10 @@
|
|
156
156
|
|
157
157
|
AttributeError: 'NpzFile' object has no attribute '__array_interface__'
|
158
158
|
|
159
|
+
|
160
|
+
|
159
161
|
```
|
162
|
+
|
163
|
+
2,
|
164
|
+
|
165
|
+
[rgbで変化なしです。](https://stackoverflow.com/questions/43229482/image-fromarray-cannot-be-used-with-array-array)
|
1
文字追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -115,3 +115,45 @@
|
|
115
115
|
Python3 (3.7.4)
|
116
116
|
|
117
117
|
macbookpro 16
|
118
|
+
|
119
|
+
|
120
|
+
|
121
|
+
1,
|
122
|
+
|
123
|
+
|
124
|
+
|
125
|
+
```np.loadを追加後
|
126
|
+
|
127
|
+
---------------------------------------------------------------------------
|
128
|
+
|
129
|
+
AttributeError Traceback (most recent call last)
|
130
|
+
|
131
|
+
<ipython-input-37-df6ebf7b8628> in <module>()
|
132
|
+
|
133
|
+
5 # f = Image.fromarray(f.astype('uint8'))
|
134
|
+
|
135
|
+
6 f=np.load(f)
|
136
|
+
|
137
|
+
----> 7 f = Image.fromarray(f)
|
138
|
+
|
139
|
+
8 print(f)
|
140
|
+
|
141
|
+
|
142
|
+
|
143
|
+
/usr/local/lib/python3.7/dist-packages/PIL/Image.py in fromarray(obj, mode)
|
144
|
+
|
145
|
+
2702 .. versionadded:: 1.1.6
|
146
|
+
|
147
|
+
2703 """
|
148
|
+
|
149
|
+
-> 2704 arr = obj.__array_interface__
|
150
|
+
|
151
|
+
2705 shape = arr["shape"]
|
152
|
+
|
153
|
+
2706 ndim = len(shape)
|
154
|
+
|
155
|
+
|
156
|
+
|
157
|
+
AttributeError: 'NpzFile' object has no attribute '__array_interface__'
|
158
|
+
|
159
|
+
```
|