opt = parser.parse_args()
print(opt)
cuda = torch.cuda.is_available()
os.makedirs("output", exist_ok=True)
// Set up model
model = Darknet(opt.config_path, img_size=opt.img_size)
if opt.weights_path.endswith(".weights"):
// Load darknet weights
model.load_darknet_weights(opt.weights_path)
else:
// Load checkpoint weights
model.load_state_dict(torch.load(opt.weights_path))
if cuda:
model.cuda()
model.eval() // Set in evaluation mode
dataloader = DataLoader(
ImageFolder(opt.image_folder, img_size=opt.img_size),