I am doing some projects with the dataset from
http://www-prima.inrialpes.fr/Pointing04/data-face.html
These datasets are image files named with specific rules described on the link above.
From the filename, I can extract the angle information of the image.
By the way, the problem is made when I load the file.
I loaded the images with data loader from torchvision
Related codes are like below(referenced at the tutorial of the PyTorch).
import os
import torch
import pandas as pd
from skimage import io, transform
import numpy as np
import matplotlib.pyplot as plt
from torch.utils.data import Dataset, DataLoader
import torchvision
import torchvision.transforms as transforms
import string
import math
def imshow(img):
img = img / 2 + 0.5
npimg = img.numpy()
plt.imshow(np.transpose(npimg, (1, 2, 0)))
plt.show()
path = 'C:\\Users\\~~~~~~'
transform = transforms.Compose(
[transforms.ToTensor(),
transforms.Normalize((0.5, 0.5, 0.5), (0.5, 0.5, 0.5))])
train_loader = torch.utils.data.DataLoader(
torchvision.datasets.ImageFolder(path, transform=transform),
batch_size=4,
num_workers=0,
shuffle=True)
dataiter = iter(train_loader)
images = dataiter.next()
# show images
# print(images[0])
imshow(torchvision.utils.make_grid(images[0]))
I loaded the images as batches( batch size is 4). But, I couldn’t load the filenames of the images.
Questions are simple.
-
Can I load the filenames with images at the same time?
-
I made the angle data separately. Can I load the data with image by the elements?( not in order, because I want to train the network with shuffled )
-
Any other special solutions for these datasets to be trained?