Giter Club home page Giter Club logo

Comments (7)

SuzannaLin avatar SuzannaLin commented on June 21, 2024 2

I found the cause of the problem. Since I have a 4-channel model, I set pretrained: False in the config file. In model.py the default value for pretrained is True, and thus the weights of ResNet will be loaded. So we have to pass the pretrained value when defining the model

model = models.CCT(num_classes=num_classes, conf=config['model'],pretrained=config['pretrained'],testing=True)

from cct.

yassouali avatar yassouali commented on June 21, 2024

Hi @SuzannaLin

It seems from the error that the check point model only has 3 channels and not 4, maybe a double-check of the checkpoint?

from cct.

SuzannaLin avatar SuzannaLin commented on June 21, 2024

You mean the checkpoint in the saved/ folder? Where in the script is this loaded?

from cct.

yassouali avatar yassouali commented on June 21, 2024

the checkpoint you passed: ABCE_70_30_sup_alti/best_model.pth, either it is not loaded or it is not the current one since in the error you have copying a param with shape torch.Size([64, 3, 3, 3]) from checkpoint, the shape in current model is torch.Size([64, 4, 3, 3]).

from cct.

SuzannaLin avatar SuzannaLin commented on June 21, 2024

The error occurs here in the inference script:
model = models.CCT(num_classes=num_classes, conf=config['model'], testing=True, pretrained = True)
The checkpoint is only loaded after, right?

from cct.

yassouali avatar yassouali commented on June 21, 2024

yes, i think there is just a mismatch between the created model and the checkpoint, one of them still has only 3 channels

from cct.

yassouali avatar yassouali commented on June 21, 2024

@SuzannaLin thanks you posting the answer, glad it is working now

from cct.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.