torchvision

What is running loss in PyTorch and how is it calculated

What is running loss in PyTorch and how is it calculated Question: I had a look at this tutorial in the PyTorch docs for understanding Transfer Learning. There was one line that I failed to understand. After the loss is calculated using loss = criterion(outputs, labels), the running loss is calculated using running_loss += loss.item() …

Total answers: 2

How to generate accurate masks for an image from Mask R-CNN prediction in PyTorch?

How to generate accurate masks for an image from Mask R-CNN prediction in PyTorch? Question: I have trained a Mask RCNN network for instance segmentation of apples. I am able to load the weights and generate predictions for my test images. The masks being generated seem to be in the correct location, but the mask …

Total answers: 2

How to convert a list of images into a Pytorch Tensor

How to convert a list of images into a Pytorch Tensor Question: I have a list called wordImages. It contains images in np.array format with different width & height. How Do I convert this into a tensor and use this instead of my_dataset in the below code? Currently i am using this. But I need …

Total answers: 1

How to use torchvision.transforms for data augmentation of segmentation task in Pytorch?

How to use torchvision.transforms for data augmentation of segmentation task in Pytorch? Question: I am a little bit confused about the data augmentation performed in PyTorch. Because we are dealing with segmentation tasks, we need data and mask for the same data augmentation, but some of them are random, such as random rotation. Keras provides …

Total answers: 4

PyTorch [1 if x > 0.5 else 0 for x in outputs ] with tensors

PyTorch [1 if x > 0.5 else 0 for x in outputs ] with tensors Question: I have a list outputs from a sigmoid function as a tensor in PyTorch E.g output (type) = torch.Size([4]) tensor([0.4481, 0.4014, 0.5820, 0.2877], device=’cuda:0′, As I’m doing binary classification I want to turn all values bellow 0.5 to 0 …

Total answers: 3

How downsample work in ResNet in pytorch code?

How downsample work in ResNet in pytorch code? Question: In this pytorch ResNet code example they define downsample as variable in line 44. and line 58 use it as function. How this downsample work here as CNN point of view and as python Code point of view. code example : pytorch ResNet i searched for …

Total answers: 4

Is there any way I can download the pre-trained models available in PyTorch to a specific path?

Is there any way I can download the pre-trained models available in PyTorch to a specific path? Question: I am referring to the models that can be found here: https://pytorch.org/docs/stable/torchvision/models.html#torchvision-models Asked By: gopalkrizna || Source Answers: TL;DR: No, it is not possible directly, but you can easily adapt it. I think what you want to …

Total answers: 4

How can I generate and display a grid of images in PyTorch with plt.imshow and torchvision.utils.make_grid?

How can I generate and display a grid of images in PyTorch with plt.imshow and torchvision.utils.make_grid? Question: I am trying to understand how torchvision interacts with mathplotlib to produce a grid of images. It’s easy to generate images and display them iteratively: import torch import torchvision import matplotlib.pyplot as plt w = torch.randn(10,3,640,640) for i …

Total answers: 2