mars-classification
收藏Mars Image Classification Dataset 概述
基本信息
- 数据集名称: Mars Image Classification Dataset
- 语言: 英文 (en)
- 许可证: MIT
- 标签: mars, planetary-science, image-classification
数据集内容
- 类别: class_0 至 class_14 (共15个类别)
- 数据划分: train, val, test
- Few-shot 划分: train, val, test
数据集结构
-
原始文件结构:
gremlin97/mars-classification/ ├── train/ │ ├── [image files] ├── val/ │ ├── [image files] ├── test/ │ ├── [image files] └── metadata/ └── annotations.json
使用方法
python
使用 Hugging Face Hub 库直接访问文件
from huggingface_hub import hf_hub_download import json from PIL import Image
下载元数据
metadata_path = hf_hub_download( repo_id="gremlin97/mars-classification", filename="metadata/metadata.json", repo_type="dataset" )
加载类别名称和其他元数据
with open(metadata_path, r) as f: metadata = json.load(f)
获取某个划分的标注
annotations_path = hf_hub_download( repo_id="gremlin97/mars-classification", filename="metadata/train_annotations.json", repo_type="dataset" )
加载标注
with open(annotations_path, r) as f: annotations = json.load(f)
直接访问图像文件
for item in annotations: image_path = hf_hub_download( repo_id="gremlin97/mars-classification", filename=f"train/{item[file_name]}", repo_type="dataset" ) # 现在可以处理原始图像文件 image = Image.open(image_path)




