【发布时间】:2020-08-01 19:33:21
【问题描述】:
任务包括以下内容: “输入图像是3个板块的集合,分别对应B、G、R通道(自上而下)。你应该实现函数????????????????_?? ??????????????? 读取数据并返回印版图像列表。???????????? _ ???????????? ?????? 是带有车牌图像的目录的路径。如果此目录与此笔记本位于同一目录中,则可以使用默认参数。"
包含要加载的图像的文件是印版。板和笔记本都在同一个文件中,称为计算机视觉中的深度学习。
这是我写的代码:
def load_data(dir_name ='C:/Users/ASUS/Desktop/Self_Learning/Coursera/Deep Learning in Computer Vision/plates'):
im_list=[]
for i in dir_name:
im=np.load(i)
im_list.append(im)
return im_list
pass
plates = load_data()
这是我得到的错误。
FileNotFoundError Traceback(最近一次调用最后一次) 在 8 通 9 ---> 10 个盘子 = load_data()
在 load_data(dir_name) 3 im_list=[] 4 for i in dir_name: ----> 5 im=np.load(i) 6 im_list.append(im) 7 返回im_list
~\Anaconda3\lib\site-packages\numpy\lib\npyio.py in load(file, mmap_mode, allow_pickle, fix_imports, encoding) 420 own_fid = 假 421 其他: --> 422 fid = 打开(os_fspath(文件),“rb”) 第423章 第424章
FileNotFoundError: [Errno 2] 没有这样的文件或目录:'C'
我试过这个:
import os
def load_data(dir_name ='C:/Users/ASUS/Desktop/Self_Learning/Coursera/Deep Learning in Computer Vision/plates'):
im_list=[]
for f in os.listdir(dir_name):
fpath = os.path.join(dir_name, f) # this will give you the path of each file in your directory
for im in fpath:
im_list.append(im)
print(im_list)
plates = load_data()
我想要的是 ['1', '2', '3', '4', '5', '6'] 我基本上最终打印了每个图像的路径和图像......
【问题讨论】:
-
看起来你正在迭代
dir_name这是一个字符串 -
它应该是图像的目录(包含我需要加载的图像的名为 Plates 的文件)
标签: python image numpy computer-vision anaconda