ORL数据库文件夹的权限被拒绝错误

时间:2018-12-14 18:34:54

标签: python

我想在ORL数据库上运行代码以进行人脸识别实验。我正在使用跟随代码从第一个文件夹加载数据,但它返回权限被拒绝的错误。这个标题<ng-container *ngFor="let frame of airframes"> <button mat-mini-fab [ngClass]="calculateClasses(frame)" > <fa-icon icon="plane-departure" class="airframe-card-fab-icon" > </fa-icon> </button> </ng-container> 似乎有很多问题,但没有人提供具体解决方案。

[Errno 13] Permission denied

这是错误提示:

import cv2
path='Data_Set/ORL/s1'
face_set=[]
with open(path, 'rb') as pt:
    for i in pt:
        face_set.append(cv2.imread(i))

感谢您提供解决方案。

1 个答案:

答案 0 :(得分:0)

我无法用with open()解决问题,但是当我将其替换为for-loop并使用“ os” lib而不是开放式内置插件时,我可以加载数据。

import cv2
import os
path='Data_Set/ORL'
face=[]
label=[]
for fl in os.listdir(path):
    for img in os.listdir(path+'/'+fl):
        face.append(cv2.imread(path+'/'+fl+'/'+img))
        label.append(fl)