pytorch-yolo-v3 icon indicating copy to clipboard operation
pytorch-yolo-v3 copied to clipboard

Issue with printing on windows

Open yuskey opened this issue 7 years ago • 5 comments

Hey I ran the detect.py script on windows machine and no images were being output. I found the error, it's on line 302 of detect.py:

det_names = pd.Series(imlist).apply(lambda x: "{}/det_{}".format(args.det,x.split("/")[-1]))

This works for linux and mac machines but not on windows, it's an easy fix though. I tried to push a PR but didnt realize I couldnt. The fix is simple, add import platform to the top of detect.py and change line 302 to

if platform.system() == 'Windows':
        det_names = pd.Series(imlist).apply(lambda x: "{}/det_{}".format(args.det,x.split("\\")[-1]))
    else:
        det_names = pd.Series(imlist).apply(lambda x: "{}/det_{}".format(args.det,x.split("/")[-1]))```

yuskey avatar Oct 23 '18 17:10 yuskey

Thanks this helps. I have forked the code and updated it with your suggestion. I had to import the "platform" module.

If you are on Windows platform use the following detect.py instead of the one come here

https://github.com/RanchMobile/pytorch-yolo-v3/blob/master/detect.py

place the above file in the root folder or where detect.py is.

RanchMobile avatar Feb 21 '19 02:02 RanchMobile

@yuskey Yes!thx for fix this problem!

justein avatar Apr 25 '19 03:04 justein

@justein @RanchMobile @yuskey The https://github.com/ultralytics/yolov3 repo works on MacOS, Windows and Linux, includes multigpu and multithreading, performs rectangular inference including batch_norm2d fusion on images, videos, webcams, and an iOS app. It also tests to slightly higher mAPs than darknet, including on the latest YOLOv3-SPP.weights (60.7 COCO mAP), and offers the ability to train custom datasets from scratch to darknet performance, all using PyTorch :)

Screenshot 2019-04-24 at 19 34 25

fourth-archive avatar Apr 25 '19 19:04 fourth-archive

@fourth-archive thanks to provide the awesome product! I will learn it now

justein avatar Apr 26 '19 13:04 justein

@yuskey Yes!thx for fix this problem!

Can I please ask if the images are saved into another folder if you run the detect.py on a directory containing many images? I can run and get the output image on a single image instead of a directory in the Windows system.

QizhengWu avatar May 12 '19 03:05 QizhengWu