45 lines
2.4 KiB
Python
45 lines
2.4 KiB
Python
#进入线程先把标志位置为True
|
|
# from System_I import Detection
|
|
# import os,torch
|
|
# os.environ['CUDA_VISIBLE_DEVICES'] = '1'
|
|
# devices = torch.device('cuda:0' if torch.cuda.is_available() else 'cpu')
|
|
# root = "/home/wanghc/output"
|
|
import os,torch, threading,argparse
|
|
class global_para():
|
|
parser1 = argparse.ArgumentParser(description="GYD")
|
|
parser1.add_argument("video_num", default='0001', type=str,
|
|
help='Video name.')
|
|
parser1.add_argument("GPU", default='5', type=str,
|
|
help='GPU.')
|
|
parser1.add_argument("thresh", default=0.6, type=float,
|
|
help='GPU.')
|
|
parser1.add_argument("red", default=0, type=int,
|
|
help='red.')
|
|
|
|
args = parser1.parse_args()
|
|
print(args)
|
|
red_flag = args.red
|
|
detect_thresh = args.thresh
|
|
is_ex_bird = False # 目标检测标志位,每个一秒检测一次目标检测,如果有鸟,则置为True,为True的时候说明, 处理30s的线程还在继续,直到标志位变为了False再开启新的线程
|
|
Density_thread_flag = False # 密度估计线程标志位,为True说明开启了密度估计线程,处理完750帧为止,标志位标为False,
|
|
Detection_thread_flag = False # 目标检测和细粒度识别线程标志位,为True说明开启了密度估计线程,处理完750帧为止,标志位标为False,
|
|
Vedio_thread_flag = False # 存储视频线程标志位,存储30s
|
|
SaveImage_thread_flag = False # 保存原图线程标志位,存储30张原图
|
|
ALL_thread_flag = False # 所有线程的标志位,单独开设一个线程,监控所有线程是否都结束,如果都结束,则置为False,后续添加线程管理,可以放在这里面
|
|
|
|
DebugPrint_flag = True # 打印标志位
|
|
|
|
destory_image = False
|
|
Camera_device = args.video_num # 摄像头编号,0001
|
|
image_time = None # 当前处理的30视频的编号
|
|
ImgDealQueue = [] # 750帧视频,缓存空间
|
|
root = "/data/Hatcher/output2"
|
|
#os.environ['CUDA_VISIBLE_DEVICES'] = '0'
|
|
os.environ['CUDA_VISIBLE_DEVICES'] = args.GPU
|
|
devices = torch.device('cuda:0' if torch.cuda.is_available() else 'cpu')
|
|
#event = threading.Event()
|
|
eventDensity = threading.Event()
|
|
eventDetection = threading.Event()
|
|
eventSaveimage = threading.Event()
|
|
# Detection2 = Detection(devices,root)
|