Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unnecessary dependency on VOC dataset for model in Model Zoo #151

Closed
thomelane opened this issue Jun 4, 2018 · 2 comments
Closed

Unnecessary dependency on VOC dataset for model in Model Zoo #151

thomelane opened this issue Jun 4, 2018 · 2 comments

Comments

@thomelane
Copy link
Contributor

When trying out fcn_resnet50_voc after a fresh install of Gluon CV you get the error detailed below, where it appears that the VOC dataset is required. Given it's common to only want to use the model and not download the whole dataset, a different check should be used here.

After downloading the VOC dataset with python pascal_voc.py as found here, I was able to use the model from the Model Zoo, but this shouldn't be required.

model = gluoncv.model_zoo.get_model('fcn_resnet50_voc', pretrained=True)

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
~/anaconda3/envs/mxnet_p36/lib/python3.6/site-packages/gluoncv/model_zoo/model_zoo.py in get_model(name, **kwargs)
     54     try:
---> 55         net = gluon.model_zoo.vision.get_model(name, **kwargs)
     56     except ValueError as e:

~/anaconda3/envs/mxnet_p36/lib/python3.6/site-packages/mxnet/gluon/model_zoo/vision/__init__.py in get_model(name, **kwargs)
    150             'Model %s is not supported. Available options are\n\t%s' % (
--> 151                 name, '\n\t'.join(sorted(models.keys()))))
    152     return models[name](**kwargs)

ValueError: Model fcn_resnet50_voc is not supported. Available options are
	alexnet
	densenet121
	densenet161
	densenet169
	densenet201
	inceptionv3
	mobilenet0.25
	mobilenet0.5
	mobilenet0.75
	mobilenet1.0
	mobilenetv2_0.25
	mobilenetv2_0.5
	mobilenetv2_0.75
	mobilenetv2_1.0
	resnet101_v1
	resnet101_v2
	resnet152_v1
	resnet152_v2
	resnet18_v1
	resnet18_v2
	resnet34_v1
	resnet34_v2
	resnet50_v1
	resnet50_v2
	squeezenet1.0
	squeezenet1.1
	vgg11
	vgg11_bn
	vgg13
	vgg13_bn
	vgg16
	vgg16_bn
	vgg19
	vgg19_bn

During handling of the above exception, another exception occurred:

OSError                                   Traceback (most recent call last)
<ipython-input-4-9baa5158fc03> in <module>()
----> 1 model = gluoncv.model_zoo.get_model('fcn_resnet50_voc', pretrained=True)

~/anaconda3/envs/mxnet_p36/lib/python3.6/site-packages/gluoncv/model_zoo/model_zoo.py in get_model(name, **kwargs)
     58         if name not in models:
     59             raise ValueError('%s\n\t%s' % (str(e), '\n\t'.join(sorted(models.keys()))))
---> 60         net = models[name](**kwargs)
     61     return net

~/anaconda3/envs/mxnet_p36/lib/python3.6/site-packages/gluoncv/model_zoo/fcn.py in get_fcn_voc_resnet50(**kwargs)
    140     >>> print(model)
    141     """
--> 142     return get_fcn('pascal_voc', 'resnet50', **kwargs)
    143 
    144 def get_fcn_voc_resnet101(**kwargs):

~/anaconda3/envs/mxnet_p36/lib/python3.6/site-packages/gluoncv/model_zoo/fcn.py in get_fcn(dataset, backbone, pretrained, root, ctx, **kwargs)
    113     # infer number of classes
    114     from ..data.segbase import get_segmentation_dataset
--> 115     data = get_segmentation_dataset(dataset)
    116     model = FCN(data.num_class, backbone=backbone, **kwargs)
    117     if pretrained:

~/anaconda3/envs/mxnet_p36/lib/python3.6/site-packages/gluoncv/data/segbase.py in get_segmentation_dataset(name, **kwargs)
     19         'pascal_aug': VOCAugSegmentation,
     20     }
---> 21     return datasets[name](**kwargs)
     22 
     23 

~/anaconda3/envs/mxnet_p36/lib/python3.6/site-packages/gluoncv/data/pascal_voc/segmentation.py in __init__(self, root, split, transform)
     35     def __init__(self, root=os.path.expanduser('~/.mxnet/datasets/voc'),
     36                  split='train', transform=None):
---> 37         super(VOCSegmentation, self).__init__(root)
     38         self.root = root
     39         _voc_root = os.path.join(self.root, self.BASE_DIR)

~/anaconda3/envs/mxnet_p36/lib/python3.6/site-packages/gluoncv/data/segbase.py in __init__(self, root, base_size, crop_size)
     37     # pylint: disable=abstract-method
     38     def __init__(self, root, base_size=520, crop_size=480):
---> 39         super(SegmentationDataset, self).__init__(root)
     40         self.base_size = base_size
     41         self.crop_size = crop_size

~/anaconda3/envs/mxnet_p36/lib/python3.6/site-packages/gluoncv/data/base.py in __init__(self, root)
     26                          datasets described in `gluon-cv/scripts/datasets`? You need \
     27                          to initialize each dataset only once.".format(root)
---> 28             raise OSError(helper_msg)
     29 
     30     @property

OSError: /home/ubuntu/.mxnet/datasets/voc is not a valid dir. Did you forget to initalize                          datasets described in `gluon-cv/scripts/datasets`? You need                          to initialize each dataset only once.
@zhanghang1989
Copy link
Contributor

This has been fixed in master branch https://github.com/dmlc/gluon-cv/blob/master/gluoncv/model_zoo/fcn.py#L121

@zhanghang1989
Copy link
Contributor

Closing it, since it has been fixed in master branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants