Created
June 3, 2020 16:53
-
-
Save zabir-nabil/0b72653d2a2a9392cdc3a9388c5623e9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import base64 | |
import zlib | |
import requests | |
import time | |
t1 = time.time() | |
for _ in range(1000): | |
frame = np.random.randint(0,256, (416,416,3), dtype=np.uint8) # dummy rgb image | |
# compress | |
data = frame # zlib.compress(frame) | |
data = base64.b64encode(data) | |
data_send = data | |
#data2 = base64.b64decode(data) | |
#data2 = zlib.decompress(data2) | |
#fdata = np.frombuffer(data2, dtype=np.uint8) | |
r = requests.post("http://127.0.0.1:5000/predict", json={'imgb64' : data_send.decode(), 'w': 416, 'h': 416}) | |
t2 = time.time() | |
print(t2-t1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment