from zedstreamer import ZedCamera if __name__ == '__main__': data = parse_data("data/tennisball.data") CUDA = torch.cuda.is_available() and data["use_cuda"] device = torch.device("cuda" if CUDA else "cpu") confidence = float(data["confidence"]) nmsThresh = float(data["nms_thresh"]) # FIXME: Change this to match number of classes in names file # AND change the network's yolo layers to match numClasses = 80 classes = loadClasses("names/coco.names") model = Darknet("cfg/yolov3.cfg") model.loadStateDict("weights/yolov3-320.pt") # model.loadWeight("weights/yolov3-320.weights") inpDim = int(data["reso"]) # If there's a GPU availible, put the model on GPU model.to(device) # Set the model in evaluation mode. Notifies network to not train model.eval() # Detection phase zed = ZedCamera() # stream = cv2.VideoCapture(0) frames = 0 start = time.time()
if __name__ == '__main__': data = parse_data("data/tennisball_VAL.data") CUDA = torch.cuda.is_available() and data["use_cuda"] device = torch.device("cuda" if CUDA else "cpu") confidence = float(data["confidence"]) nmsThresh = float(data["nms_thresh"]) # FIXME: Change this to match number of classes in names file # AND change the network's yolo layers to match numClasses = 1 classes = loadClasses(data["names"]) model = Darknet(data["cfg"]) # model.loadWeight(data["weights"]) model.loadStateDict("checkpoints/epoch_95.pt") inpDim = int(data["reso"]) # If there's a GPU availible, put the model on GPU model.to(device) # Set the model in evaluation mode. Notifies network to not train model.eval() # Detection phase zed = ZedCamera() zed.resetSettings() # zed.setCamSettings(brightness=4, # contrast=0, # hue=0,