FiftyOne——数据集的高级使用方法

FiftyOne——进阶使用方法

数据集

按索引从数据集中取出样本

# 
index = 10
dataset.skip(index-1).limit(1).first() # 大概的意思是跳过index-1个样本 取出1个样本(此时是一个dataset_view),需要调用first(),取出第一个样本,也就是目标样本

detection中添加自定义的属性

最好是内建的数据类型:
在这里插入图片描述

  • 初始化时候添加
sample["ground_truth"] = fo.Detections(
    detections=[
        fo.Detection(
            label="cat",
            bounding_box=[0.5, 0.5, 0.4, 0.3],
            attributes={
                "age": fo.NumericAttribute(value=51),
                "mood": fo.CategoricalAttribute(value="salty"),
            },
        ),
    ]
)
  • 直接添加
detection.age = fo.NumericAttribute(value = 1)# 原本样本中并没有age这个属性
detection.age = 1 # 也可以,但不建议
  • 放在attributes里面
sample["ground_truth"] = fo.Detections(
    detections=[
        fo.Detection(
            label="cat",
            bounding_box=[0.5, 0.5, 0.4, 0.3],
            attributes={
                "age": fo.NumericAttribute(value=51),
                "mood": fo.CategoricalAttribute(value="salty"),
            },
        ),
    ]
)

合并两个数据集

  • 完全合同
dataset1  = ...# 数据集1
dataset2 = ...# 数据集2
# 将数据集2添加到数据集1中
dataset1.add_samples(dataset2)
  • 将数据集1中有标注的部分合并到数据集2
dataset1 = ...
dataset1_有标注 =  dataset1.exists("ground_truth")
dataset2.add_samples(dataset1_有标注)

标签Tags

  • 获得所有标签名
tags   = list(dataset.count_sample_tags().keys())
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值