stream_reciever 테스트 완료, inference 기능 추가 및 후처리단 연계가 다음 단계.
@675d5d86cfc2f2c1260613bb9d796131634acb10
--- hls_streaming/hls.py
+++ hls_streaming/hls.py
... | ... | @@ -85,7 +85,7 @@ |
85 | 85 |
frame_name = f"captured_frame_{self.captured_frame_count}.jpg" |
86 | 86 |
img_binary = cv2.imencode('.png', self.current_frame) |
87 | 87 |
img_binary = img_binary[1].tobytes() |
88 |
- self.send_image_to_server(img_binary, self.endpoint) |
|
88 |
+ self.send_image_to_server(img_binary) |
|
89 | 89 |
cv2.imwrite(f'hls_streaming/captured_frame_/{datetime.now()}_{frame_name}', self.current_frame) |
90 | 90 |
self.last_capture_time = current_time |
91 | 91 |
print(f"Captured {frame_name} at time: {current_time - self.start_time:.2f}s") |
... | ... | @@ -93,7 +93,7 @@ |
93 | 93 |
|
94 | 94 |
time.sleep(0.1) |
95 | 95 |
|
96 |
- def send_image_to_server(self, image, endpoint, image_type="png"): |
|
96 |
+ def send_image_to_server(self, image, image_type="png"): |
|
97 | 97 |
time_sent = datetime.now(self.time_zone).strftime("yyyy-MM-dd'T'HH:mm:ss'Z'") |
98 | 98 |
header = { |
99 | 99 |
'Content-Type': f'image/{image_type}', |
... | ... | @@ -112,7 +112,7 @@ |
112 | 112 |
} |
113 | 113 |
) |
114 | 114 |
header["Content-Type"] = multipart_data.content_type |
115 |
- response = session.post(endpoint, headers=header, data=multipart_data) |
|
115 |
+ response = session.post(self.endpoint, headers=header, data=multipart_data) |
|
116 | 116 |
|
117 | 117 |
except Exception as e: |
118 | 118 |
print(e) |
--- hls_streaming/streaming_process.py
+++ hls_streaming/streaming_process.py
... | ... | @@ -7,9 +7,9 @@ |
7 | 7 |
import os |
8 | 8 |
|
9 | 9 |
load_dotenv() |
10 |
- print("PYTHONPATH:", os.getenv("PYTHONPATH")) |
|
11 |
- print("_____") |
|
12 |
- print(os.path.dirname(os.path.abspath(__file__))) |
|
10 |
+ # print("PYTHONPATH:", os.getenv("PYTHONPATH")) |
|
11 |
+ # print("_____") |
|
12 |
+ # print(os.path.dirname(os.path.abspath(__file__))) |
|
13 | 13 |
from ITS.api import gather_cctv_list |
14 | 14 |
from hls_streaming.hls import FrameCapturer |
15 | 15 |
|
... | ... | @@ -18,7 +18,7 @@ |
18 | 18 |
import time |
19 | 19 |
|
20 | 20 |
|
21 |
- def refresh_hls_address(lat, lon, lat_lon_interval=0.00001): |
|
21 |
+ def refresh_hls_address(lat, lon, lat_lon_interval=0.000001): |
|
22 | 22 |
api_result = gather_cctv_list( |
23 | 23 |
xmin=lat - lat_lon_interval, ymin=lon - lat_lon_interval, |
24 | 24 |
xmax=lat + lat_lon_interval, ymax=lon + lat_lon_interval, |
--- run_image_anal_backend.sh
+++ run_image_anal_backend.sh
... | ... | @@ -3,10 +3,15 @@ |
3 | 3 |
# Array to hold the process IDs |
4 | 4 |
declare -a pids |
5 | 5 |
|
6 |
+PYTHONPATH="/home/juni/PycharmProjects/segmentation_overlapping" |
|
7 |
+ |
|
6 | 8 |
# Start multiple Python processes in the background |
7 |
-python hls_streaming/hls.py & |
|
9 |
+python hls_streaming/hls.py --cctv_num 0 & |
|
8 | 10 |
pids+=($!) |
9 |
-python hls_streaming/hls.py & |
|
11 |
+python hls_streaming/hls.py --cctv_num 1 & |
|
12 |
+pids+=($!) |
|
13 |
+ |
|
14 |
+python test.py |
|
10 | 15 |
pids+=($!) |
11 | 16 |
|
12 | 17 |
# Function to kill all processes |
--- test.py
+++ test.py
... | ... | @@ -47,7 +47,7 @@ |
47 | 47 |
filename = f"{timestamp}_{cctv_info}.png" |
48 | 48 |
image_path = os.path.join(IMAGE_DIR, filename) |
49 | 49 |
image.save(image_path) |
50 |
- |
|
50 |
+ print("successful") |
|
51 | 51 |
return {"message": f"Image {filename} uploaded successfully!"} |
52 | 52 |
|
53 | 53 |
if __name__ == '__main__': |
Add a comment
Delete comment
Once you delete this comment, you won't be able to recover it. Are you sure you want to delete this comment?