【问题标题】:windows SSD caffeWindows SSD 咖啡机
【发布时间】:2017-07-29 01:48:08
【问题描述】:

大家,当我在 windows 中测试 ssd_pascal_video.py 时,我得到了以下错误:

    E:\caffe-ssd-microsoft\Build\x64\Release\pycaffe>python E:\caffe-ssd-microsoft\examples\ssd\ssd_pascal_webcam.py --cpu
  Traceback (most recent call last):
  File "E:\caffe-ssd-microsoft\examples\ssd\ssd_pascal_webcam.py", line 151, in <module>
  for file in os.listdir(snapshot_dir):
     WindowsError: [Error 3] : 'models/VGGNet/VOC0712/SSD_300x300/*.*'

然后,我查看了ssd_pascal_video.py,发现如下代码,地址中“{}”的含义我看不懂。

   # The job name should be same as the name used in examples/ssd/ssd_pascal.py.
   job_name = "SSD_{}".format(resize)
   # The name of the model. Modify it if you want.
   model_name = "VGG_VOC0712_{}".format(job_name)

   # Directory which stores the model .prototxt file.
  save_dir = "models/VGGNet/VOC0712/{}_video".format(job_name)
  # Directory which stores the snapshot of trained models.
  snapshot_dir = "models/VGGNet/VOC0712/{}".format(job_name)
  # Directory which stores the job script and log file.
  job_dir = "jobs/VGGNet/VOC0712/{}_video".format(job_name)

  # model definition files.
  test_net_file = "{}/test.prototxt".format(save_dir)
  # snapshot prefix.
  snapshot_prefix = "{}/{}".format(snapshot_dir, model_name)
  # job script path.
  job_file = "{}/{}.sh".format(job_dir, model_name)

  # Find most recent snapshot.
  max_iter = 0
  for file in os.listdir(snapshot_dir):
  if file.endswith(".caffemodel"):
  basename = os.path.splitext(file)[0]
  iter = int(basename.split("{}_iter_".format(model_name))[1])
  if iter > max_iter:
   max_iter = iter

【问题讨论】:

    标签: neural-network computer-vision deep-learning caffe pycaffe


    【解决方案1】:

    python 中 .format() 运算符的部分字符串中的 '{}'
    基本上,字符串中的每个{}都会被.format()中的对应值替换。

    【讨论】:

    • 你好,Shai!为什么它没有给出完整的地址?我该如何解决这个问题?我是否使用了虚假地址?
    • @H.Hao 你下载预训练模型了吗?文件夹'models/VGGNet/VOC0712/SSD_300x300' 是否存在(注意这是您当前工作目录的相对路径)?
    • 我下载了模型,我的地址是models/VGGNet/VOC0712/SSD_300×300。但是在ssd_pascal_video.py中,我找不到SSD_300×300应该在哪个文件,刚刚看了官方介绍,在我的地址中找到了文件。
    猜你喜欢
    • 2023-03-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-09-24
    • 2013-01-09
    • 1970-01-01
    • 2015-10-15
    • 2014-01-27
    相关资源
    最近更新 更多