Currently, I have a pre-trained model that uses a DataLoader for reading a batch of images for training the model.
self.data_loader = torch.utils.data.DataLoader(dataset, batch_size=batch_size, shuffle=False,
num_workers=1, pin_memory=True)
...
model.eval()
for step, inputs in enumerate(test_loader.data_loader):
outputs = model(torch.cat([inputs], 1))
...
I want to process (make predictions) on images, as they arrive from a queue. It should be similar to a code that reads a single image and runs the model to make predictions on it. Something along the following lines:
from PIL import Image
new_input = Image.open(image_path)
model.eval()
outputs = model(torch.cat([new_input ], 1))
I was wondering if you could guide me how to do this and apply the same transformations in the DataLoader.