从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",])
  • openimages.download.download_dataset用于下载图像和相应的 注释 例如,下载PASCAL中的所有图像和相应的注释 VOC格式为两个类“锤子”和“剪刀”进入目录 “/dest/dir/Hammer/[images | pascal]”和“/dest/dir/Scissors/[images | pascal]”:

    ^{pr2}$ 在
命令行界面

将包安装到中时,将安装两个Python脚本入口点 一个Python环境,对应于上面描述的公共API函数: oi_download_dataset和{}。这些命令使用以下命令 选项:

OptionRequiredDescription
--base_dir <dir>yesdirectory 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> ...]yesspace-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 onlyrequired for downloading an annotated dataset, currently supported format specifiers are "darknet" and "pascal"
--csv_dir <dir>no, but usually recommendeddirectory into which the CSV files specifying annotations and class labels are downloaded (if not already present) or read from (if present)
--exclusions <file>notext 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>nothe 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

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java OnClick用于ListView中的特定项   java如何多次循环相同的TestNG测试。包括课前和课后   java如何在Codenameone中设置BrowserComponent浏览器窗口大小   java Socketchannel始终为空   java以编程方式向JavaFX WebEngine历史添加新条目   java Hibernate+Spring与Oracle一起使用分层查询(从+连接方式开始)   Java中的安卓 getView和Beacon(Estimote)问题   计时器如何在java中设置暂停选项   java为什么输入1000000000000的输出不正确?   java如何在程序执行期间更改log4j2中的日志记录级别   java阻止代码引发XML异常   未找到媒体类型为application/json的java JAX RS MessageBodyWriter   java如何将BuffereImage中的特定颜色(0xFF00FF)设置为透明?   java如何列出web元素,如果网页中没有特定链接的id,如何单击网页中的特定链接?   在Java中读取txt文件时获取EOFEException   java如何避免为每个视图添加inject方法?   JavaSpringController:Facebook上类似文章的永久链接   java在尝试执行脚本时遇到错误“net.serentiybdd.core.exceptions.serentitymanagedexception:No session ID”