Giter Club home page Giter Club logo

Comments (5)

Atze00 avatar Atze00 commented on July 16, 2024

You can do streaming inference either submitting the whole clip to the network, or submitting subclips without cleaning the buffer (similarly to how it is done in training).
The simplest way is the first one and you perform inference almost like the non streaming network, you just have to remember to clear the stream buffer every new clip like in the code snippet below.
There is not much documentation because currently the streaming models are not available pretrained.

def evaluate(model, data_load, loss_val):
    model.eval()
    
    samples = len(data_load.dataset)
    csamp = 0
    tloss = 0
    with torch.no_grad():
        for data, _, target in data_load:
            model.clean_activation_buffers()
            output = F.log_softmax(model(data), dim=1)
            loss = F.nll_loss(output, target, reduction='sum')
            _, pred = torch.max(output, dim=1)
            
            tloss += loss.item()
            csamp += pred.eq(target).sum()
    aloss = tloss / samples
    loss_val.append(aloss)

from movinet-pytorch.

riyaj8888 avatar riyaj8888 commented on July 16, 2024

thanks .
if models is trained on let us assume on (50,224,224,3) input size then how are they doing inference ? because on official implementation ,we can pass any input size .
but how it is possible ,once model is trained on 50 frame inputs.
can you explain.
https://github.com/tensorflow/models/tree/master/official/vision/beta/projects/movinet

from movinet-pytorch.

Atze00 avatar Atze00 commented on July 16, 2024

If you have question about the official implementation you should ask them, I'm not aware of every details of their implementation.
Anyway, In a general sense you can always change the input shape, generally neural networks are resilient to changes in input shapes. You probably won't get the same accuracy though.
To further explain, in the notebook linked below I finetune with a different number of frames (16), on another dataset and it is perfectly fine.
https://github.com/Atze00/MoViNet-pytorch/blob/main/movinet_tutorial.ipynb

from movinet-pytorch.

riyaj8888 avatar riyaj8888 commented on July 16, 2024

can you explain how to do inference on single video? you didnt mentioned it into your notebook.
also where are you saving model checkpoint and how do you loading it during inference .

from movinet-pytorch.

Atze00 avatar Atze00 commented on July 16, 2024

These questions are related to the Pytorch framework more than this particular implementation, you can ask to a pytorch forum if you have problems doing inference of one single sample. The model is kept in ram, it is not saved on the disk and reloaded at least in the tutorial. You can easily find pytorch tutorials on how to save and load models.

from movinet-pytorch.

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.