diff --git a/gymclient.py b/gymclient.py index f75277b..1230d32 100644 --- a/gymclient.py +++ b/gymclient.py @@ -67,4 +67,4 @@ class Environment: content = pickle.loads(r.content) return content['state'], content['reward'], content['done'], content['info'] -# env = Environment("127.0.0.1", 5000) \ No newline at end of file +env = Environment("127.0.0.1", 5000) diff --git a/gymserver.py b/gymserver.py index ab96873..6cd73b3 100644 --- a/gymserver.py +++ b/gymserver.py @@ -4,6 +4,7 @@ from flask import Flask from flask import request import pickle import json +import numpy as np # Make it so that it doesn't log every HTTP request import logging @@ -53,9 +54,7 @@ class PongEnv(Environment): frame = frame[34:194, 15:145] # Crops to shape (160, 130) # Downsample frame = cv2.resize(frame, (80, 80), interpolation=cv2.INTER_AREA) - # Normalize - frame = frame / 255 - return frame + return frame.astype(np.uint8)