Page 505 - 2020학년도 MDP과제발표회 자료집 (통신과) (3)
P. 505
output[:, [1, 3]] *= frame.shape[1]
output[:, [2, 4]] *= frame.shape[0]
self.classes = load_classes('data/coco.names')
self.colors = pkl.load(open("pallete", "rb"))
list(map(lambda x: self.write(x, orig_im), output))
#cv2.imshow("frame", orig_im)
key = cv2.waitKey(1)
if key & 0xFF == ord('q'):
break
print("Time = {:5.2f}[sec]".format(time.time() - start))
####
if self.label_list.count(self.detect_object) >= 1:
print(">> "+self.detect_object+" is detected")
del self.label_list[:] # 리스트를 초기화 해줍니다
return "y"
else:
print(">> "+self.detect_object+" is not detected")
del self.label_list[:] # 리스트를 초기화 해줍니다
return "n"
####
else:
break
if __name__ == '__main__':
detect = PytorchYolo("http://192.168.0.54:8409/?action=snapshot", "dog")
#detect = PytorchYolo(0, "dog")
for i in range(0, 10):
print(str(i+1) + " : " + detect.yolov3())
2) 소켓 main.py
• 소켓 수신
인천전자마이스터고등학교
- 527 - 정보통신기기과 527