Comments (5)
In the README there is a code snippet that shows how to feed in data to the networks:
mtrn = torch.hub.load(repo, 'MTRN', (125, 352), 8, 'RGB',
base_model='resnet50',
pretrained='epic-kitchens')
batch_size = 1
segment_count = 8
snippet_length = 1 # Number of frames composing the snippet, 1 for RGB, 5 for optical flow
snippet_channels = 3 # Number of channels in a frame, 3 for RGB, 2 for optical flow
height, width = 224, 224
inputs = torch.randn(
[batch_size, segment_count, snippet_length, snippet_channels, height, width]
)
# The segment and snippet length and channel dimensions are collapsed into the channel
# dimension
# Input shape: N x TC x H x W
inputs = inputs.reshape((batch_size, -1, height, width))
# You can get features out of the models
features = mtrn.features(inputs)
# and then classify those features
verb_logits, noun_logits = mtrn.logits(features)
# or just call the object to classify inputs in a single forward pass
verb_logits, noun_logits = mtrn(inputs)
print(verb_logits.shape, noun_logits.shape)
Note that the data is fed in N x TC x H x W
format. Your 180 x 224 x 224
is actually (60 x 3) x 224 x 224
. You need to introduce a batch dimension (e.g. through unsqueeze(0)
) for propagating a single example through the network.
from epic-kitchens-55-action-models.
Thank you. So I did that but I encountered an error "RuntimeError: shape '[-1, 8, 125]' is invalid for input of size 7500".
The error is encountered at this following line
if self.reshape:
413 logits_verb = logits_verb.view(
--> 414 (-1, self.num_segments) + logits_verb.size()[1:]
415 )
I suspect this could be since the input number of frames is not divisible by the num_segments? If so, do we have to add repeated frames/remove frames from input until we get something divisible by num_segments?
from epic-kitchens-55-action-models.
That's right, depending on the model you may not be able to feed more/fewer frames than it was trained with. TRN/MTRN has a fixed input size. TSM works best using the same number of frames as it was trained with, TSN can take in a variable number of frames, but you need to initialise the network with same number of segments you are going to feed into it.
from epic-kitchens-55-action-models.
This might be a stupid question, but in my case, I would have to further perform segment based sampling on the (60, 256, 456, 3) video to make it of size (8, 256, 456, 3), before passing it to the dataloader right? Because the dataloader does not seem to perform this sampling.
from epic-kitchens-55-action-models.
from epic-kitchens-55-action-models.
Related Issues (17)
- Support torch hub
- Training code? HOT 2
- Hyperparameter for reproducing TSM RGB 8 frame HOT 1
- PyTorch 1.5 compatibility HOT 1
- HTTP 404 Error HOT 2
- Where is the dataset processed? HOT 2
- Test Clips HOT 1
- Exception while importing pretrainedmodels. HOT 1
- Apply the baseline model to custom video (action detection)
- Result format is different with the dataset
- attribute error module 'pretrainedmodels.models.torchvision_models' has no attribute 'ResNet'" after downloading the action models HOT 2
- Annotation problem HOT 5
- Test problem, can not load the module. HOT 1
- Test with very low accuracy. HOT 13
- Question about Pytorch Hub HOT 1
- How do I evaluate accuracy of the test set?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from epic-kitchens-55-action-models.