【发布时间】:2020-02-16 17:42:57
【问题描述】:
如何使用预先下载的 .weight 和 .cfg 文件,而不是每次使用 cvlib 运行对象检测代码时重新下载它们?
【问题讨论】:
标签: python opencv object-detection cvlib
如何使用预先下载的 .weight 和 .cfg 文件,而不是每次使用 cvlib 运行对象检测代码时重新下载它们?
【问题讨论】:
标签: python opencv object-detection cvlib
第一次运行脚本时,预训练的权重和配置文件只会下载一次。如果路径中已经存在文件,下次将不再下载。
if not os.path.exists(config_file_abs_path):
download_file(url=cfg_url, file_name=config_file_name, dest_dir=dest_dir)
if not os.path.exists(weights_file_abs_path):
download_file(url=weights_url, file_name=weights_file_name, dest_dir=dest_dir)
查看完整的实现here。
【讨论】: