久久久久久久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(計算邊界框重疊的百分比,用于圖像檢測器評估)
主站蜘蛛池模板: 二区亚洲| 国产在线成人 | 国产欧美日韩综合精品一区二区 | 久久视频精品在线 | 北条麻妃一区二区三区在线观看 | 精品国产乱码久久久久久闺蜜 | 中文字幕一级毛片视频 | 国产乱人伦精品一区二区 | 中文字幕亚洲区 | 超碰97免费观看 | 91九色视频 | 看av网址 | 亚洲精品在线免费看 | 亚洲国产精品成人久久久 | 黄色av观看 | 精品国产91久久久久久 | 亚洲啊v在线 | 欧美性高潮 | 亚洲视频一区二区三区 | 亚洲国产成人av好男人在线观看 | 久久久久国产一级毛片高清网站 | 成年人在线观看 | 精品粉嫩aⅴ一区二区三区四区 | 色精品视频 | 99久久免费观看 | 日韩欧美专区 | 亚洲高清视频一区二区 | 在线看一区二区三区 | 亚洲图片一区二区三区 | 亚洲成人精品一区 | 国产精品亚洲一区二区三区在线 | 日韩精品在线看 | 久久亚 | 亚洲最大av| 波多野结衣av中文字幕 | 在线观看亚洲专区 | 色婷婷影院 | 九九九视频 | 色综合天天综合网国产成人网 | 久久成人精品 | 在线观看免费福利 |