--- ITS/api.py
+++ ITS/api.py
... | ... | @@ -84,7 +84,7 @@ |
84 | 84 |
# df.to_csv(f"result/pohang/listofcctv_포항_{x}_{y}.csv", index=False) |
85 | 85 |
time.sleep(1) |
86 | 86 |
print(f"{i}, {j}") |
87 |
- all_data_df.to_csv(f"ITS/list/{xmin}_{xmax}_y{ymin}_{ymax}.csv") |
|
87 |
+ all_data_df.to_csv(f"ITS/list/{xmin}_{xmax}_y{ymin}_{ymax}_its.csv") |
|
88 | 88 |
return all_data_df |
89 | 89 |
|
90 | 90 |
def get_jpeg(url): |
... | ... | @@ -96,6 +96,6 @@ |
96 | 96 |
|
97 | 97 |
|
98 | 98 |
if __name__ == "__main__": |
99 |
- df = gather_cctv_list(125, 130, 33, 39, 2, "ex", 1) |
|
99 |
+ df = gather_cctv_list(128.074392720, 130.909268695, 35.635147801,37.497349441, 2, "its", 1) |
|
100 | 100 |
pass |
101 | 101 |
# get_jpeg("http://cctvsec.ktict.co.kr:8090/74236/IM2NQs4/uHZcgnvJo3V/mjo3tswwgUj87kpcYZfR/BPxaQ4lk9agnl8ARIB9lhlgOD87VBx6RDHFl423kLkqHQ==")(파일 끝에 줄바꿈 문자 없음) |
--- ITS/api_list_gatherer.py
+++ ITS/api_list_gatherer.py
... | ... | @@ -111,4 +111,4 @@ |
111 | 111 |
df = gather_cctv_list(x-delta,x+delta, y-delta, y+delta, 1, ty, 1) |
112 | 112 |
all_data_df = pd.concat((all_data_df,df), ignore_index=True) |
113 | 113 |
# df = gather_cctv_list(127, 130, 33, 39, 8, "its", 1) |
114 |
- all_data_df.to_csv("cctv_data.csv")(파일 끝에 줄바꿈 문자 없음) |
|
114 |
+ all_data_df.to_csv("cctv_data_old.csv")(파일 끝에 줄바꿈 문자 없음) |
+++ ITS/cctv_data.csv
... | ... | @@ -0,0 +1,17 @@ |
1 | +,roadsectionid,coordx,coordy,cctvresolution,filecreatetime,cctvtype,cctvformat,cctvname,cctvurl | |
2 | +0,,129.2005,35.921825,,,1,HLS,[국도20호선] 검단산업단지,http://cctvsec.ktict.co.kr/71187/bWDrL7fpStZDeDZgCybpJH8gagWJOynbaA/l91ExpmUPKzc3bCsHJtIblDkzG3TfzYDsbNJ7zAQ90+zWILAitFHTEDoXZSOrzc2TRBV36hw= | |
3 | +1,,129.22647,35.934418,,,1,HLS,[국도20호선] 사방교차로,http://cctvsec.ktict.co.kr/72512/t01+nKA14+X2qGEfUc0SO2WSOj3cPeKShgxB1TCkjNrFrv037BHl3V3nxo7jZxY4qq6hPbgWYVsQhFIo3L4nNOpujyf5mdvuklodth2GKZ4= | |
4 | +2,,129.247434,35.938131,,,1,HLS,[국도 7호선] 북경주IC,http://cctvsec.ktict.co.kr/4073/M268AufmeBDH3b3SZmNTDa9UJ7zNcXbaVlcbc4+TR5Lw7zjgzzX4VAdWgag81qMmYhudzDfyf9JCMlam0TICo+wuirDs0CgKWuuwaj9mwIE= | |
5 | +3,,129.2471,35.93833,,,1,HLS,[국도20호선] 북경주IC,http://cctvsec.ktict.co.kr/72514/0MKsoRYUhMJ0i6Pj5VMsgGy0nnKlMrPL0zzGW9YVXbH6tUx6xxhbtodyXUUyz74/o7boIps3/GOvgYkJxgE6gysFpQqxlsmsiQfuZvpcz9w= | |
6 | +4,,129.2708,35.94363,,,1,HLS,[국도20호선] 천북산업단지,http://cctvsec.ktict.co.kr/72516/L2d9HFtI4iTlsZYWEy5F78R0ORKHtqHhAYQXMNNkOZRzdpkc2nS9AHsdlRdWOdRiuROpJ3V5NwupuvGfBphyMER3gD6yD8j0dk9InwUrG+E= | |
7 | +5,,129.29959,35.95008,,,1,HLS,[국도20호선] 왕신교차로,http://cctvsec.ktict.co.kr/75062/olvEosseU5qRSg20E6KMb9KQLYgkME2rO9ZaEViSp87qoQYaDBQmvOfyUQFjyzl2TvOpiqeN3xzA4iagFMFCsGCOx9kOufTF69kNBcTosOA= | |
8 | +6,,129.24908,35.97815,,,1,HLS,[국도7호선] 경주 강동과적검문소 부근,http://cctvsec.ktict.co.kr/72945/sUVhkrW9EegZT00WzWEblFw2Ynolb0ElVvKJo5QsJRzN+m3iG0XKn468y0yKzBC7F0vkNr6blidyV8lj5UZgcWzaR7hMCVlAzlDK2AfejM4= | |
9 | +7,,129.269177,35.983341,,,1,HLS,[국도 7호선] 강동IC,http://cctvsec.ktict.co.kr/4071/eCDLzCcOb35K6wou65+nYTCoaPVNPYEy29J3kEbgNROqEuQSrmATulzDlFpWx6TN01gMzDNAN8LyFvqh3iKGTg/7iTYTJima20V5mE8AiaY= | |
10 | +8,,129.253539,35.985587,,,1,HLS,[국도 7호선] 이제테크,http://cctvsec.ktict.co.kr/4460/Xr9+OT8IDnVd3oQUlaDZA3lOt2s5g+ywaS+YcJx3odTqmjeGYYS0CwqT009FfDKtYNEhYevoL/Q/FhyiyZHhzMx0qkRF3Tb5zrv+WIQUW3w= | |
11 | +9,,129.255853,35.988625,,,1,HLS,[국도 28호선] 인동삼거리,http://cctvsec.ktict.co.kr/5562/M0OpafuK8Rfe6cmxqH8YDT+kOGJ7ar9CACnZWQ5CarFbYgZAzXznW4rWZ9kA9joP/YN2skKgjMH9i481UOQ4XsicIgjQyY2kyW3e/vsTxxg= | |
12 | +10,,129.281389,35.991812,,,1,HLS,[국도 28호선] 유금IC,http://cctvsec.ktict.co.kr/4119/Fe3O/UIJ/0/CFersxMGgjIcBQrsqE+QycVYsNFOJUzdjom+H/VQHtM7T+q/p3gJO6mXY/ismWLgKc/edZUJvWBKuh5qsg3HqorQI8nZjKCU= | |
13 | +11,,129.2347,35.99271,,,1,HLS,[국도28호선] 안강교차로,http://cctvsec.ktict.co.kr/75045/hdWQ0L0qdextPv3KvTaxci4gcz/l3OyWVeH47bqgXu3pgrvkFMeXcm8Vf+4T/ODT/TXIGM6n10du/1/o2wmVQ5PUs2WDz6KPER7UaRQ0PLU= | |
14 | +12,,129.228436,35.998511,,,1,HLS,[국도 28호선] 안강IC,http://cctvsec.ktict.co.kr/5563/QVqzfXSeaD53r4lCGfnSOuHMML6jMqbBTwODdwZxwlcNVIoFRf6ByrMKZXGfgv99LlTNOYj5rDdpOfsCO24QhO05M+zvElXlJurEKnAhj3s= | |
15 | +13,,129.284657,36.016126,,,1,HLS,[국도 28호선] 위덕대학교 앞 삼거리,http://cctvsec.ktict.co.kr/4436/ya0JdV0uiCaqQ+lxSMDRG8PqKWq8vL9MuwjMfnRdIKL1PBWaPO/9d9CCcfF/8GTi2q8yJX78iuKL0yaPOKKLKfQedbCMUNOrKeQSt0LTPG0= | |
16 | +14,,129.293598,36.025038,,,1,HLS,[국도 28호선] 학전보건소 앞 교차로,http://cctvsec.ktict.co.kr/4434/S5CcFQ6maa0k5VCmIMdKf6yhgKzvCsGDv82B/Wo1BAHerYK7aiJkJrh1KPqc2hccABUGoir2OsnZJi72m/aqR/Fw0xgUftEfd6H3qP3R21I= | |
17 | +15,,129.293598,36.025038,,,1,HLS,[시연용] 침수구간,http://takensofttesting.iptime.org:54127(파일 끝에 줄바꿈 문자 없음) |
--- config_files/cctv_list.csv
+++ config_files/cctv_list.csv
... | ... | @@ -1,12 +1,18 @@ |
1 |
-roadsectionid,coordx,coordy,cctvresolution,filecreatetime,cctvtype,cctvformat,cctvname,cctvurl |
|
2 |
-,129.245312,35.920346,,,1,HLS,[국도 7호선] 모아초교,http://cctvsec.ktict.co.kr/4463/6SqphQj32sxeB2nYIMerulhkk0HdDKP/aSEgp7hHbUY9iwTDb+UQZfTbag9pXmM/yo3a7l1usm64GwBH77/SCVEel3JF3g9BZDc+ws1es2w= |
|
3 |
-,129.2005,35.921825,,,1,HLS,[국도20호선] 검단산업단지,http://cctvsec.ktict.co.kr/71187/bWDrL7fpStZDeDZgCybpJH8gagWJOynbaA/l91ExpmUPKzc3bCsHJtIblDkzG3TfmkwkLj7+PPdYAHSYBXxem4SZJpaAYFU0CtDtr5rz7DY= |
|
4 |
-,128.06396,36.047108,,,1,HLS,[국도3호선] 송죽교차로,http://cctvsec.ktict.co.kr/71208/Z9Acztz6CYwzuUXQFreRR0Kdewba8Ml4CNxR0Jsp9uSCWmvL9W/BO1w2XIPxtxs9kn58qVvtHREs6vU305JaRa40F1m/P6f13gpiz9C+46M= |
|
5 |
-,128.2671,35.91457,,,1,HLS,[국도33호선] 대흥교차로,http://cctvsec.ktict.co.kr/72593/mTZfGWopuLSKGZsBABx2whdCW4FLmBl6wi4dCvp0MxMpKF6c6ydtf40G8dVXQcAGlDug1DIE/E4MVUyoa3UuD18aYxP6ZCMD5zISEiDxXTQ= |
|
6 |
-,129.378721,36.310334,,,1,HLS,[국도 7호선] 영덕 구계휴게소,http://cctvsec.ktict.co.kr/4459/kAgktFah0VAtMosKMfrJ13d7CBLAa5+M1xhiLgsypRh5NDDIqY0Y7Z2+hkF88PZUhL1uFJTYshn/Afc4FCS67iWpGfxUOoNU8b0ul3flW8c= |
|
7 |
-,129.37762,36.318485,,,1,HLS,"[국도7호선] 영덕 영덕구계항부근(마을주민,해안가)",http://cctvsec.ktict.co.kr/72957/LkVa3bIbXIBudmzokRTyNtAbqEoZCk+DHRZ8i6cs+rL6QIEM7Fv1N+wfJPjSFQOEmn+Sklz5M3zqnjyiuo6lcPORJsjpyig6wn11ZeH+h44= |
|
8 |
-,129.381293,36.339985,,,1,HLS,[국도 7호선] 오션뷰C.C 앞 삼거리,http://cctvsec.ktict.co.kr/4475/0lZW6kXydguhfnjHZgPeVWi/UKIYrPrUGPfVDyXcGXynS/XFEaXHTYGgmLHdj6QwF1AcHSd6JRZnW+/Ecw30OL/L63URGEp3X/DJqKRrzR0= |
|
9 |
-,129.3459,36.11983,,,1,HLS,[국도7호선] 곡강교,http://cctvsec.ktict.co.kr/71249/YZj8q/z+rpoz8wHUZGst7oMp01rLXrsqhKDnbcKcndono98hK4v5LXE3UumA35GOUC3vxTXsvCBdemtPt60aNJsGUbr+NNiMFUZXDoNutF8= |
|
10 |
-,129.193728,35.762614,,,1,HLS,[국도7호선] 부지교차로,http://cctvsec.ktict.co.kr/72311/kdgcZLCWMjfPL2B06+sReFWMMB+6gW6i1XePhxb0jT/S3jhoQGFbl4nM8fnNunVxbfcv+gtwwve5/Alut8ExIXo8I9h3kV5tNjcqr2ai8d4= |
|
11 |
-,129.200930555555,35.772125,,,1,HLS,[국도 35호선] 용장교,http://cctvsec.ktict.co.kr/5569/7Wk7xI0iDot4My7wDolq5X3jnW9Pgsp7eqT4fmbF1G1dWh248yZuO0r6DZGPJc0lFupmPdL6nCMDyuYljTRHmm7FxLfEMZ9OOKcycSLyHIk= |
|
12 |
-,128.03166,36.011665,,,1,HLS,[국도3호선] 방산교,http://cctvsec.ktict.co.kr/72618/tJq3wZnEySy1HdQLbvzJhD6i+QrqP0HIopbzDMD/h21V/QmMVP26YJUOZsU9WnMsSrPMHfzgTP54irzJjPv+4kCcFJuqvRM63JNFmolU2tE= |
|
1 |
+,roadsectionid,coordx,coordy,cctvresolution,filecreatetime,cctvtype,cctvformat,cctvname,cctvurl |
|
2 |
+0,,129.2005,35.921825,,,1,HLS,[국도20호선] 검단산업단지,http://cctvsec.ktict.co.kr/71187/bWDrL7fpStZDeDZgCybpJH8gagWJOynbaA/l91ExpmUPKzc3bCsHJtIblDkzG3TfzYDsbNJ7zAQ90+zWILAitFHTEDoXZSOrzc2TRBV36hw= |
|
3 |
+1,,129.22647,35.934418,,,1,HLS,[국도20호선] 사방교차로,http://cctvsec.ktict.co.kr/72512/t01+nKA14+X2qGEfUc0SO2WSOj3cPeKShgxB1TCkjNrFrv037BHl3V3nxo7jZxY4qq6hPbgWYVsQhFIo3L4nNOpujyf5mdvuklodth2GKZ4= |
|
4 |
+2,,129.247434,35.938131,,,1,HLS,[국도 7호선] 북경주IC,http://cctvsec.ktict.co.kr/4073/M268AufmeBDH3b3SZmNTDa9UJ7zNcXbaVlcbc4+TR5Lw7zjgzzX4VAdWgag81qMmYhudzDfyf9JCMlam0TICo+wuirDs0CgKWuuwaj9mwIE= |
|
5 |
+3,,129.2471,35.93833,,,1,HLS,[국도20호선] 북경주IC,http://cctvsec.ktict.co.kr/72514/0MKsoRYUhMJ0i6Pj5VMsgGy0nnKlMrPL0zzGW9YVXbH6tUx6xxhbtodyXUUyz74/o7boIps3/GOvgYkJxgE6gysFpQqxlsmsiQfuZvpcz9w= |
|
6 |
+4,,129.2708,35.94363,,,1,HLS,[국도20호선] 천북산업단지,http://cctvsec.ktict.co.kr/72516/L2d9HFtI4iTlsZYWEy5F78R0ORKHtqHhAYQXMNNkOZRzdpkc2nS9AHsdlRdWOdRiuROpJ3V5NwupuvGfBphyMER3gD6yD8j0dk9InwUrG+E= |
|
7 |
+5,,129.29959,35.95008,,,1,HLS,[국도20호선] 왕신교차로,http://cctvsec.ktict.co.kr/75062/olvEosseU5qRSg20E6KMb9KQLYgkME2rO9ZaEViSp87qoQYaDBQmvOfyUQFjyzl2TvOpiqeN3xzA4iagFMFCsGCOx9kOufTF69kNBcTosOA= |
|
8 |
+6,,129.24908,35.97815,,,1,HLS,[국도7호선] 경주 강동과적검문소 부근,http://cctvsec.ktict.co.kr/72945/sUVhkrW9EegZT00WzWEblFw2Ynolb0ElVvKJo5QsJRzN+m3iG0XKn468y0yKzBC7F0vkNr6blidyV8lj5UZgcWzaR7hMCVlAzlDK2AfejM4= |
|
9 |
+7,,129.269177,35.983341,,,1,HLS,[국도 7호선] 강동IC,http://cctvsec.ktict.co.kr/4071/eCDLzCcOb35K6wou65+nYTCoaPVNPYEy29J3kEbgNROqEuQSrmATulzDlFpWx6TN01gMzDNAN8LyFvqh3iKGTg/7iTYTJima20V5mE8AiaY= |
|
10 |
+8,,129.255853,35.988625,,,1,HLS,[국도 28호선] 인동삼거리,http://cctvsec.ktict.co.kr/5562/M0OpafuK8Rfe6cmxqH8YDT+kOGJ7ar9CACnZWQ5CarFbYgZAzXznW4rWZ9kA9joP/YN2skKgjMH9i481UOQ4XsicIgjQyY2kyW3e/vsTxxg= |
|
11 |
+9,,129.281389,35.991812,,,1,HLS,[국도 28호선] 유금IC,http://cctvsec.ktict.co.kr/4119/Fe3O/UIJ/0/CFersxMGgjIcBQrsqE+QycVYsNFOJUzdjom+H/VQHtM7T+q/p3gJO6mXY/ismWLgKc/edZUJvWBKuh5qsg3HqorQI8nZjKCU= |
|
12 |
+10,,129.2347,35.99271,,,1,HLS,[국도28호선] 안강교차로,http://cctvsec.ktict.co.kr/75045/hdWQ0L0qdextPv3KvTaxci4gcz/l3OyWVeH47bqgXu3pgrvkFMeXcm8Vf+4T/ODT/TXIGM6n10du/1/o2wmVQ5PUs2WDz6KPER7UaRQ0PLU= |
|
13 |
+11,,129.228436,35.998511,,,1,HLS,[국도 28호선] 안강IC,http://cctvsec.ktict.co.kr/5563/QVqzfXSeaD53r4lCGfnSOuHMML6jMqbBTwODdwZxwlcNVIoFRf6ByrMKZXGfgv99LlTNOYj5rDdpOfsCO24QhO05M+zvElXlJurEKnAhj3s= |
|
14 |
+12,,129.284657,36.016126,,,1,HLS,[국도 28호선] 위덕대학교 앞 삼거리,http://cctvsec.ktict.co.kr/4436/ya0JdV0uiCaqQ+lxSMDRG8PqKWq8vL9MuwjMfnRdIKL1PBWaPO/9d9CCcfF/8GTi2q8yJX78iuKL0yaPOKKLKfQedbCMUNOrKeQSt0LTPG0= |
|
15 |
+13,,129.293598,36.025038,,,1,HLS,[국도 28호선] 학전보건소 앞 교차로,http://cctvsec.ktict.co.kr/4434/S5CcFQ6maa0k5VCmIMdKf6yhgKzvCsGDv82B/Wo1BAHerYK7aiJkJrh1KPqc2hccABUGoir2OsnZJi72m/aqR/Fw0xgUftEfd6H3qP3R21I= |
|
16 |
+14,,129.253539,35.985587,,,1,HLS,[국도 7호선] 이제테크,http://cctvsec.ktict.co.kr/4460/Xr9+OT8IDnVd3oQUlaDZA3lOt2s5g+ywaS+YcJx3odTqmjeGYYS0CwqT009FfDKtFgV6olzg/psZgALZ323EbzifPbYXpu9ykHWFxrvfiFU= |
|
17 |
+15,,129.255853,35.988625,,,1,HLS,[국도 28호선] 인동삼거리,http://cctvsec.ktict.co.kr/5562/M0OpafuK8Rfe6cmxqH8YDT+kOGJ7ar9CACnZWQ5CarFbYgZAzXznW4rWZ9kA9joPAzR9/9ysDMzUxjFRa5U0ReMp9+7oogtA3cKDi6vUDRs= |
|
18 |
+16,,128.731178,35.789061,,,1,HLS,[국도25호선] 협석교,http://cctvsec.ktict.co.kr/74022/hHOIJ9u/upxrPh+MUCp/g1QO+AX5Ml22KZMIeYARDDFErSactLSf8sM+UwRqybIUhZiM34aH+vm77QLuaXEznuT2Hynw0Y46cNWZ2tqR/T0= |
+++ hls_streaming_collect_cctvs.py
... | ... | @@ -0,0 +1,39 @@ |
1 | +from ITS.api import gather_cctv_list | |
2 | +from hls_streaming.hls import FrameCapturer | |
3 | +from time import sleep | |
4 | +import threading | |
5 | +from time import sleep | |
6 | +import pandas as pd | |
7 | + | |
8 | +def manage_capturer(): | |
9 | + # cctv_list1 = pd.read_csv("ITS/list/125_130_y33_39.csv") | |
10 | + cctv_list = pd.read_csv("ITS/list/128.07439272_130.909268695_y35.635147801_37.497349441_its.csv") | |
11 | + # cctv_list = pd.concat((cctv_list1, cctv_list2)) | |
12 | + | |
13 | + cctv_list = cctv_list.sample(frac=1).reset_index(drop=True) | |
14 | + | |
15 | + cctv_list_name = cctv_list['cctvname'] | |
16 | + cctv_list_url = cctv_list['cctvurl'] | |
17 | + | |
18 | + for (name, url) in zip(cctv_list_name, cctv_list_url): | |
19 | + try: | |
20 | + frame_cap = FrameCapturer(url, name, "_", "_") | |
21 | + frame_cap.start() | |
22 | + sleep(50) | |
23 | + frame_cap.stop() | |
24 | + sleep(60) | |
25 | + except: | |
26 | + continue | |
27 | + | |
28 | + | |
29 | +# Create threads for the first 10 capturers (assuming there are at least 10) | |
30 | +threads = [threading.Thread(target=manage_capturer) for _ in range(3)] | |
31 | + | |
32 | +# Start all threads | |
33 | +for thread in threads: | |
34 | + thread.start() | |
35 | + sleep(1) | |
36 | + | |
37 | +# Wait for all threads to finish | |
38 | +for thread in threads: | |
39 | + thread.join()(파일 끝에 줄바꿈 문자 없음) |
--- run_image_anal_backend.sh
+++ run_image_anal_backend.sh
... | ... | @@ -6,26 +6,33 @@ |
6 | 6 |
PYTHONPATH="/home/juni/PycharmProjects/segmentation_overlapping" |
7 | 7 |
|
8 | 8 |
# Start multiple Python processes in the background |
9 |
-python streaming_process.py --cctv_num 0 & |
|
10 |
-pids+=($!) |
|
11 |
-sleep 1 |
|
12 |
-python streaming_process.py --cctv_num 1 & |
|
13 |
-pids+=($!) |
|
14 |
-sleep 1 |
|
9 |
+#python streaming_process.py --cctv_num 0 & |
|
10 |
+#pids+=($!) |
|
11 |
+#sleep 5 |
|
12 |
+#python streaming_process.py --cctv_num 1 & |
|
13 |
+#pids+=($!) |
|
14 |
+#sleep 5 |
|
15 | 15 |
python streaming_process.py --cctv_num 2 & |
16 | 16 |
pids+=($!) |
17 |
-sleep 1 |
|
18 |
-python streaming_process.py --cctv_num 3 & |
|
17 |
+sleep 5 |
|
18 |
+#python streaming_process.py --cctv_num 3 & |
|
19 |
+#pids+=($!) |
|
20 |
+#sleep 30 |
|
21 |
+#python streaming_process.py --cctv_num 4 & |
|
22 |
+#pids+=($!) |
|
23 |
+#sleep 30 |
|
24 |
+python streaming_process.py --cctv_num 14 & |
|
19 | 25 |
pids+=($!) |
20 | 26 |
sleep 1 |
21 |
-python streaming_process.py --cctv_num 4 & |
|
22 |
-pids+=($!) |
|
23 |
-sleep 1 |
|
24 |
-python streaming_process.py --cctv_num 5 & |
|
25 |
-pids+=($!) |
|
26 |
-sleep 1 |
|
27 |
-python streaming_process.py --cctv_num 6 & |
|
28 |
-pids+=($!) |
|
27 |
+#python streaming_process.py --cctv_num 15 & |
|
28 |
+#pids+=($!) |
|
29 |
+#sleep 1 |
|
30 |
+#python streaming_process.py --cctv_num 8 & |
|
31 |
+#pids+=($!) |
|
32 |
+#sleep 30 |
|
33 |
+#python streaming_process.py --cctv_num 13 & |
|
34 |
+#pids+=($!) |
|
35 |
+ |
|
29 | 36 |
|
30 | 37 |
#python test.py |
31 | 38 |
#python inference_endpoint.py |
--- streaming_process.py
+++ streaming_process.py
... | ... | @@ -17,6 +17,7 @@ |
17 | 17 |
xmax=lat + lat_lon_interval, ymax=lon + lat_lon_interval, |
18 | 18 |
intervals=1, roadType="its", cctvType=1 |
19 | 19 |
) |
20 |
+ print(api_result.loc[0]["cctvurl"]) |
|
20 | 21 |
return api_result.loc[0]["cctvurl"] |
21 | 22 |
|
22 | 23 |
args = argparse.ArgumentParser() |
... | ... | @@ -39,6 +40,7 @@ |
39 | 40 |
|
40 | 41 |
cctv_info = pd.read_csv("config_files/cctv_list.csv") |
41 | 42 |
cctv_info = cctv_info.iloc[cctv_ind] |
43 |
+ print(cctv_info) |
|
42 | 44 |
|
43 | 45 |
lat = cctv_info["coordx"] |
44 | 46 |
lon = cctv_info["coordy"] |
+++ streaming_process_flood_demonstration.py
... | ... | @@ -0,0 +1,66 @@ |
1 | +# This script only works if this is the main process. | |
2 | +# This script must be executed with bash script that is located in the root directory of this project | |
3 | +# This is by design, and is a way to circumvent GIL of python, because the server needs to handle multiple video streaming at once. | |
4 | + | |
5 | +if __name__ == "__main__": | |
6 | + from ITS.api import gather_cctv_list | |
7 | + from hls_streaming.hls import FrameCapturer | |
8 | + | |
9 | + import argparse | |
10 | + import pandas as pd | |
11 | + import time | |
12 | + | |
13 | + | |
14 | + def refresh_hls_address(lat, lon, lat_lon_interval=0.0001): | |
15 | + api_result = gather_cctv_list( | |
16 | + xmin=lat - lat_lon_interval, ymin=lon - lat_lon_interval, | |
17 | + xmax=lat + lat_lon_interval, ymax=lon + lat_lon_interval, | |
18 | + intervals=1, roadType="its", cctvType=1 | |
19 | + ) | |
20 | + print(api_result.loc[0]["cctvurl"]) | |
21 | + return api_result.loc[0]["cctvurl"] | |
22 | + | |
23 | + args = argparse.ArgumentParser() | |
24 | + args.add_argument("--cctv_num", type=int, | |
25 | + help="Index number of cctv, to view or edit the list of cctv, see cctv_list.csv") | |
26 | + args.add_argument("--interval", type=float, default=5, | |
27 | + help="Interval of frame extract of the process, unit is second, default is 5 seconds") | |
28 | + args.add_argument("--video_buffer", type=float, default=15, | |
29 | + help="How may seconds of video frame buffer will be there, " | |
30 | + "default value is 15 seconds, which matches ITS video streaming packet response interval") | |
31 | + | |
32 | + args = args.parse_args() | |
33 | + | |
34 | + # This is a must, because if you refer to variables inside args directly, | |
35 | + # when ERROR happens out of that variables or related, python can not | |
36 | + # direct you to where it happens and instead unintelligible garbage | |
37 | + cctv_ind = args.cctv_num | |
38 | + frame_extract_interval = args.interval | |
39 | + video_buffer = args.video_buffer | |
40 | + | |
41 | + cctv_info = pd.read_csv("config_files/cctv_list.csv") | |
42 | + cctv_info = cctv_info.iloc[cctv_ind] | |
43 | + print(cctv_info) | |
44 | + | |
45 | + | |
46 | + lat = 37.127277 | |
47 | + lon = 127.067114 | |
48 | + name = "[국도1] 평택 갈곶리삼거리" | |
49 | + if name.find("국도"): | |
50 | + roadtype = 'its' | |
51 | + else: | |
52 | + roadtype = 'ex' | |
53 | + | |
54 | + # initiate ITS CCTV streaming via hls | |
55 | + while True: | |
56 | + | |
57 | + # cctv_url = refresh_hls_address(lat, lon, ) | |
58 | + cctv_url = "http://takensofttesting.iptime.org:54127/hls/playlist.m3u8" | |
59 | + print(name) | |
60 | + hls_streaming = FrameCapturer(cctv_url, name, lat, lon, frame_extract_interval, video_buffer, 300, "Asia/Seoul", | |
61 | + endpoint= "http://localhost:12345/cctv/infer") | |
62 | + hls_streaming.start() | |
63 | + | |
64 | + time.sleep(60000) | |
65 | + | |
66 | + hls_streaming.stop() |
--- streaming_url_updator.py
+++ streaming_url_updator.py
... | ... | @@ -11,7 +11,7 @@ |
11 | 11 |
from apscheduler.triggers.interval import IntervalTrigger |
12 | 12 |
|
13 | 13 |
|
14 |
-API_ENDPOINT = "http://165.229.169.148:8080/EquipmentUrlChanger.json" |
|
14 |
+API_ENDPOINT = "http://165.229.169.113:30213/EquipmentUrlChanger.json" |
|
15 | 15 |
|
16 | 16 |
app = Flask(__name__) |
17 | 17 |
print("ITS API Updater START") |
... | ... | @@ -52,6 +52,8 @@ |
52 | 52 |
#, ensure_ascii=False) # the server in question is not using UTF-8, change it when it does. |
53 | 53 |
response = requests.post(API_ENDPOINT, headers=headers, data=payload) |
54 | 54 |
print_request(response) |
55 |
+ print("new url sented!") |
|
56 |
+ |
|
55 | 57 |
|
56 | 58 |
url_list_sender() |
57 | 59 |
scheduler = BackgroundScheduler() |
--- testing.html
+++ testing.html
... | ... | @@ -7,9 +7,6 @@ |
7 | 7 |
<style> |
8 | 8 |
body { |
9 | 9 |
font-family: Arial, sans-serif; |
10 |
- display: flex; |
|
11 |
- flex-direction: column; |
|
12 |
- height: 100vh; |
|
13 | 10 |
margin: 0; |
14 | 11 |
} |
15 | 12 |
.header { |
... | ... | @@ -22,29 +19,36 @@ |
22 | 19 |
top: 0; |
23 | 20 |
z-index: 1; |
24 | 21 |
} |
22 |
+ #buttonContainer { |
|
23 |
+ position: fixed; |
|
24 |
+ top: 105px; /* Just below the header */ |
|
25 |
+ width: 100%; |
|
26 |
+ display: flex; |
|
27 |
+ justify-content: center; |
|
28 |
+ z-index: 2; /* Ensure it appears above other content */ |
|
29 |
+ background-color: white; /* Make the background white to cover content when scrolling */ |
|
30 |
+ padding: 10px; |
|
31 |
+ } |
|
32 |
+ #processButton, #clearButton, #imageInput { |
|
33 |
+ background-color: #1E4E90; |
|
34 |
+ color: white; |
|
35 |
+ border: none; |
|
36 |
+ padding: 10px 20px; |
|
37 |
+ font-size: 16px; |
|
38 |
+ cursor: pointer; |
|
39 |
+ margin: 0 10px; /* Add margin between buttons */ |
|
40 |
+ } |
|
41 |
+ #processButton:hover, #clearButton:hover { |
|
42 |
+ background-color: #163a6e; |
|
43 |
+ } |
|
25 | 44 |
.container { |
26 | 45 |
text-align: center; |
27 |
- margin-top: 100px; /* .header의 높이 만큼 여백 추가 */ |
|
46 |
+ margin-top: 150px; /* Add margin to push content below the fixed buttons */ |
|
28 | 47 |
} |
29 | 48 |
#preview img { |
30 | 49 |
max-width: 100%; |
31 | 50 |
height: auto; |
32 | 51 |
margin-top: 20px; |
33 |
- } |
|
34 |
- #processButton { |
|
35 |
- background-color: #1E4E90; |
|
36 |
- color: white; |
|
37 |
- border: none; |
|
38 |
- padding: 10px 20px; |
|
39 |
- text-align: center; |
|
40 |
- text-decoration: none; |
|
41 |
- display: inline-block; |
|
42 |
- font-size: 16px; |
|
43 |
- margin-top: 20px; |
|
44 |
- cursor: pointer; |
|
45 |
- } |
|
46 |
- #processButton:hover { |
|
47 |
- background-color: #1E4E90; |
|
48 | 52 |
} |
49 | 53 |
#copyright { |
50 | 54 |
background-color: #f1f1f1; |
... | ... | @@ -59,8 +63,8 @@ |
59 | 63 |
justify-content: center; |
60 | 64 |
height: 100vh; |
61 | 65 |
} |
62 |
- #messageContainer div{ |
|
63 |
- margin-top:30px; |
|
66 |
+ #messageContainer div { |
|
67 |
+ margin-top: 30px; |
|
64 | 68 |
} |
65 | 69 |
</style> |
66 | 70 |
</head> |
... | ... | @@ -68,12 +72,17 @@ |
68 | 72 |
<div class="header"> |
69 | 73 |
<h1>침수감지모델 테스트도구</h1> |
70 | 74 |
</div> |
71 |
- <div class="container"> |
|
72 |
- <div id="preview"></div> |
|
75 |
+ |
|
76 |
+ <!-- Button Container (file input, process, clear) --> |
|
77 |
+ <div id="buttonContainer"> |
|
73 | 78 |
<input type="file" id="imageInput"> |
74 | 79 |
<button id="processButton">이미지 처리</button> |
75 |
- <button id="clearButton">Clear</button> <!-- Clear 버튼 추가 --> |
|
80 |
+ <button id="clearButton">Clear</button> |
|
81 |
+ </div> |
|
76 | 82 |
|
83 |
+ <!-- Content Area --> |
|
84 |
+ <div class="container"> |
|
85 |
+ <div id="preview"></div> |
|
77 | 86 |
</div> |
78 | 87 |
<div id="messageContainer"></div> |
79 | 88 |
|
... | ... | @@ -85,36 +94,32 @@ |
85 | 94 |
const fileInput = document.getElementById('imageInput'); |
86 | 95 |
const processButton = document.getElementById('processButton'); |
87 | 96 |
const preview = document.getElementById('preview'); |
88 |
- const messageContainer = document.getElementById('messageContainer'); // 메시지를 담을 컨테이너 추가 |
|
97 |
+ const messageContainer = document.getElementById('messageContainer'); |
|
98 |
+ const clearButton = document.getElementById('clearButton'); |
|
89 | 99 |
|
90 | 100 |
clearButton.addEventListener('click', function() { |
91 |
- // 메시지 컨테이너의 내용을 비움 |
|
92 | 101 |
preview.innerHTML = ''; |
93 | 102 |
messageContainer.innerHTML = ''; |
94 | 103 |
}); |
104 |
+ |
|
95 | 105 |
fileInput.addEventListener('change', function(event) { |
96 | 106 |
const file = event.target.files[0]; |
97 | 107 |
const reader = new FileReader(); |
98 | 108 |
|
99 | 109 |
reader.onloadend = function() { |
100 |
- // 이미지 미리보기를 생성하여 화면에 표시 |
|
101 | 110 |
const img = new Image(); |
102 | 111 |
img.src = reader.result; |
103 |
- img.style.width = '1080px'; // 미리보기 이미지의 너비 조절 |
|
104 |
- preview.innerHTML = ''; // 이전 미리보기 삭제 |
|
105 |
- preview.appendChild(img); // 새로운 미리보기 추가 |
|
112 |
+ img.style.width = '1080px'; |
|
113 |
+ preview.innerHTML = ''; |
|
114 |
+ preview.appendChild(img); |
|
106 | 115 |
|
107 |
- // 파일 정보를 기반으로 FormData를 생성하여 서버에 전송할 준비 |
|
108 | 116 |
const formData = new FormData(); |
109 |
- formData.append('file', file); // 이미지 파일을 FormData에 추가 |
|
117 |
+ formData.append('file', file); |
|
110 | 118 |
|
111 |
- const LAT = "36.123"; // Replace with the actual latitude value |
|
112 |
- const LON = "123.123"; // Replace with the actual longitude value |
|
113 |
- const FILENAME = file.name; // Use the selected file's name as the filename |
|
114 |
- const FILE_TYPE = file.type; // Use the selected file's type as the file type |
|
115 |
- |
|
116 |
- // 여기서 formData와 FILENAME, FILE_TYPE을 이용하여 서버에 요청을 보내면 됩니다. |
|
117 |
- // ... |
|
119 |
+ const LAT = "36.123"; |
|
120 |
+ const LON = "123.123"; |
|
121 |
+ const FILENAME = file.name; |
|
122 |
+ const FILE_TYPE = file.type; |
|
118 | 123 |
}; |
119 | 124 |
|
120 | 125 |
if (file) { |
... | ... | @@ -126,44 +131,22 @@ |
126 | 131 |
const file = fileInput.files[0]; |
127 | 132 |
|
128 | 133 |
if (file) { |
129 |
- |
|
130 |
- const LAT = "36.123"; // Replace with the actual latitude value |
|
131 |
- const LON = "123.123"; // Replace with the actual longitude value |
|
132 |
- const FILENAME = file.name; // Use the selected file's name as the filename |
|
133 |
- const FILE_TYPE = file.type; // Use the selected file's type as the file type |
|
134 |
+ const LAT = "36.123"; |
|
135 |
+ const LON = "123.123"; |
|
136 |
+ const FILENAME = file.name; |
|
137 |
+ const FILE_TYPE = file.type; |
|
134 | 138 |
const formData = new FormData(); |
135 | 139 |
formData.append("data", JSON.stringify({ gps_x: LAT, gps_y: LON, filename: FILENAME, file_type: FILE_TYPE })); |
136 | 140 |
const previewBlob = await fetch(preview.querySelector('img').src).then(res => res.blob()); |
137 |
- formData.append('file', previewBlob, FILENAME); // Blob 객체와 원래 파일 이름을 전송 |
|
138 |
- |
|
139 |
- |
|
141 |
+ formData.append('file', previewBlob, FILENAME); |
|
140 | 142 |
|
141 | 143 |
try { |
142 |
- const URL = "http://127.0.0.1:12345/cctv/infer"; // Replace with the actual server URL |
|
144 |
+ const URL = "http://127.0.0.1:12345/cctv/infer"; |
|
143 | 145 |
const response = await fetch(URL, { |
144 | 146 |
method: "POST", |
145 | 147 |
body: formData |
146 | 148 |
}); |
147 |
- |
|
148 |
- if (response.ok) { |
|
149 |
- const data = await response.json(); |
|
150 |
- console.log(data); // 서버에서 받은 응답 처리 |
|
151 |
- |
|
152 |
- // data 객체에서 rain이 true인 경우 메시지 표시 |
|
153 |
- if (data.rain === true) { |
|
154 |
- const message = document.createElement('div'); |
|
155 |
- message.textContent = '비 사진 감지되었습니다.'; |
|
156 |
- messageContainer.innerHTML = ''; // 기존 메시지 삭제 |
|
157 |
- messageContainer.appendChild(message); // 새로운 메시지 추가 |
|
158 |
- } else { |
|
159 |
- const message = document.createElement('div'); |
|
160 |
- message.textContent = '일반 사진 감지되었습니다.'; |
|
161 |
- messageContainer.innerHTML = ''; // 기존 메시지 삭제 |
|
162 |
- messageContainer.appendChild(message); // 새로운 메시지 추가 |
|
163 |
- } |
|
164 |
- } else { |
|
165 |
- console.error("Error occurred while sending the request:", response.statusText); |
|
166 |
- } |
|
149 |
+ |
|
167 | 150 |
} catch (error) { |
168 | 151 |
console.error("Error occurred:", error); |
169 | 152 |
} |
... | ... | @@ -171,8 +154,6 @@ |
171 | 154 |
console.error("No file selected."); |
172 | 155 |
} |
173 | 156 |
}); |
174 |
- |
|
175 |
- |
|
176 | 157 |
</script> |
177 | 158 |
</body> |
178 |
-</html>(파일 끝에 줄바꿈 문자 없음) |
|
159 |
+</html> |
--- yoloseg/inference_gpu_.py
+++ yoloseg/inference_gpu_.py
... | ... | @@ -378,8 +378,8 @@ |
378 | 378 |
# Show the processed frame |
379 | 379 |
# cv2.imshow('Processed Frame', resized_frame) |
380 | 380 |
# # Save the processed frame |
381 |
- # output_frame_path = os.path.join(output_dir, f"frame_{frame_count}.jpg") |
|
382 |
- # cv2.imwrite(output_frame_path, resized_frame) |
|
381 |
+ output_frame_path = os.path.join(output_dir, f"frame_{frame_count}.jpg") |
|
382 |
+ cv2.imwrite(output_frame_path, resized_frame) |
|
383 | 383 |
|
384 | 384 |
t2 = time.time() |
385 | 385 |
frame_time = t2 - t1 |
... | ... | @@ -411,4 +411,4 @@ |
411 | 411 |
if __name__ == "__main__": |
412 | 412 |
# test() |
413 | 413 |
|
414 |
- process_video("/home/juni/사진/flood/test_video.mp4", "./")(파일 끝에 줄바꿈 문자 없음) |
|
414 |
+ process_video("/home/juni/사진/flood/test_video.mp4", "/home/juni/사진/flood/infer/")(파일 끝에 줄바꿈 문자 없음) |
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?