久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

如何下載 Coco Dataset 的特定部分?

How can I download a specific part of Coco Dataset?(如何下載 Coco Dataset 的特定部分?)
本文介紹了如何下載 Coco Dataset 的特定部分?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我正在開發一個對象檢測模型來使用 YOLO 檢測船舶.我想使用 COCO 數據集.有沒有辦法只下載帶有注釋的圖像?

I am developing an object detection model to detect ships using YOLO. I want to use the COCO dataset. Is there a way to download only the images that have ships with the annotations?

推薦答案

要下載特定類別的圖片,可以使用 COCO API.這是一個 demo 筆記本,通過這個和其他用法.整體流程如下:

To download images from a specific category, you can use the COCO API. Here's a demo notebook going through this and other usages. The overall process is as follows:

  • 安裝pycocotools
  • 從 COCO 數據集
  • 下載其中一個注釋 json
  • Install pycocotools
  • Download one of the annotations jsons from the COCO dataset

下面是一個示例,說明我們如何下載包含 person 的圖像子集并將其保存在本地文件中:

Now here's an example on how we could download a subset of the images containing a person and saving it in a local file:

from pycocotools.coco import COCO
import requests

# instantiate COCO specifying the annotations json path
coco = COCO('...path_to_annotations/instances_train2014.json')
# Specify a list of category names of interest
catIds = coco.getCatIds(catNms=['person'])
# Get the corresponding image ids and images using loadImgs
imgIds = coco.getImgIds(catIds=catIds)
images = coco.loadImgs(imgIds)

它返回一個字典列表,其中包含有關圖像及其 url 的基本信息.我們現在可以使用 requestsGET 圖像并將它們寫入本地文件夾:

Which returns a list of dictionaries with basic information on the images and its url. We can now use requests to GET the images and write them into a local folder:

# Save the images into a local folder
for im in images:
    img_data = requests.get(im['coco_url']).content
    with open('...path_saved_ims/coco_person/' + im['file_name'], 'wb') as handler:
        handler.write(img_data)

請注意,這將保存指定類別中的所有張圖片.因此,您可能希望將 images 列表切片為第一個 n.

Note that this will save all images from the specified category. So you might want to slice the images list to the first n.

這篇關于如何下載 Coco Dataset 的特定部分?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

How to draw a rectangle around a region of interest in python(如何在python中的感興趣區域周圍繪制一個矩形)
How can I detect and track people using OpenCV?(如何使用 OpenCV 檢測和跟蹤人員?)
How to apply threshold within multiple rectangular bounding boxes in an image?(如何在圖像的多個矩形邊界框中應用閾值?)
Detect image orientation angle based on text direction(根據文本方向檢測圖像方向角度)
Detect centre and angle of rectangles in an image using Opencv(使用 Opencv 檢測圖像中矩形的中心和角度)
Calculating percentage of Bounding box overlap, for image detector evaluation(計算邊界框重疊的百分比,用于圖像檢測器評估)
主站蜘蛛池模板: 中文字幕精品一区 | 成人免费在线网 | 日韩精品视频在线观看一区二区三区 | 欧美日韩视频在线 | 亚洲福利| 久久久久亚洲精品国产 | 午夜在线影院 | 亚洲视频免费一区 | 日韩一区在线播放 | a精品视频 | 一区二区在线观看av | 91色综合| 亚洲自拍偷拍欧美 | 在线观看视频91 | 黄色毛片视频 | 人人草人人干 | а天堂中文最新一区二区三区 | 蜜臀网站| 日韩亚洲视频 | 亚洲精品视 | 99久久精品免费看国产高清 | 天天操网 | 九九热精品在线 | 婷婷福利 | 亚洲精品片 | 国产精品欧美一区喷水 | 久久成人精品一区二区三区 | 美日韩视频 | 欧美日韩在线播放 | 午夜精品久久久久久久99黑人 | 狠狠做深爱婷婷综合一区 | 精品日韩一区二区三区av动图 | 欧美日韩国产在线 | 91社区在线观看高清 | 国产精品一区在线观看 | 亚洲一区二区中文字幕 | 午夜电影网站 | 久久精品国产久精国产 | 成人久久久久 | 精品视频久久久 | 成人欧美一区二区三区黑人孕妇 |