从Google的OpenImages数据集下载计算机视觉数据集的工具
openimages的Python项目详细描述
openimages公司
从谷歌下载图片和相应注释的工具 OpenImages数据集。在
下载图像和注释
openimages
包包含一个download
模块,该模块为API提供
两个下载功能和相应的CLI(命令行界面),包括
编写可用于下载图像和
OpenImages数据集中的相应注释。在
公共API
- 在
openimages.download.download_images
仅用于下载图像例如,下载“锤子”和“剪刀”两个类的所有图像 进入目录“/dest/dir/Hammer/images”和“/dest/dir/Scissors/images”:
fromopenimages.downloadimportdownload_imagesdownload_images("/dest/dir",["Hammer","Scissors",])
在 - 在
^{pr2}$ 在openimages.download.download_dataset
用于下载图像和相应的 注释 例如,下载PASCAL中的所有图像和相应的注释 VOC格式为两个类“锤子”和“剪刀”进入目录 “/dest/dir/Hammer/[images | pascal]”和“/dest/dir/Scissors/[images | pascal]”:
命令行界面
将包安装到中时,将安装两个Python脚本入口点
一个Python环境,对应于上面描述的公共API函数:
oi_download_dataset
和{
Option | Required | Description |
---|---|---|
--base_dir <dir> | yes | directory into which images and annotations will be downloaded, with each class label having a separate subdirectory containing an "images" subdirectory for image files and (for annotated datasets) an <annotation_format> subdirectory for annotation files |
--labels <label1> [<label_2> ...] | yes | space-separated list of class labels, at least one required, multi-word labels with spaces must be quoted |
--format <annotation_format> | for annotated dataset yes, not applicable for images only | required for downloading an annotated dataset, currently supported format specifiers are "darknet" and "pascal" |
--csv_dir <dir> | no, but usually recommended | directory into which the CSV files specifying annotations and class labels are downloaded (if not already present) or read from (if present) |
--exclusions <file> | no | text file containing image file IDs, one per line, for images to be excluded from the final dataset, useful in cases when images have been identified as problematic |
--limit <int> | no | the upper limit on the number of images to be downloaded per label class |
注:
如果要多次使用这些命令,则必须使用
--csv_dir
选项,指定保存包含的(相当大的)CSV文件的位置
边界框信息等,因为这将节省你不得不重新下载这个
后续使用中的大文件。在
用法示例
下载类标签“剪刀”和
“Hammer”,将图像数量限制为200,并将CSV文件存储在
~/openimages
(从那里读取CSV文件,如果它们已经存在):
$ oi_download_dataset --csv_dir ~/openimages --base_dir ~/openimages --labels Scissors Hammer --format pascal --limit 100
只下载标签为“剪刀”的图片,限制图片数量
将CSV文件存储在~/openimages
下(从中读取CSV文件
如果它们已经存在的话):
$ oi_download_images --csv_dir ~/openimages --base_dir ~/openimages --labels Scissors --limit 100
- 项目
标签: