小白记录贴
最近在研究YOLOv3,遇到了各种问题。。。
从GitHub上下载了用PyTorch实现的yolov3代码,代码链接为:https://github.com/eriklindernoren/PyTorch-YOLOv3
由于各种原因,本人只能在Windows系统下运行代码。
好不容易折腾好环境等配置了,可代码就是无法运行。主要报错如下:
This probably means that you are on Windows and you have
forgotten to use the proper idiom in the main module:
if __name__ == '__main__':
freeze_support()
...
The "freeze_support()" line can be omitted if the program
is not going to be frozen to produce a Windows executable.
在网上查了下,貌似是因为原代码应该在Linux下运行,在Windows系统中会因为什么分布式之类的原因出错。还没有来得及研究,先简单记录一下。可以参考以下几个博客:
https://blog.youkuaiyun.com/Solo95/article/details/78913709
http://www.cnblogs.com/wFrancow/p/8511711.html
https://blog.youkuaiyun.com/jacke121/article/details/79826420
总之,我在detect.py文件中加了下面这行命令,然后将后面的代码缩进,程序就能正常运行了。
if __name__ == '__main__':
运行效果如下: