(一) 版本
numpy==1.16
tensorflow==1.9.0
keras==2.0.8
h5py==2.10.0
(二)
如果报错unable to find vcvarsall.bat,查找vcvarsall.bat的方法是定义在_msvccompiler.py文件中的(注意该文件前面是有下划线的!),比如我本地的文件路径为"C:\Program Files\Python36\Lib\distutils\_msvccompiler.py“,打开该文件,修改函数_find_vcvarsall。我本地安装的是vs2017,vcvarsall.bat的路径为“E:\tools\vs2017\VC\Auxiliary\Build\vcvarsall.bat”
_find_vcvarsall的原文如下:
def _find_vcvarsall(plat_spec):
try:
key = winreg.OpenKeyEx(
winreg.HKEY_LOCAL_MACHINE,
r"Software\Microsoft\VisualStudio\SxS\VC7",
access=winreg.KEY_READ | winreg.KEY_WOW64_32KEY
)
except OSError:
log.debug("Visual C++ is not registered")
return None, None
with key:
best_version = 0
best_dir = None
for i in count():
try:
v, vc_dir, vt = winreg.EnumValue(key, i)
except OSError:
break
if v and vt == winreg.REG_SZ and os.path.isdir(vc_dir):
try:
version = int(float(v))
except (ValueError, TypeError):
continue
if version >= 14 and version > best_version:
best_version, best_dir = version, vc_dir
if not best_version:
log.debug("No suitable Visual C++ version found")
return None, None
vcvarsall = os.path.join(best_dir, "vcvarsall.bat")
if not os.path.isfile(vcvarsall):
log.debug("%s cannot be found", vcvarsall)
return None, None
vcruntime = None
vcruntime_spec = _VCVARS_PLAT_TO_VCRUNTIME_REDIST.get(plat_spec)
if vcruntime_spec:
vcruntime = os.path.join(best_dir,
vcruntime_spec.format(best_version))
if not os.path.isfile(vcruntime):
log.debug("%s cannot be found", vcruntime)
vcruntime = None
return vcvarsall, vcruntime
修改为:
def _find_vcvarsall(plat_spec):
best_dir = r'E:\tools\vs2017\VC\Auxiliary\Build'
best_version = 17
vcruntime = None
vcruntime_spec = _VCVARS_PLAT_TO_VCRUNTIME_REDIST.get(plat_spec)
if vcruntime_spec:
vcruntime = os.path.join(best_dir,
vcruntime_spec.format(best_version))
if not os.path.isfile(vcruntime):
log.debug("%s cannot be found", vcruntime)
vcruntime = None
print(vcruntime)
return r'E:\tools\vs2017\VC\Auxiliary\Build\vcvarsall.bat', vcruntime
(三)
如果报错ValueError: Dimension 1 in both shapes must be equal, but are 8 and 324 for 'Assign_376' 可能是因为权重文件下错了
权重文件是mask-rcnn_coco.h5不是mask_rcnn_balloon.h5
(四)
UserWarning: Matplotlib is currently using agg,which is a non-GUI backend, so cannot show the figure
在你的环境里,例如anacon/envs/pytorch/lib/sit-pakege/ 里面有你下载的包,例如numpy等。找到pycocotools里面打开coco.py,将 “Agg” 改为 “TkAgg”,问题解决