ImportError: cannot import name 'voc' from 'data' (unknown location)

ImportError: cannot import name 'voc' from 'data' (unknown location)

我一直在尝试运行来自项目https://github.com/amdegroot/ssd.pytorch.git的ssd代码 但是上面的错误不断弹出。我猜目录有问题。请指导!!

我正在尝试导入以下文件但无法导入并且

cannot import name 'BaseTransform' from 'data' (unknown location)

这出现了 当我尝试 运行 上面 link 的 ssd python 文件时,我得到了

ImportError: cannot import name 'voc' from 'data' (unknown location)

所以我猜基本上存在一些路径问题。

import torch
from torch.autograd import Variable
import cv2
from data import BaseTransform, VOC_CLASSES as labelmap
from ssd import bulid_ssd
import imageio

或者请告诉我应该将我的项目 python 文件和 https://github.com/amdegroot/ssd.pytorch.git 文件放在哪个目录中,以便在数据和 ssd 来自 https://github.com/amdegroot/ssd.pytorch.git[= 时使上述导入语句起作用15=]

PS: ssd 是 Single Shot MultiBox Detector 我正在使用 anaconda

您需要下载该项目,它应该有一个名称为 data 的文件夹,其中应该存在一个 class 同名的文件。

结构示例 your_file.py 数据 |_ xxx.py

xxx.py

的代码示例

class 基础变换: xxxxxx