megengine.data.dataset.ImageNet¶
- class ImageNet(root=None, train=True, **kwargs)[源代码]¶
从原始文件或文件夹中加载ImageNet,期望的文件夹形如:
${root}/ | [REQUIRED TAR FILES] |- ILSVRC2012_img_train.tar |- ILSVRC2012_img_val.tar |- ILSVRC2012_devkit_t12.tar.gz | [OPTIONAL IMAGE FOLDERS] |- train/cls/xxx.${img_ext} |- val/cls/xxx.${img_ext} |- ILSVRC2012_devkit_t12/data/meta.mat |- ILSVRC2012_devkit_t12/data/ILSVRC2012_validation_ground_truth.txt
如果期望的图片文件夹不存在,则需要原始tar文件来进行抽取和处理。
if
root
containsself.target_folder
depending ontrain
:initialize ImageFolder with target_folder.
else:
if all raw files are in
root
:parse
self.target_folder
from raw files.initialize ImageFolder with
self.target_folder
.
else:
raise error.
- 参数
属性
方法
- rtype
- rtype
- rtype