diff --git a/exp/kerokero/prepare_data.py b/exp/kerokero/prepare_data.py --- a/exp/kerokero/prepare_data.py +++ b/exp/kerokero/prepare_data.py @@ -37,7 +37,7 @@ class Sample: m=np.matmul(mi,m) m=np.matmul(self._computeCrop(m),m) img=cv.warpPerspective(self.img,m,(self.SIDE,self.SIDE)) - img=np.float32(img)/128-1 + img=np.uint8(img) grid=Corners(c.transform(m) for c in self.grid) grid=list(map(lambda p: list(2*p/self.SIDE-EPoint(1,1)), grid)) return (img,grid) @@ -108,8 +108,8 @@ def loadDataset(root): labels=[labels[k] for k in keys] m=int(n*trainRatio) return ( - (np.float32(images[:m]),np.float32(labels[:m])), - (np.float32(images[m:]),np.float32(labels[m:])) + (np.uint8(images[:m]),np.float32(labels[:m])), + (np.uint8(images[m:]),np.float32(labels[m:])) ) diff --git a/exp/kerokero/test.py b/exp/kerokero/test.py --- a/exp/kerokero/test.py +++ b/exp/kerokero/test.py @@ -24,7 +24,7 @@ model.summary() log.info("loading data...") with np.load(args.data) as data: - testImages=data["testImages"].reshape((-1,224,224,1)) + testImages=(np.float32(data["testImages"])/128-1).reshape((-1,224,224,1)) testLabels=data["testLabels"].reshape((-1,4,2)) log.info("done") diff --git a/exp/kerokero/train.py b/exp/kerokero/train.py --- a/exp/kerokero/train.py +++ b/exp/kerokero/train.py @@ -79,9 +79,9 @@ if args.load_model: log.info("loading data...") with np.load(args.data) as data: - trainImages=data["trainImages"].reshape((-1,224,224,1)) + trainImages=(np.float32(data["trainImages"])/128-1).reshape((-1,224,224,1)) trainLabels=data["trainLabels"].reshape((-1,4,2)) - testImages=data["testImages"].reshape((-1,224,224,1)) + testImages=(np.float32(data["testImages"])/128-1).reshape((-1,224,224,1)) testLabels=data["testLabels"].reshape((-1,4,2)) log.info("done")