|
|
--- |
|
|
dataset_info: |
|
|
features: |
|
|
- name: images |
|
|
sequence: image |
|
|
- name: problem |
|
|
dtype: string |
|
|
- name: answer |
|
|
dtype: string |
|
|
splits: |
|
|
- name: train |
|
|
num_bytes: 19727332 |
|
|
num_examples: 80 |
|
|
- name: test |
|
|
num_bytes: 4916000 |
|
|
num_examples: 20 |
|
|
download_size: 24609074 |
|
|
dataset_size: 24643332 |
|
|
configs: |
|
|
- config_name: default |
|
|
data_files: |
|
|
- split: train |
|
|
path: data/train-* |
|
|
- split: test |
|
|
path: data/test-* |
|
|
license: mit |
|
|
task_categories: |
|
|
- visual-question-answering |
|
|
language: |
|
|
- zh |
|
|
- en |
|
|
size_categories: |
|
|
- n<1K |
|
|
tags: |
|
|
- agent |
|
|
- vision |
|
|
- fib-sem |
|
|
- needle-positioning |
|
|
pretty_name: fibsem_mini |
|
|
--- |
|
|
|
|
|
# Dataset Card for fibsem_mini |
|
|
|
|
|
**fibsem_mini** 是一个多模态视觉-语言小规模数据集,用于 FIB-SEM(聚焦离子束-扫描电镜)场景下的 needle(针)定位任务。每条样本包含一张 SEM 图像、一道自然语言任务描述,以及以 function call JSON 形式给出的标准答案(动作、参数与理由),格式对齐 [hiyouga/geometry3k](https://huggingface.co/datasets/hiyouga/geometry3k),便于用于视觉语言模型训练或强化学习(如 GRPO)等场景。 |
|
|
|
|
|
## Dataset Details |
|
|
|
|
|
### Dataset Description |
|
|
|
|
|
- **用途:** 训练智能化电镜。 |
|
|
- **规模:** 共 100 条样本,其中 train 80 条、test 20 条;每条对应一张 SEM 图像(如 512×512 像素),不同样本中 needle 的起始位置不同。 |
|
|
- **Curated by:** [liupeng @ dp] |
|
|
- **Language(s):** en/中文 |
|
|
- **License:** MIT |
|
|
|
|
|
### Dataset Sources |
|
|
|
|
|
- **Repository:** [Hugging Face - fingerliu/fibsem_mini](https://huggingface.co/datasets/fingerliu/fibsem_mini) |
|
|
- **Source data:** 原始数据为 `sem_000.png`~`sem_099.png` 及对应的 needle 坐标文件 `sem_needle_xy.txt`;经脚本构建为 HF 数据集并可选缩放图像以适配 VL 模型。 |
|
|
|
|
|
## Uses |
|
|
|
|
|
### Direct Use |
|
|
|
|
|
- **视觉语言模型 (VLM) 指令微调 / SFT:** 输入图像 + problem,学习输出 answer 中的 JSON。 |
|
|
- **强化学习 (RL) / GRPO 等:** 作为 reward 的 ground truth(规则匹配 answer 中的 action/params)。 |
|
|
- **Agent 与 function calling:** 作为「看图 → 输出结构化动作」的 agent 数据,训练或评估模型的 tool-use / 动作生成能力。 |
|
|
|
|
|
### Out-of-Scope Use |
|
|
|
|
|
- 本数据集仅模拟「将 needle 移动到保护垫左侧」的单一任务,且坐标与图像尺寸绑定;不适用于真实电镜闭环控制,也不保证在其它分辨率或设备上直接可用。不建议在未做领域适配的情况下用于安全关键系统。 |
|
|
|
|
|
## Dataset Structure |
|
|
|
|
|
- **images:** `list[image]`,每条仅 1 张图(SEM 图像,如 512×512 RGB)。 |
|
|
- **problem:** `string`,固定任务描述:根据当前 FIB-SEM 的 SEM 图像,将 needle 移动到位于图像正中央的长方形保护垫的左侧(屏幕中央向左 10 像素),并给出 move_needle 的 JSON(含 action、params、reason)。 |
|
|
- **answer:** `string`,JSON 格式,固定三键: |
|
|
- `action`: 如 `"move_needle"` |
|
|
- `params`: `{"x": float, "y": float, "z": 0}`,与当前图像坐标系一致 |
|
|
- `reason`: 简短中文说明(当前 needle 位置与目标位置等) |
|
|
|
|
|
示例: |
|
|
|
|
|
```json |
|
|
{"action": "move_needle", "params": {"x": 246.0, "y": 256.0, "z": 0}, "reason": "当前 needle 位于 (0.0, 0.0),需移动到保护垫左侧,目标坐标为 (246.0, 256.0)。"} |
|
|
``` |
|
|
|
|
|
- **Splits:** `train`(80 条)、`test`(20 条),按比例从 100 条中划分。 |
|
|
|
|
|
## Dataset Creation |
|
|
|
|
|
### Curation Rationale |
|
|
|
|
|
为在 FIB-SEM 操作场景下训练或评估「看图 → 输出结构化动作」的 agent/VLM,需要与 geometry3k 类似的多模态数据集格式(images + problem + answer),且 answer 为可解析的 function call JSON,便于与 GRPO、规则 reward 或下游工具调用流程对接。fibsem_mini 基于少量 SEM 图像与已知 needle 坐标构造,用于方法验证与小规模实验。 |
|
|
|
|
|
### Source Data |
|
|
|
|
|
- **内容:** SEM 图像序列(sem_000.png~sem_099.png)及每张图中 needle 的像素坐标(sem_needle_xy.txt)。 |
|
|
- **处理:** 脚本将图像转为 RGB、可选缩放(如最长边 512px),按「目标 = 图像中心向左 10 像素」生成每条 problem/answer;坐标与导出图像尺寸一致。 |
|
|
|
|
|
### 用法示例 |
|
|
|
|
|
```python |
|
|
#!/usr/bin/env python3 |
|
|
"""从 HuggingFace fingerliu/fibsem_mini 读取一条记录并展示(图像 + problem + answer)。""" |
|
|
|
|
|
import argparse |
|
|
import json |
|
|
|
|
|
from datasets import load_dataset |
|
|
|
|
|
|
|
|
def main(): |
|
|
parser = argparse.ArgumentParser(description="读取并展示 fibsem_mini 的一条记录") |
|
|
parser.add_argument( |
|
|
"--repo", |
|
|
type=str, |
|
|
default="fingerliu/fibsem_mini", |
|
|
help="HuggingFace 数据集 repo_id", |
|
|
) |
|
|
parser.add_argument( |
|
|
"--split", |
|
|
type=str, |
|
|
default="train", |
|
|
choices=("train", "test"), |
|
|
help="使用的 split", |
|
|
) |
|
|
parser.add_argument( |
|
|
"--index", |
|
|
type=int, |
|
|
default=0, |
|
|
help="记录索引", |
|
|
) |
|
|
parser.add_argument( |
|
|
"--save_image", |
|
|
type=str, |
|
|
default=None, |
|
|
metavar="PATH", |
|
|
help="可选:将图像保存到指定路径,不弹窗显示", |
|
|
) |
|
|
args = parser.parse_args() |
|
|
|
|
|
print(f"正在加载 {args.repo} ...") |
|
|
ds = load_dataset(args.repo, split=args.split) |
|
|
if args.index >= len(ds): |
|
|
print(f"索引 {args.index} 超出范围(split 共 {len(ds)} 条),使用 0") |
|
|
args.index = 0 |
|
|
|
|
|
record = ds[args.index] |
|
|
problem = record["problem"] |
|
|
answer = record["answer"] |
|
|
images = record["images"] |
|
|
|
|
|
print("-" * 60) |
|
|
print(f"split={args.split}, index={args.index}") |
|
|
print("-" * 60) |
|
|
print("problem:") |
|
|
print(problem) |
|
|
print() |
|
|
print("answer (raw string):") |
|
|
print(answer) |
|
|
try: |
|
|
obj = json.loads(answer) |
|
|
print("answer (parsed JSON):") |
|
|
print(json.dumps(obj, ensure_ascii=False, indent=2)) |
|
|
except json.JSONDecodeError: |
|
|
pass |
|
|
print("-" * 60) |
|
|
|
|
|
if not images: |
|
|
print("(无图像)") |
|
|
return |
|
|
|
|
|
img = images[0] |
|
|
from PIL import Image |
|
|
if not isinstance(img, Image.Image): |
|
|
if isinstance(img, dict): |
|
|
if "path" in img: |
|
|
img = Image.open(img["path"]).convert("RGB") |
|
|
elif "bytes" in img: |
|
|
from io import BytesIO |
|
|
img = Image.open(BytesIO(img["bytes"])).convert("RGB") |
|
|
else: |
|
|
raise ValueError("无法解析 image 字典") |
|
|
else: |
|
|
img = Image.open(img).convert("RGB") |
|
|
if args.save_image: |
|
|
img.save(args.save_image) |
|
|
print(f"图像已保存: {args.save_image}") |
|
|
return |
|
|
|
|
|
try: |
|
|
import matplotlib.pyplot as plt |
|
|
fig, ax = plt.subplots(1, 1, figsize=(6, 6)) |
|
|
ax.imshow(img) |
|
|
ax.set_title(f"{args.repo} | {args.split}[{args.index}]") |
|
|
ax.axis("off") |
|
|
plt.tight_layout() |
|
|
plt.show() |
|
|
except Exception as e: |
|
|
print(f"无法弹窗显示图像: {e}") |
|
|
out = "fibsem_mini_demo.png" |
|
|
img.save(out) |
|
|
print(f"已保存到 {out}") |
|
|
|
|
|
|
|
|
if __name__ == "__main__": |
|
|
main() |
|
|
``` |
|
|
|
|
|
### Annotations |
|
|
|
|
|
答案(answer)由脚本根据固定规则生成:目标位置为图像中心向左 10 像素;reason 由当前 needle 坐标与目标坐标自动填充。无人工标注。 |
|
|
|
|
|
## Bias, Risks, and Limitations |
|
|
|
|
|
- **任务单一:** 仅包含「移动到保护垫左侧」一类任务,泛化到其它 FIB-SEM 操作需额外数据或迁移。 |
|
|
- **坐标绑定:** 答案中的 x/y 与构建时图像尺寸绑定(如 512×512);换分辨率需按比例换算或重新构建。 |
|
|
- **非真实控制:** 数据为离线构造,不涉及真实电镜闭环控制,不可直接用于安全关键执行。 |
|
|
|
|
|
### Recommendations |
|
|
|
|
|
使用者应明确该数据集仅适用于研究与方法验证;若用于实际设备控制,需在领域数据与安全策略上做额外工作。 |
|
|
|
|
|
## Citation |
|
|
|
|
|
若在论文或报告中使用了 fibsem_mini,可引用本数据集卡片或对应 Hugging Face 仓库。 |
|
|
|
|
|
**BibTeX:** |
|
|
|
|
|
```bibtex |
|
|
@misc{fibsem_mini, |
|
|
title = {fibsem\_mini: A Multimodal Dataset for FIB-SEM Needle Positioning}, |
|
|
author = {[Dataset maintainer]}, |
|
|
year = {2025}, |
|
|
publisher = {Hugging Face}, |
|
|
url = {https://huggingface.co/datasets/fingerliu/fibsem_mini} |
|
|
} |
|
|
``` |
|
|
|
|
|
**APA:** [Dataset maintainer]. (2025). *fibsem_mini: A multimodal dataset for FIB-SEM needle positioning*. Hugging Face. https://huggingface.co/datasets/fingerliu/fibsem_mini |
|
|
|
|
|
## Glossary |
|
|
|
|
|
- **FIB-SEM:** 聚焦离子束-扫描电子显微镜。 |
|
|
- **Needle:** 本数据集中指 SEM 图像中需被移动到目标位置的针状结构。 |
|
|
- **保护垫:** 位于图像正中央的长方形区域;任务目标为将 needle 移动到该区域左侧(中心向左 10 像素)。 |
|
|
|
|
|
## Dataset Card Contact |
|
|
|
|
|
[liupeng](liupeng.dalian@gmail.com) |