【发布时间】:2021-08-26 18:24:58
【问题描述】:
为了简短起见,我正在尝试将带注释的图像拆分为训练-验证-测试。我使用了库拆分文件夹,但是它只拆分了图像,而带注释的文件 (.JSON) 没有。 所以我尝试使用 annotated_image 库,因为我已经看到它可以做到这一点,但是我遇到了一个错误:
TypeError Traceback (most recent call last)
<ipython-input-19-2345d5e2fe5c> in <module>()
6 RANDOM_SEED=1337
7 IMG_PATH= '/content/Untitled Folder'
----> 8 annotated_images.split(IMG_PATH,'/content/', seed=1337, ratio=(0.8,0.15,0.05))
9
10 import splitfolders
3 frames
/usr/local/lib/python3.7/dist-packages/annotated_images/split.py in list_files(directory)
26 if len(files) == 0:
27 files = glob.glob
---> 28 if len(files) == 0:
29 files = glob.glob(directory + "*.*")
30 return files
TypeError: object of type 'function' has no len()
我正在使用 Google Colab 有人可以帮忙吗?或者如果无论如何要将图像+它们各自的注释分割在一起! 谢谢你。 PS:我对python有点陌生,对它不是很熟悉。
PS2:代码:
import annotated_images
RANDOM_SEED=1337
IMG_PATH= '/content/Untitled Folder'
annotated_images.split(IMG_PATH,'/content/', seed=1337, ratio=(0.8,0.15,0.05))
【问题讨论】:
标签: python json python-3.x annotations