Files
@ fad34516870e
Branch filter:
Location: OneEye/exp/kerokero/test.py - annotation
fad34516870e
933 B
text/x-python
normed pixel values, normed coordinates
655956f6ba89 c934d44cdf5c 655956f6ba89 655956f6ba89 655956f6ba89 655956f6ba89 655956f6ba89 655956f6ba89 655956f6ba89 c934d44cdf5c 655956f6ba89 655956f6ba89 655956f6ba89 655956f6ba89 9483b964f560 655956f6ba89 655956f6ba89 655956f6ba89 655956f6ba89 c934d44cdf5c 9483b964f560 9483b964f560 9483b964f560 9483b964f560 9483b964f560 c934d44cdf5c c934d44cdf5c c934d44cdf5c 655956f6ba89 655956f6ba89 dd45e200a0dc 655956f6ba89 655956f6ba89 655956f6ba89 fad34516870e 655956f6ba89 fad34516870e 655956f6ba89 | import argparse
import logging as log
import numpy as np
from keras.models import load_model
from prepare_data import loadDataset,Sample
from analyzer.epoint import EPoint
from analyzer.corners import Corners
import config as cfg
parser=argparse.ArgumentParser()
parser.add_argument("model")
parser.add_argument("data")
args=parser.parse_args()
model=load_model(args.model)
log.info("loading data...")
with np.load(args.data) as data:
trainImages=data["trainImages"]
trainLabels=data["trainLabels"]
testImages=data["testImages"]
testLabels=data["testLabels"]
log.info("done")
log.info(model.evaluate(testImages.reshape((-1,224,224,1)),testLabels))
for img in testImages:
label=model.predict(np.reshape(img,(1,224,224,1)))
print(label)
points=[]
for i in range(4):
points.append(EPoint((label[0][i*2]+1)*112,(label[0][i*2+1]+1)*112))
corners=Corners(points)
sample=Sample(np.uint8(img*255),corners)
sample.show()
|