opening with .name
Browse files
app.py
CHANGED
@@ -118,10 +118,15 @@ def predict_and_analyze(model_name, num_channels, dim, image):
|
|
118 |
using
|
119 |
|
120 |
m,n,r = X.shape
|
121 |
-
|
122 |
-
X.reshape(
|
123 |
-
df = pd.DataFrame(
|
124 |
|
|
|
|
|
|
|
|
|
|
|
125 |
|
126 |
image = 2d numpy array in shape (C, W*W)
|
127 |
i.e. take a C,W,W array and reshape into (C, W*W)
|
@@ -137,7 +142,7 @@ def predict_and_analyze(model_name, num_channels, dim, image):
|
|
137 |
# im = f.readlines()
|
138 |
# image = np.frombuffer(image)
|
139 |
|
140 |
-
image = np.load(image, allow_pickle=True)
|
141 |
|
142 |
image = image.reshape((num_channels, W, W))
|
143 |
|
|
|
118 |
using
|
119 |
|
120 |
m,n,r = X.shape
|
121 |
+
X = np.column_stack((np.repeat(np.arange(C), W),
|
122 |
+
X.reshape(C * W, -1)))
|
123 |
+
df = pd.DataFrame(X)
|
124 |
|
125 |
+
then get the image back with
|
126 |
+
|
127 |
+
X = df.values
|
128 |
+
X = X[:, 1:]
|
129 |
+
X = X.reshape((C, W, W))
|
130 |
|
131 |
image = 2d numpy array in shape (C, W*W)
|
132 |
i.e. take a C,W,W array and reshape into (C, W*W)
|
|
|
142 |
# im = f.readlines()
|
143 |
# image = np.frombuffer(image)
|
144 |
|
145 |
+
image = np.load(image.name, allow_pickle=True)
|
146 |
|
147 |
image = image.reshape((num_channels, W, W))
|
148 |
|