git clone https://github.com/AlvinFok/TraceTalk.git
cd TraceTalk
git clone https://github.com/AlexeyAB/darknet.git
git clone https://github.com/ifzhang/ByteTrack.git
進入darknet
資料夾,並根據本身電腦環境,編輯Makefile
檔案
參考:
GPU=1
CUDNN=1
CUDNN_HALF=1
OPENCV=1
AVX=0
OPENMP=0
LIBSO=1
ZED_CAMERA=0
ZED_CAMERA_v2_8=0
接著進行編譯
make
可先自行安裝python虛擬環境
依ByteTrack 指示安裝ByteTrack
yolox 版本使用
bytetrack_x_mot17.pth.tar
pip install -r requirements.txt
python3 test_BYTE_YOLOX.py --video 0325__12__1.mp4 -f ByteTrack/exps/example/mot/yolox_x_mix_det.py
-c ByteTrack/pretrained/bytetrack_x_mot17.pth.tar --fp16 --fuse
執行完成後,會自動產生demo資料夾,儲存辨識結果
numpy>=1.20
到以下位置把np.float->float
ByteTrack/yolox/tracker/byte_tracker.py
ByteTrack/yolox/tracker/matching.py
YoloTalk 提供許多參數可供設置。 修改YoloDevice物件內的參數,以符合自己的需求。
編輯 main.py
config_file
(string): config 檔案路徑data_file
(string): data 檔案路徑weights_file
(string): weight 檔案路徑output_dir
(string): 輸出結果的路徑 (若路徑不存在,則會自動建立)thresh
(int): 辨識靈敏度 (範圍 0~100)video_url
(string): 欲辨識的影像 (影片路徑或串流影像網址)is_threading
(bool): 若為影片,則設為 False; 若為即時串流影像,則設為 Truevertex
(list or None): 若欲辨識特定範圍,則輸入辨識位置,如 [(0,0),(100,0),(100,100),(0,100)]。若欲辨識全部範圍,則設為 Nonetarget_classes
(list or None): 若欲辨識特定的class名稱,則設置 如 ["person"]。若欲辨識全部class,則設為 None (設為None,開啟obj_trace暫時有bug)alias
(string):設置此影片的別名 (為辨識結果資料夾及影片命名)display_message
(bool): 若欲於 Terminal 顯示相關資訊,則設為 True,否則設為 Falseobj_trace
(bool): 若欲開啟物件追蹤,則設為 True,並於 on_data() 回傳 id 名稱。否則為 False。save_img
(bool): 若欲將辨識結果存成照片,則設 True。否則設 Falsesave_video
(bool): 若欲將辨識結果存成影像,則設為True。否則設為 Falseauto_restart
(bool): 若當無法讀取串流影像時,想自動重新啟動程式,則設為True。否則設為False。
tools/track2txt.py
python3 tools/track2txt.py -f ByteTrack/exps/example/mot/yolox_x_mix_det.py -c ByteTrack/pretrained/bytetrack_x_mot17.pth.tar --fp16 --fuse --path video --savePath .
tools/track2txtParllal.py
python3 tools/track2txtParllal.py --videos videoFolder --savePath txtFolder --thread n
tools/test_BYTE_YOLOX.py
python3 tools/test_BYTE_YOLOX.py --video video -f ByteTrack/exps/example/mot/yolox_x_mix_det.py -c ByteTrack/pretrained/bytetrack_x_mot17.pth.tar --fp16 --f
use --txt --txtFile txtFile --exp exp_name
tools/testParllal_BYTE_YOLOX.py
python3 tools/testParllal_BYTE_YOLOX.py --videoFolder videoFolder --txt --txtFolder txtFolder --thread n --exp exp_name
SFDB-I : list of bboxes in Json format[class, score, (x, y, w, h)]
Trace-I : list of bboxes with ID in Json format[class, score, (x, y, w, h), id]
Chose the IDF you need, you can detect more than one object ( take yPerson-I for example ).
IoTtalk GUI connection example:
![](https://i.imgur.com/ot3qVwn.png =70%x)
-
Use your LINE account to sign in LINE Notify. 點選 Generate token
-
Set token name and chose the chat group which will get message from LINE Notify.
-
Make sure to remember the access token.
-
vim LineNotify.py
past the token intoken_key = ''
修改以下對應參數
ServerURL = 'https://edgecore.iottalk.tw' # set the url to your own iottalk server
Reg_addr = '555642434' # if None, Reg_addr = MAC address
DAN.profile['dm_name']='Yolo_Device'
DAN.profile['df_list']=['yPerson-I',]
DAN.profile['d_name']= 'YOLOjim'
DAN.device_registration_with_retry(ServerURL, Reg_addr)
#DAN.deregister() # if you want to deregister this device, uncomment this line
#exit() # if you want to deregister this device, uncomment this line
若編譯darknet時遇到以下錯誤,可能是cuda版本與新版本daeknet不相容
./src/network_kernels.cu(721): error: identifier "cudaStreamCaptureModeGlobal" is undefined
./src/network_kernels.cu(721): error: too many arguments in function call
2 errors detected in the compilation of "/tmp/tmpxft_0019d7fa_00000000-10_network_kernels.compute_70.cpp1.ii".
Makefile:185: recipe for target 'obj/network_kernels.o' failed
make: *** [obj/network_kernels.o] Error 1
編輯src/network_kernels.cu
,註解CHECK_CUDA(cudaStreamBeginCapture(stream0, cudaStreamCaptureModeGlobal));
(約在721行),並執行以下指令,重新編譯 darknet
make clean
make
${dateTime}__${getIn}__${current}.mkv