So I want to read mutiple text file from my folder with followinh code but i encounter the PermissionError: [Errno 13] Permission denied, anyone know how should i modify my code so i can succesfully get my data from folder?
X_train = np.loadtxt('D:/Object/train(text)')
X_test = np.loadtxt('D:/Object/test(text)')
print("Shape of training set: {}".format(X_train.shape))
print("Shape of testing set: {}".format(X_test.shape))
def image_grid(D,H,W,cols=10,scale=1):
""" display a grid of images
H,W: Height and width of the images
cols: number of columns = number of images in each row
scale: 1 to fill screen
"""
n = np.shape(D)[0]
rows = int(math.ceil((n+0.0)/cols))
fig = plt.figure(1,figsize=[scale*20.0/H*W,scale*20.0/cols*rows],dpi=300)
for i in range(n):
plt.subplot(rows,cols,i+1)
fig=plt.imshow(np.reshape(D[i,:],[H,W]), cmap = plt.get_cmap("gray"))
plt.axis('off')
H = 250
W = 250
This how my folder look like
example result
this is how i hope it came out
New contributor
YX W is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.