Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion detect.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,12 @@ def detect(save_img=False):
half = device.type != 'cpu' # half precision only supported on CUDA

# Load model
model = Darknet(cfg, imgsz).cuda()
# Arguman 'cpu' should be controlled, if 'cpu' is set model should be initialized with .cpu() method
# Older version of code cannot run without nvidia driver because of this reason
if device.type != 'cpu'
Comment thread
hanoglu marked this conversation as resolved.
model = Darknet(cfg, imgsz).cuda()
else
Comment thread
hanoglu marked this conversation as resolved.
model = Darknet(cfg, imgsz).cpu()
model.load_state_dict(torch.load(weights[0], map_location=device)['model'])
#model = attempt_load(weights, map_location=device) # load FP32 model
#imgsz = check_img_size(imgsz, s=model.stride.max()) # check img_size
Expand Down