Comments (7)
You can use cv2.VideoCapture
to read in the video (no matter read videos offline or read videos from camera), then get the frames, and finally do the prediction. Something like this,
cap = cv2.VideoCapture(VIDEO_NAME)
net = get_model(MODEL_NAME)
while(cap.isOpened()):
ret, frame = cap.read()
input = preprocess(frame)
pred = net(input)
if not ret: break
cap.release()
from two-stream-pytorch.
@bryanyzhu Thank you very much. Let me have a try
from two-stream-pytorch.
@bryanyzhu Hello, I have another question:
Lines 85 and 86 of the flow_vgg16.py file look like this:
rgb_weight_mean = torch.mean(rgb_weight, dim=1)
flow_weight = rgb_weight_mean.repeat(1,in_channels,1,1)
However, lines 179 and 182 of the file flow_resnet.py look like this:
rgb_weight_mean = torch.mean(rgb_weight, dim=1)
flow_weight = rgb_weight_mean.unsqueeze(1).repeat(1,in_channels,1,1)
How do I make sense of the difference
from two-stream-pytorch.
For current PyTorch version, I think the second one is more rigorous. But both of them should work because many operators support automatic broadcasting, so users don't need to worry about the dimension mismatch.
from two-stream-pytorch.
@bryanyzhu Ok, I get an error when I run the first one, and then I run it perfectly with the second modification.Thank you for your reply. I will consult you if I have any questions
from two-stream-pytorch.
@bryanyzhu
In VideoSpatialPrediction. py :
def VideoSpatialPrediction(
vid_name,
net,
num_categories,
start_frame=0,
num_frames=0,
num_samples=25
) :
Is num_samples the number of test videos in here?
The other problem is:
The model was tested using recorded video. What should I do if I want to test it online?
from two-stream-pytorch.
num_samples
means number of frames sampled from one video. This is the standard evaluation setting used before, that is, we take 25 frames per video and do 10-crop per frame. So for each video, we actually perform 250 forward and average the predictions to get the final result.
For online videos, usually what people do (or the simplest way) is to wait for a few frames, do the prediction and perform average. Then doing the same thing in a sliding window fashion.
from two-stream-pytorch.
Related Issues (20)
- About pre-trained Model HOT 2
- test video HOT 5
- Question about training the models together HOT 2
- Different running env? HOT 5
- Can you provide your results for loss and accuracy values of spatial and temporal training?
- The number of GPUs? HOT 1
- I use your restnet152 model parameters for testing, but in split_1 the accuracy is only 67.59%.
- Problems about VideoSpatialPrediction.py HOT 2
- How is the two streams fused ? HOT 1
- What is the accuracy of UCF101?
- what's version of pytorch and cuda
- dense_flow 可不可以在windows安装 HOT 1
- 如果没有安装dense_flow,运行build_of.py文件,是不是不会运行出结果 HOT 1
- fusion two stream feature?
- a PROBLEM when using VGG as motion model
- 老师我想问下怎么late fusion呀 HOT 1
- 关于抽帧的图片存放路径 HOT 2
- video sampling rate in training two-stream network
- About parameter --new_length in training RGB videos
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 two-stream-pytorch.