Page 503 - 2020학년도 MDP과제발표회 자료집 (통신과) (3)
P. 503

def  yolov3(self):
                             cfgfile  =  "cfg/yolov3.cfg"    #  config 파일  선언
                             weightsfile  =  "yolov3.weights"    #  weight 파일  선언
                             num_classes  =  80    #  class 개수  정의


                             args  =  self.arg_parse()    #  argparse 를  이용해  명령행을  파싱해오도록  함수  실행
                             confidence  =  float(args.confidence)    #  confidence  변수에  --confidence 값을  할당
                             nms_thesh  =  float(args.nms_thresh)
                             start  =  0    #  start 는  0
                             CUDA  =  torch.cuda.is_available()    #  cuda 가  사용가능한  상황인지


                             num_classes  =  80    #  암튼  80
                             bbox_attrs  =  5  +  num_classes    #  Bouding  Box  속성


                             model  =  Darknet(cfgfile)    #  Darknet
                             model.load_weights(weightsfile)    #  Model 에  weighs 파일을  load 해준다


                             model.net_info["height"]  =  args.reso
                             inp_dim  =  int(model.net_info["height"])


                             assert  inp_dim  %  32  ==  0
                             assert  inp_dim  >  32
                             '''
                             if  CUDA:
                                     model.cuda()    #  Cuda 를  사용중이면  model.cuda()
                             '''
                             model.eval()    #  모델  평가?


                             #  cap  =  cv2.VideoCapture(0)                                              #videoCapture(0)  >>  video  캡쳐변수
             선언
                             cap  =  cv2.VideoCapture(self.web_address)
                             #  videoCapture(" 주소")  >>  video  캡쳐변수  선언


                             assert  cap.isOpened(),  'Cannot  capture  source'
                             #  assert 는  가정설정문 뒤의  조건이 ,   True 가  아니면  AssertError 를  발생시킨다.





















                                                                                      인천전자마이스터고등학교
                                                         -  525  -                       정보통신기기과         525
   498   499   500   501   502   503   504   505   506   507   508