Skip to content

Commit

Permalink
new model
Browse files Browse the repository at this point in the history
the export in perceptilabs now also includes preprocessing, so normalisation is removed from code now
  • Loading branch information
birdstream committed Sep 9, 2021
1 parent bb890e9 commit 38189e2
Show file tree
Hide file tree
Showing 5 changed files with 157 additions and 142 deletions.
2 changes: 1 addition & 1 deletion inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ async def predict(bild: bytes = File(...)):
for b in range(block_rows):
for a in range(block_cols):
pred_in = img_array[b,a,:,:].reshape(1, 224, 224, 3) # pick out the block to be predicted
predict = np.asarray(model(pred_in / norm)['target']).reshape(224, 224, 3) # make the prediction and reshape output (omit batch)
predict = np.asarray(model(pred_in)['target']).reshape(224, 224, 3) # make the prediction and reshape output (omit batch)
img_array_out[(b * 208):(b * 208) + 208, (a * 208):(a * 208) + 208, :] = predict[8:216, 8:216, :] # put the predicted block in it's right place in the new array
img_out = tf.keras.preprocessing.image.array_to_img(img_array_out) # convert array to image
img_out = img_out.crop((0, 0, W, H)) # crop out the padding
Expand Down
297 changes: 156 additions & 141 deletions model/keras_metadata.pb

Large diffs are not rendered by default.

Binary file modified model/saved_model.pb
Binary file not shown.
Binary file modified model/variables/variables.data-00000-of-00001
Binary file not shown.
Binary file modified model/variables/variables.index
Binary file not shown.

0 comments on commit 38189e2

Please sign in to comment.