769 questions
0
votes
0
answers
12
views
How to Combine Fine-Tuned Pre-Trained Models on a Custom Dataset in PyTorch?
I have a custom image dataset with 41 classes, and I've fine-tuned this dataset on six pre-trained models:
ConvNeXt
DenseNet
EfficientNet
RegNet
ResNet
Swin Transformers
After fine-tuning, I saved ...
0
votes
1
answer
74
views
"NotImplementedError: Could not run 'aten::add.out' with arguments from the 'QuantizedCPU' backend" while implementing QAT on resnet18 using pytorch
I am trying to implement Quantization Aware Training(QAT) resnet18 model. While inferring I get this error
NotImplementedError: Could not run 'aten::add.out' with arguments from the 'QuantizedCPU' ...
0
votes
0
answers
20
views
Mismatch in tensor dimensions in BayesianFPN with Reinforcement Learning
I am implementing a computer vision project. I have used an FPN (with ResNet50 backbone) and BayesianFPN in this project. This network is under a Reinforcement Learning Agent. Upon implementation, it ...
-1
votes
0
answers
18
views
FCN ResNet18 low precision on SUNRGBD dataset
I am conducting an experiment, for the purposes of this experiment it is necessary for the resnet18 network to be accurate. The idea is to implement the network on the Jatson Nano microcontroller ...
0
votes
0
answers
22
views
Exception encountered when calling layer 'keras_layer_1' (type KerasLayer)
I encountered an error while working on a google colab notebook.
the error is:
ValueError Traceback (most recent call last)
in <cell line: 17>()
15 model_url = &...
0
votes
0
answers
26
views
How to compute Hessian-vector product over a subset of parameters
I'm trying to get eigenvalues and eigendensity of the Hessian matrix over a subset of (ResNets') parameters.
I was using PyHessian Package from https://github.com/amirgholami/PyHessian. Since it's ...
0
votes
0
answers
33
views
Model is unable to overfit, even with a tiny dataset
I'm trying to create a CNN that can predict the position of up to 5 objects. Each point has 4 values: x and y coordinates, a presence value(0 if it's a padding value, 1 if it exists) and a depth value(...
0
votes
0
answers
34
views
ValueError while loading my Keras model after doing Transfer Learning
I have developed a sign language recognition model using the ResNet50 architecture as the base model for recognizing Urdu sign language. The model architecture is defined as follows:
base_model = ...
0
votes
1
answer
51
views
Resnet inconsistency between train and eval mode
I'm trying to implement the Resnet in torch. But I found the output of the forward pass varies greatly between train and eval mode. Since the train and eval mode doesn't affect anything besides batch ...
0
votes
1
answer
289
views
Resnet out of memory: torch.OutOfMemoryError: CUDA out of memory
I'm training an end-to-end model on a video task. I used Pytorch ResNet50 as the encoder, and the input shape is (1,seq_length,3,224,224), where seq_length is the number of frames in each video. For ...
0
votes
1
answer
36
views
Using pre-trained models to process MRI images
It is known that MRI images are single-channel, but all pre-trained models accept only three-channel images as input. Therefore, I have a question:
Should I make a three-channel image from a single-...
-1
votes
2
answers
44
views
Using ResNet50 to create a feature tensor of [w, h, f]
I'm trying to implement this paper but I'm not following something in it.
It wants me to use ResNet50 to extract features from an image but tells me the extracted features will be of dimension [w, h, ...
0
votes
0
answers
22
views
Model accuracy(inference) is almost zero for resnet50 using tensorflow cpp api
I am using tensorflow cpp api to do inference for imagenet 2012 validation dataset using resnet50 model. I have saved the pre-trained model(on resnet50) using model=tf.keras.applications.ResNet50(...
0
votes
0
answers
33
views
How to Train a Network to Distinguish True and False Outputs from a Pretrained ResNet on CIFAR-10
I'm trying to perform image classification on CIFAR-10 using ResNet. By pretraining ResNet, I was able to achieve a performance improvement of 92% on CIFAR-10.
Next, I want to add a fully connected ...
0
votes
1
answer
325
views
How to implement Grad-CAM to view activation map/heat maps on TensorFlow ResNet152V2 for image Classification
Hello I'm doing a small project on TensorFlow image classification using ResNet152V2.
I wrote a Train-Predict.py script that's able to train a trained_weights.hdf5 file to successfully predict images ...
0
votes
0
answers
271
views
CUDA Out of Memory Error with RTX 4060 When Training ResNet-18 on 128x128 Images
I am encountering a CUDA out-of-memory error while training a ResNet-18 model on 128x128 images using my RTX 4060 GPU. Despite reducing the batch size, I still face this issue. Below are the details ...
0
votes
1
answer
46
views
Resnet18 model returning 0% accuracy on test set
I have trained a Resnet18 PyTorch model on a set of images for binary classification. I pre-loaded the Resnet18 architecture and trained the model for 10 epochs and a batch size of 4. My training ...
0
votes
1
answer
232
views
AttributeError: 'NoneType' object has no attribute 'items' when training DL dataset made using 'ImageDataGenerator'
I am trying to train a resnet50 model using transfer learning and a dataset containing 40,000 images.
I used ImageDataGenerator to prepare the dataset and then used flow_from_directory to make the ...
0
votes
0
answers
30
views
Setup a Residual Neural Network block in tfjs tensorflow.js
I am trying to implement the behavior of a ResNet (Residual Neural Network) in tensorflow.js. I am hoping someone who knows what they are doing can point me in the right direction. Would the following ...
0
votes
1
answer
651
views
I want to train a resnet 50 model for an image clasification task, how do I modify the layers so that it accepts a 64x64 image?
I want to train a resnet 50 model for an image clasification task. The default model requires 224x224 images, my dataset has 64x64 images and it seems wasteful to first upscale them then train on that ...
0
votes
0
answers
44
views
Differences on features extraction + logistic regression vs features extraction + dense layer with softmax
I have a small database of images for a classification problem, therefore I opt for the transfer learning methodology. I started with the classic approach in Tensorflow:
A pretrained ResNet50 on the ...
1
vote
0
answers
49
views
Vector collapse with batch hard triplet mining (Siamese Network)
I am having this problem for a long time while trying to recreate this paper's https://arxiv.org/pdf/1703.07737 implementation in tensorflow 2.10.0.
The problem is when i apply the same loss and data ...
0
votes
0
answers
39
views
Why Do I Need to Retrain Model in Jetson Nano Projects After Kernel Restart or Device Shutdown?
I've been diving into the "Getting Started with AI on Jetson Nano" course and got my environment all sorted out using Docker. However, I've hit a snag - it seems like every time I restart ...
0
votes
1
answer
153
views
What's the correct way of expressing Residual Block with forward function of pytorch?
AFAIK there are 2 ways to express ResNet Block in pytorch:
Copy the input in the beginning, modify the input in the process, add the copy in the end.
Preserve the input in the beginning, create new ...
0
votes
0
answers
108
views
Does Grad-CAM++ provide explanations for both classes in binary classification?
I used Resnet50 model in binary classification and BCE Loss as the loss function. The labels were 0 and 1.
The accuracy of the model was almost 100% and the class distribution of the test set was ...
0
votes
0
answers
32
views
How come my model in tensorflow.js is not predicting correctly but in python it is? [Resnet-50 Transfer Learning]
I have checked with about 20 images. The same ones for python, and the same ones with tensorflow.js with extremely similar preprocessing. It keeps giving me the 0th class.
Here is my python training ...
0
votes
0
answers
69
views
Training Resnet18 on MedMNIST data problem with datatypes
I want to train a model on the MedMNIST database, specifically RetinaMNIST.
I start by defining the data transforms and creating the dataloaders:
import torch
import torch.nn as nn
import torch.optim ...
0
votes
0
answers
66
views
Difference between pytorch timm models for
Pytorch timm model
timm.list_models("*resnet18*", pretrained=True)
outputs
['legacy_seresnet18.in1k',
'resnet18.a1_in1k',
'resnet18.a2_in1k',
'resnet18.a3_in1k',
'resnet18....
0
votes
0
answers
63
views
Pytorch resnet wrong predictions
I am using the pytorch resnet for the first time (model = models.segmentation.fcn_resnet50(pretrained=True)) to classify satellite images of land. My goal is to get the percentage of the land covered ...
0
votes
0
answers
16
views
Importing and loading images dataset and their corresponding labels to train ResNet50 in Keras
I need to import the dataset images which are in a jpg format and their coressponding labels in a csv file containing your image_name in the 1st column, width and height in 2nd and 3rd columns. How to ...
0
votes
0
answers
21
views
mat1 and mat2 shapes cannot be multiplied (32x1000 and 512x128)
I am doing an anthracnose disease detection on carabao mango using Google Colab. I am currently using the ResNet18 model with Training, Validation, and Testing datasets.
class MangoDiseaseDetection(nn....
0
votes
0
answers
210
views
Multi class image classification: Yolov8 much higher recall than Resnet (PyTorch)
I'm trying to do multi class image classification of wood veneer defects. I have 11 classes with 60-150 images per class. (Quite difficult problem since there isn't much data).
As reference I tried ...
1
vote
2
answers
41
views
ResNet50 CNN model won't fit
Below is my code for a CNN using ResNet50, I have used it in the past however, I recently changed the structure of the input to the model and I seem to get the following error below. I also printed ...
0
votes
0
answers
27
views
Working with multiple input data (image, float64 value) on InceptionV3
def inceptionV3(reshaped_images, scores, y, unique_y_values, percentage):
X_train, X_test, y_train, y_test = train_test_split(reshaped_images, y, test_size=1-percentage, random_state=42)
...
1
vote
0
answers
2k
views
"PytorchStreamReader failed reading zip archive", but downloaded file is correct
I am trying to torch.load a weights file, my_model.ckpt. The model I am working with uses resnet18, so torch.load will download its weights, specifically resnet18-5c106cde.pth, and then use it. The ...
0
votes
0
answers
8
views
PyTorch training loss is 0.00 and validation Accuracy is 1.00
This is a problem of classifying ischemic stroke, using the ResNet101 pre-trained model, and the data image is processed by wavelet transform. But why is the loss value not 0 only in epoch 1, the rest ...
0
votes
1
answer
26
views
Value for in_feature not changing
I am making a deep learning model using resnet for multiclass classification and in it i am facing the problem of overfitting. To fix it i tried to reduce the layers of resnet and i am facing this ...
0
votes
1
answer
140
views
Validation accuracy going over 100% in Pytorch?
I am currently doing a project where I am attempting to correctly classify images of breast cancer tumors to predict if they are benign (ok) or malignant (dangerous) for which I am using Pytorch. I ...
-1
votes
1
answer
205
views
attention map for an image
I am new to pytorch. I want to use imagenet images to understand how much each pixel contributes to the gradient. For this, I am trying to construct attention maps for my images. However, while doing ...
-1
votes
1
answer
66
views
Can't get torch model to run on GPU even though it's a recognized device
I'm using resnet18 for for grounded image semgmentation but when I pass the input to the model I get this torch error:
RuntimeError: Input type (torch.FloatTensor) and weight type (torch.cuda....
0
votes
0
answers
175
views
freeze some layers in ResNet
I am new to PyTorch and ML programming. I want to train a ResNet for image classification and I am attempting to freeze all layers of the ResNet except for layer4 and FC layers. The following is my ...
0
votes
0
answers
204
views
Onnx inference differs from Pytorch inference
I trained a custom PyTorch model and it's showing good results, when I exported it to onnx and tried to inference, I got absolutely different results on the same data I pushed to PyTorch.
Here is the ...
0
votes
0
answers
285
views
RuntimeError: The size of tensor a (4) must match the size of tensor b (128) at non-singleton dimension 1
I am new to PyTorch and ML programming in general and I am facing an error while training a ResNet. I first downloaded a CIFAR-10 images from PyTorch datasets and rotated them using a random angle (...
0
votes
0
answers
131
views
Shape mismatch. The variable shape (1, 1, 256, 512), and the assigned value shape (512, 128, 1, 1) are incompatible
I'm running this code and I have adjusted as shown below:
import requests
//first block
import requests
url = 'https://github.com/fchollet/deep-learning-models/releases/download/v0.2/...
0
votes
1
answer
63
views
Simple ResNet model can not tell if two monotone images are the same color
I was experimenting with a problem training an image comparison model. I simplified it to the following problem.
I give pairs of images (3x128x128) to a model. The images are either completely black ...
1
vote
1
answer
2k
views
ValueError: Invalid dtype: object in Tensorflow model.fit
i am training a model on kaggle here is the code, i am having some problem in encoding my data, after multiple attempts i am here
https://codefile.io/f/bl9Smlnxtp
# Define transformations
...
1
vote
1
answer
91
views
Resnet50 for binary classification predicts all the images to be of the same class
I'm working on a binary classification problem using Resnet50 model, the confusion matrix show that the model predict all the images as 0, is there any error on my code ?
import os
import pandas as pd
...
0
votes
0
answers
60
views
Heat map of an image using ReaNet
I need to make a heat map for one cat from one.jpg to two.jpg (contains many cats) using ResNet and F.conv2d
I have the code, but the heatmap turns out completely black and I don't really understand ...
0
votes
0
answers
32
views
Is it possible to extract a intermediate layer of ResNet and make feature map which will be used as input of Faster RCNN?
I'm wondering whether is it possible to extract a intermediate layer of ResNet and make feature map which will be used as input of Faster RCNN. I want the same size of feature map from original output ...
0
votes
0
answers
43
views
How do I combine multiple video inputs into a (2+1)D ResNet
I have developed a v1 of a (2+1)D ResNet which takes in pixel data per frame as an input and is used to predict bounding box coordinates of up to 8 objects in that video. The shape of my current input ...