Coder Social home page Coder Social logo

Testing Output Network about renet HOT 3 CLOSED

AleLdf avatar AleLdf commented on May 28, 2024
Testing Output Network

from renet.

Comments (3)

dahyun-kang avatar dahyun-kang commented on May 28, 2024

Hello,

This code base does not officially provide such function at this point.
Unfortunately, it seems unlikely to be easily implemented from this repository. 🤔
You may need to load and transform your own query image, and replace it with the query set provided in the dataloader.

For example, the code snippet from test.py

renet/test.py

Lines 28 to 35 in b58ebc0

for i, (data, labels) in enumerate(tqdm_gen, 1):
data = data.cuda()
model.module.mode = 'encoder'
data = model(data)
data_shot, data_query = data[:k], data[k:]
model.module.mode = 'cca'
logits = model((data_shot.unsqueeze(0).repeat(args.num_gpu, 1, 1, 1, 1), data_query))

should be something like below:

        for i, (data, labels) in enumerate(tqdm_gen, 1):
            myquery = # read, transform, and load the image to the GPU here.
            data = data.cuda()
            data = torch.cat((data[:k], myquery), dim=0)
            data = model(data)
            data_shot, data_query = data[:k], data[k:]
            model.module.mode = 'cca'
            logits = model((data_shot.unsqueeze(0).repeat(args.num_gpu, 1, 1, 1, 1), data_query))
            print(logits.argmax(dim=1))  # you can see the prediction out of 0 to N-1 here

In this case, you can see how your query image is predicted based on a various compositions of support set.
Please let me know if I understood your question incorrectly.

Have a great day! 😃

from renet.

AleLdf avatar AleLdf commented on May 28, 2024

I had tried to give the following input : myquery= 'name.jpg' taken from testset. Then I had tried to give an other input:
myquery=' path to name.jpg'. In both cases I had the same following error:
TypeError: expected Tensor as element 1 in argument 0, but got str
It seems that it doesn't recognize the input myquery.
Thanks

from renet.

lyxdlut avatar lyxdlut commented on May 28, 2024

have you solved the question? can you tell me how to visualize the result?

from renet.

Related Issues (11)

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.