Skip to Main Content
弱监督学习实用指南
book

弱监督学习实用指南

by Wee Hyong Tok, Amit Bahree, Senja Filipi
January 2023
Beginner to intermediate content levelBeginner to intermediate
209 pages
3h 55m
Chinese
Southeast University Press
Content preview from 弱监督学习实用指南
104
3
base_storage_url = "<URL of the images folder>"
tags = [None] * df.size
#
每分钟查询
20
张图像
,
然后暂停
,
#
因为这样可以免费使用
Computer Vision API
for i, row in df.iterrows():
tags[i] = describe_image(base_storage_url+df["rel_url"][i])
print("counter: {0}. Tags {1}".format(i, tags[i]))
if(i % 20 == 0):
time.sleep(60)
创建数据帧
接下来,我们将标记数组添加到数据帧。由于我们知道图像的标签(因为图
像分别在“室内”和“室外”文件夹中),因此我们在第
3
列中提取标签,
仅在验证子集上使用,以计算经验精度:
#
附加标签数组
df["tags"] = tags
#
提取标签
df["label"] = df.apply(lambda x: INDOOR if "indoor" in str(x["Path"])
else OUTDOOR) , axis=1)
df.head(3)
数据帧如表
3-5
所示。
3
-
5
:包含 Computer Vision API tags 输出结果的数据帧
路径
标签
C:\images\outdoor\378.jpg,1 [outdoor, sky, ground, mountain...
C:\images\indoor\763.jpg,-1, ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

人工智能技术与大数据

人工智能技术与大数据

Posts & Telecom Press, Anand Deshpande, Manish Kumar
解密金融数据

解密金融数据

Justin Pauley
C++语言导学(原书第2版)

C++语言导学(原书第2版)

本贾尼 斯特劳斯特鲁普

Publisher Resources

ISBN: 9787576602630