|
@@ -14,21 +14,28 @@ from server_utils.read_properties import get_properties_dict
|
|
import requests
|
|
import requests
|
|
from multiprocessing import Process
|
|
from multiprocessing import Process
|
|
headers = {"Content-Type": "application/json"}
|
|
headers = {"Content-Type": "application/json"}
|
|
-properties_dict = get_properties_dict()
|
|
|
|
-inference_address = properties_dict.get("inference_address")
|
|
|
|
-
|
|
|
|
|
|
+# properties_dict = get_properties_dict()
|
|
|
|
+# inference_address = properties_dict.get("inference_address")
|
|
|
|
+import time
|
|
|
|
|
|
|
|
+num = 1
|
|
|
|
+t_time = time.time()
|
|
def single_test(input_source=os.path.join(os.getcwd(), "../test_images/test1.jpg")):
|
|
def single_test(input_source=os.path.join(os.getcwd(), "../test_images/test1.jpg")):
|
|
|
|
+ global num
|
|
|
|
+
|
|
while True:
|
|
while True:
|
|
- request_url = "{}/predictions/yolov5".format(inference_address)
|
|
|
|
|
|
+ request_url = "http://0.0.0.0:8080/predictions/yolov5"
|
|
image_base64 = path2base64(input_source)
|
|
image_base64 = path2base64(input_source)
|
|
|
|
+
|
|
payload = {"data": image_base64,
|
|
payload = {"data": image_base64,
|
|
"output_methods": str(["pd_xywh_json"]),
|
|
"output_methods": str(["pd_xywh_json"]),
|
|
"base64_bool": True}
|
|
"base64_bool": True}
|
|
-
|
|
|
|
|
|
+ s_time = time.time()
|
|
req = requests.post(url=request_url, data=payload)
|
|
req = requests.post(url=request_url, data=payload)
|
|
- print(eval(req.text))
|
|
|
|
-
|
|
|
|
|
|
+ # print(eval(req.text))
|
|
|
|
+ num += 1
|
|
|
|
+ print(f"sub {time.time()-s_time} --- {num}")
|
|
|
|
+ print(f"total {time.time() - t_time} -- {num}")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -36,7 +43,7 @@ def single_test(input_source=os.path.join(os.getcwd(), "../test_images/test1.jpg
|
|
|
|
|
|
if __name__ == '__main__':
|
|
if __name__ == '__main__':
|
|
|
|
|
|
- for i in range(3):
|
|
|
|
|
|
+ for i in range(120):
|
|
t = Process(target=single_test)
|
|
t = Process(target=single_test)
|
|
t.start()
|
|
t.start()
|
|
|
|
|