first
This commit is contained in:
1 parent
54ccfb11fe
commit
a0818377bb
194 files changed
+41681
-262
No files matched your search
@@ -1,4 +1,4 @@
|
||||
#进入线程先把标志位置为True
|
||||
#½øÈëÏß³ÌÏȰѱê־λÖÃΪTrue
|
||||
# from System_I import Detection
|
||||
# import os,torch
|
||||
# os.environ['CUDA_VISIBLE_DEVICES'] = '1'
|
||||
@@ -6,39 +6,114 @@
|
||||
# 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,
|
||||
#check()
|
||||
parser1 = argparse.ArgumentParser(description="CUI")
|
||||
parser1.add_argument("--video_num", default='/data1/Hatcher/model/project/data_MPKFNet/rawdata/PYH-DEMO.mp4', type=str,
|
||||
help='Video name.')
|
||||
parser1.add_argument("GPU", default='5', type=str,
|
||||
parser1.add_argument("--GPU", default='6', type=str,
|
||||
help='GPU.')
|
||||
parser1.add_argument("thresh", default=0.6, type=float,
|
||||
parser1.add_argument("--thresh", default=0.4, type=float,
|
||||
help='GPU.')
|
||||
parser1.add_argument("red", default=0, type=int,
|
||||
parser1.add_argument("--red", default=0, type=int,
|
||||
help='red.')
|
||||
parser1.add_argument("--add", default=0, type=str,
|
||||
help='add.')
|
||||
|
||||
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'
|
||||
#print(args)
|
||||
root = "/home/gyd/output1"
|
||||
# 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')
|
||||
camera_address = args.add
|
||||
VideoPath = args.video_num
|
||||
red_flag = args.red
|
||||
detect_thresh = args.thresh
|
||||
|
||||
#fine_thresh2 = torch.tensor(fine_thresh2).cuda()
|
||||
birdIndex = 99999
|
||||
#birdIndex = torch.tensor(birdIndex).cuda()
|
||||
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£¬ºóÐøÌí¼ÓÏ̹߳ÜÀí£¬¿ÉÒÔ·ÅÔÚÕâÀïÃæ
|
||||
|
||||
ShowAllNumFlag = False
|
||||
|
||||
|
||||
DebugPrint_flag = False # ´òÓ¡±ê־λ
|
||||
Species = torch.zeros(8).cuda()
|
||||
num_count_old =0
|
||||
boxes_fine = None
|
||||
labels_fine = None
|
||||
|
||||
showThresh = 25
|
||||
destory_image = False
|
||||
Camera_device = args.video_num # ÉãÏñÍ·±àºÅ£¬0001
|
||||
image_time = None # µ±Ç°´¦ÀíµÄ30ÊÓÆµµÄ±àºÅ
|
||||
ImgDealQueue = [] # 750Ö¡ÊÓÆµ£¬»º´æ¿Õ¼ä
|
||||
img_show = None
|
||||
|
||||
|
||||
#event = threading.Event()
|
||||
eventDensity = threading.Event()
|
||||
eventDetection = threading.Event()
|
||||
eventSaveimage = threading.Event()
|
||||
max_age = 2
|
||||
min_hits = 3
|
||||
sortiou_threshold = 0.3
|
||||
Finerestartboxes = []
|
||||
IndexMax = 0
|
||||
radioShowX = 2560.0
|
||||
radioShowY = 1440.0
|
||||
radioShowtext = radioShowX
|
||||
SortLabel_Index = None #±êÇ©ºÍË÷Òý¶ÔÓ¦¹ØÏµ[[4,1],[3,2]]
|
||||
SortLabel_Indexpre = [] #±êÇ©ºÍË÷ÒýµÄ¶ÔÓ¦¹ØÏµ£¬ÓÃÔÚ×·×Ù¹ý³ÌÖÐгöÏÖµÄÄ¿±ê£¬[[label,Index,Count]]
|
||||
# Detection2 = Detection(devices,root)
|
||||
FineCountThresh = 5
|
||||
|
||||
img_show = None
|
||||
|
||||
Fine_thresh = 0.4
|
||||
|
||||
# DetWeight = "/data1/Hatcher/model/Detection/yolov5/runs/train/exp21/weights/best.pt"
|
||||
# FineWeight = "/data/Hatcher/data/weigth/areaproject/resnet50-PYH-3-20.7/_42522_PYH-3/best.pth"
|
||||
DetWeight = "/data1/Hatcher/model/Detection/yolov5/runs/train/KunMingCuiHu-Fish2/weights/best.pt"
|
||||
FineWeight = "/data/Hatcher/data/weigth/areaproject/resnet50-DianChiFish-3-3-0.7/_4289_DianChiFish-4/best.pth"
|
||||
# DetWeight = "/data1/Hatcher/model/Detection/yolov5/runs/train/BeijingCuiHu-Bird26/weights/best.pt"
|
||||
# FineWeight = "/data/Hatcher/data/weigth/areaproject/resnet50-cui90_1model0.7/_42111_CUI-94-1/best.pth"
|
||||
# BHG_chineseName = ["kong", '白鹤', '白头鹤','白枕鹤']#["kong","鲫鱼","麦穗鱼","鳑鲏"]
|
||||
BHG_chineseName = ["kong","鲫鱼","麦穗鱼","鳑鲏"]
|
||||
|
||||
# BHG_chineseName = ['Kong', '白额雁', '白骨顶', '苍鹭', '苍鹭', '白秋沙鸭', '白腰草鹬', '斑头雁', '斑嘴鸭', '苍鹭', '赤膀鸭', '赤颈鸭', '苍鹭', '大麻鳽',
|
||||
# '豆雁', '反嘴鹬', '凤头鸊鷉', '凤头麦鸡', '凤头潜鸭', '黑鹳', '黑水鸡', '红嘴鸥', '鸿雁', '灰鹤', '灰雁', '绿翅鸭', '绿头鸭', '琵嘴鸭',
|
||||
# '普通鸬鹚', '普通秋沙鸭', '翘鼻麻鸭', '鹊鸭', '扇尾沙锥', '小白额雁', '小天鹅', '针尾鸭', '苍鹭', '暗绿绣眼鸟', '八哥', '白腹鹞', '白鹡鸰',
|
||||
# '白眼潜鸭', '草鹭', '池鹭', '戴胜', '黑翅长脚鹬', '黑鸢', '红隼', '花脸鸭', '环颈雉', '灰头绿啄木鸟', '灰头麦鸡', '矶鹬', '栗苇鳽',
|
||||
# '罗纹鸭', '牛背鹭', '普通翠鸟', '雀鹰', '喜鹊', '苍鹭', '鸳鸯', '棕背伯劳', '红胸秋沙鸭', '普通燕鸥', '小白额燕鸥', '丘鹬', '凤头蜂鹰',
|
||||
# '大天鹅', '大鸨', '小田鸡', '山斑鸠', '帆背潜鸭', '日本松雀鹰', '普通鵟', '松雀鹰', '毛脚鵟', '灰斑鸠', '白头鹞', '白尾鹞', '白眉鸭',
|
||||
# '白鹈鹕', '红头潜鸭', '苍鹰', '蒙古银鸥', '西方秧鸡', '赤嘴潜鸭', '阔嘴鹬', '雕鸮', '鹌鹑', '鹗', '黄苇鳽', '黑颈鹤', '小䴙䴘', '赤麻鸭']
|
||||
# BHG_chineseName =["kong","绿头鸭","斑嘴鸭","灰雁","鸿雁","kong","小鷿鷈"]
|
||||
spiec_number_old = [0 for i in range(len(BHG_chineseName))]
|
||||
FineClassNum = 4
|
||||
color_show = (255, 255, 255)
|
||||
color_box = (255, 0, 0)
|
||||
NoneLabel = "鱼" # "鹤类"
|
||||
fine_thresh1 = 6000
|
||||
fine_thresh2 = 10000
|
||||
fontScale = 1
|
||||
"""
|
||||
1.change weight
|
||||
2.change BHG_chineseName
|
||||
3.change FineClassNum
|
||||
4.change color_box (0, 115, 51)green (255, 0, 0) red
|
||||
5.change parser1
|
||||
6.change NoneLabel
|
||||
7. change main
|
||||
8. change fine_thresh2
|
||||
9. GPU
|
||||
fontScale plot file para to adjust chinese 400W ---2
|
||||
200W ---1
|
||||
800W ---3
|
||||
"""
|
||||
Reference in new issue
Block a user