Comments (38)
Did you solve the problem?
I solved!!
I will explain from 'convert frames' to 'summary2video' step by step.
step 1. edit 'videos2frames.sh' script in 'SumMe/videos' directory.
- you edit 'ffmpeg -i "$f" -f image2 frames/"$name"/%5d.png' to
'ffmpeg -i "$f" -f image2 frames/"$name"/%6d.jpg'
( if extract Summe dataset, there is 'SumMe' directory. )
step 2. convert summe dataset to frames.
- i executed 'videos2frames.sh' in 'SumMe/videos' directory.
( you should make each directories about .mp4 as 'SumMe/videos/frames/
For example, if Air_Force_One.mp4, you should make directory 'SumMe/videos/frames/Air_Force_One' )
step 3. have to map h5.file key and frame dirctory name
- in my case, i made json file.
( For example, {"video_1":"Air_Force_One", "video_2":"...", ... }.
you can see the information about mapping following code.
import h5py
import sys
h5_file_name = (sys.argv[1])
f = h5py.File(h5_file_name,'r')
for key in f.keys():
print("{} : {}".format(key, f[key]['video_name'].value))
if you edit properly "summary2video.py", script is performed.
if you need to my help, ask me.^^
from pytorch-vsumm-reinforce.
from pytorch-vsumm-reinforce.
from pytorch-vsumm-reinforce.
you can generate the frames, the way its feasible for you. I used ffmpeg and "https://github.com/SinDongHwan/pytorch-vsumm-reinforce/blob/master/utils/generate_dataset.py" , for generation of frames and feature extraction on my own dataset. I hope i understood your question properly.
from pytorch-vsumm-reinforce.
I went through this whole comment section, and this is super confusing. This is how I managed to do it, I hope it saved some time.
Note: Make sure you have the correct dataset downloaded, because it is not on github, you can download it here
Note2: In that dataset the videos2frames.sh file is actually named videos2frames.sh~
You have to change the name of the file by running in the terminal:
mv videos2frames.sh~ videos2frames.sh
Step 1: Create a folder called "frames" inside the SumMe/videos folder
Step 2:
- Install ffmpeg
- Edit 2 lines in the videos2frames.sh file: Add a new Line before line 10: mkdir frames/"$name". This will create inside the frames folder a folder with the name of each file
- Edit line 11 to this: ffmpeg -i "$f" -f image2 -vf fps=30 frames/"$name"/%6d.jpg. This will generate the frames and save them into correspondent folder. FPS needs to be set to 30 because the results.h5 file is also at 30 fps.
Step3: Run summary2video.py
- Check which videos are your test videos. You can see it when you output the results of your training. In my case image below. Note that the videos are numbered. This means e.g. video 25 is the last video in alphabetical order from the dataset: Valparaiso_Downhill
- Run the function with the inputs:
-p path of the results file ;
-d path of where the frames are stored;
-i is the index of your training videos matrix. So in my case 0 = video 12, 1 = video 25, 2 = video 4 etc
Choose a video from the 5 test videos and generate the highlight. I chose video 25 and ran
summary2video.py -p log/summe-split0/result.h5 -d datasets/videos/frames/Valparaiso_Downhill -i 1 --fps 30 --save-dir log --save-name summary.mp4
from pytorch-vsumm-reinforce.
on README,
Visualize summary
You can use summary2video.py to transform the binary machine_summary to real summary video.
You need to have a directory containing video frames.
The code will automatically write summary frames to a video where the frame rate can be controlled. Use the following command to generate a .mp4 video.
maybe, it seems that there aren't frames on "video_frames" directory. but i don't know which frames yet.
Did you solve this problem?
from pytorch-vsumm-reinforce.
from pytorch-vsumm-reinforce.
Did you see this line in summary2video.py?
we have to formate filename as "000001.jpg, 000002.jpg, ..."
and i found about number of video frames.
import h5py
h5_file_name = "datasets/eccv16_dataset_summe_google_pool5.h5"
f = h5py.File(h5_file_name,'r')
print(f['video_1']['n_frames'].value)
i can see "4494".
we can see more information about each h5 files on datasets/readme.txt .
i will try to find fps to convert frames from video correctly.
from pytorch-vsumm-reinforce.
No, we should save frames in folder.
I told you that read dataset/readme.txt to convert frames from video correctly.
Parameter "summary" of frm2video function consists of [0,1,0,1,0,0,0,...]. this length of list( [0,1,0,1,0,0,0,...] ) is maybe number of frames.
I'm not good at English, so it could be difficult for you to understand about my write.
from pytorch-vsumm-reinforce.
from pytorch-vsumm-reinforce.
if you have dataset video, could you share that? i don't have videos.
from pytorch-vsumm-reinforce.
from pytorch-vsumm-reinforce.
okay. i will try to do summary2video, too. if you can convert, please reply.
if i will be converted, i reply, too.
from pytorch-vsumm-reinforce.
Did you solve the problem?
I solved!!
I will explain from 'convert frames' to 'summary2video' step by step.step 1. edit 'videos2frames.sh' script in 'SumMe/videos' directory.
* you edit 'ffmpeg -i "$f" -f image2 frames/"$name"/%5d.png' to 'ffmpeg -i "$f" -f image2 frames/"$name"/%6d.jpg' ( if extract Summe dataset, there is 'SumMe' directory. )
step 2. convert summe dataset to frames.
* i executed 'videos2frames.sh' in 'SumMe/videos' directory. ( you should make each directories about _.mp4 as 'SumMe/videos/frames/_ For example, if Air_Force_One.mp4, you should make directory 'SumMe/videos/frames/Air_Force_One' )
step 3. have to map h5.file key and frame dirctory name
* in my case, i made json file. ( For example, {"video_1":"Air_Force_One", "video_2":"...", ... }. you can see the information about mapping following code.
import h5py import sys h5_file_name = (sys.argv[1]) f = h5py.File(h5_file_name,'r') for key in f.keys(): print("{} : {}".format(key, f[key]['video_name'].value))
if you edit properly "summary2video.py", script is performed.
if you need to my help, ask me.^^
Hello
i tried to follow the procedure you told above and made the required changes in shell file as well. But, while running a shell file I am getting "Conversion failed error". This is the error "[image2 @ 0x5654ab990a80] Could not open file : SumMe/videos/frames/Valparaiso_Downhill/%6d.jpg
av_interleaved_write_frame(): Input/output error"
frame= 1 fps=0.0 q=8.9 Lsize=N/A time=00:00:00.03 bitrate=N/A speed=1.58x
video:79kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Conversion failed!
Please help!! I am stuck with this conversion process.
from pytorch-vsumm-reinforce.
@Swati640
Hi, I think can't open file(image).
Did you try to edit shell script?
* you edit 'ffmpeg -i "$f" -f image2 frames/"$name"/%5d.png' to
'ffmpeg -i "$f" -f image2 frames/"$name"/%6d.jpg'
( if extract Summe dataset, there is 'SumMe' directory. )
If you are okay, i can see your shell on Teamviewer?
from pytorch-vsumm-reinforce.
yes, I edited the shell file completely as you told above, but it is not working.
from pytorch-vsumm-reinforce.
@Swati640
hmm...
If you are okay, could i see your situation on Teamviewer?
from pytorch-vsumm-reinforce.
Hey.. Thanks for the help. It worked for me. Had to do some changes in the shell file :)
from pytorch-vsumm-reinforce.
Hi, @Swati640
FFMPEG generate frames slowly,Can I take video source as input directly,and generate video summary
from pytorch-vsumm-reinforce.
Hi, @SinDongHwan
FFMPEG generate frames slowly,Can I take video source as input directly,and generate video summary
from pytorch-vsumm-reinforce.
@Harryjun
Thank you for kindly answer, instead of me^^
from pytorch-vsumm-reinforce.
@SinDongHwan I created a folder named video_frames which contains folder :Air_Force_One,Base_jumping.... and others containing video frames. But still i am getting the same error.Anyone who can help me out. ThankYou
from pytorch-vsumm-reinforce.
@ghagareomkar
HI, Could you tell me a error message?
from pytorch-vsumm-reinforce.
@SinDongHwan Thank You for your reply
python summary2video.py -p log/summe-split0/result.h5 -d video_frames/ -i 0 --fps 30 --save-dir log --save-name summary.mp4
this occured:
OpenCV: FFMPEG: tag 0x5634504d/'MP4V' is not supported with codec id 12 and format 'mp4 / MP4 (MPEG-4 Part 14)'
OpenCV: FFMPEG: fallback to use tag 0x7634706d/'mp4v'
Traceback (most recent call last):
File "summary2video.py", line 43, in
frm2video(args.frm_dir, summary, vid_writer)
File "summary2video.py", line 27, in frm2video
frm = cv2.resize(frm, (args.width, args.height))
cv2.error: OpenCV(3.4.3) /io/opencv/modules/imgproc/src/resize.cpp:4044: error: (-215:Assertion failed) !ssize.empty() in function 'resize'
This above error i was getting when created a folder named video_frames which contains folder :Air_Force_One,Base_jumping.... and others containing video frames.
But when i put just the frames of only one video in video_frames folder .got no error, working properly got summary for the corresponding video .Is my approach correct? ThankYou
from pytorch-vsumm-reinforce.
@ghagareomkar
please check data of frm before cv2.resize()
print(frm)
from pytorch-vsumm-reinforce.
@SinDongHwan ThankYou ,will try this
from pytorch-vsumm-reinforce.
I went through this whole comment section, and this is super confusing. This is how I managed to do it, I hope it saved some time.
Note: Make sure you have the correct dataset downloaded, because it is not on github, you can download it here
Note2: In that dataset the videos2frames.sh file is actually named videos2frames.sh~
You have to change the name of the file by running in the terminal:
mv videos2frames.sh~ videos2frames.shStep 1: Create a folder called "frames" inside the SumMe/videos folder
Step 2:
- Install ffmpeg
- Edit 2 lines in the videos2frames.sh file: Add a new Line before line 10: mkdir frames/"$name". This will create inside the frames folder a folder with the name of each file
- Edit line 11 to this: ffmpeg -i "$f" -f image2 -vf fps=30 frames/"$name"/%6d.jpg. This will generate the frames and save them into correspondent folder. FPS needs to be set to 30 because the results.h5 file is also at 30 fps.
Step3: Run summary2video.py
- Check which videos are your test videos. You can see it when you output the results of your training. In my case image below. Note that the videos are numbered. This means e.g. video 25 is the last video in alphabetical order from the dataset: Valparaiso_Downhill
- Run the function with the inputs:
-p path of the results file ;
-d path of where the frames are stored;
-i is the index of your training videos matrix. So in my case 0 = video 12, 1 = video 25, 2 = video 4 etc
Choose a video from the 5 test videos and generate the highlight. I chose video 25 and ransummary2video.py -p log/summe-split0/result.h5 -d datasets/videos/frames/Valparaiso_Downhill -i 1 --fps 30 --save-dir log --save-name summary.mp4
I was currently using a dataset of 165 MB mentioned in #40. I was getting error in that dataset during generating summary2video.py and I found out I need to use original Summe dataset of 2.2 GB. Can anyone guide me how to start from beginning.
Thanks
from pytorch-vsumm-reinforce.
Hi, @sky-16.
If you can run teamviewer, send to me email.
i will run a code.
from pytorch-vsumm-reinforce.
I want to ask, is it necessary to extract all the video frames in the dataset to make a frame dictionary? Or just a few of them? Is it OK to name them in order?
from pytorch-vsumm-reinforce.
Did you solve the problem?
I solved!!
I will explain from 'convert frames' to 'summary2video' step by step.step 1. edit 'videos2frames.sh' script in 'SumMe/videos' directory.
- you edit 'ffmpeg -i "$f" -f image2 frames/"$name"/%5d.png' to
'ffmpeg -i "$f" -f image2 frames/"$name"/%6d.jpg'
( if extract Summe dataset, there is 'SumMe' directory. )step 2. convert summe dataset to frames.
- i executed 'videos2frames.sh' in 'SumMe/videos' directory.
( you should make each directories about .mp4 as 'SumMe/videos/frames/
For example, if Air_Force_One.mp4, you should make directory 'SumMe/videos/frames/Air_Force_One' )step 3. have to map h5.file key and frame dirctory name
- in my case, i made json file.
( For example, {"video_1":"Air_Force_One", "video_2":"...", ... }.
you can see the information about mapping following code.import h5py import sys h5_file_name = (sys.argv[1]) f = h5py.File(h5_file_name,'r') for key in f.keys(): print("{} : {}".format(key, f[key]['video_name'].value))
if you edit properly "summary2video.py", script is performed.
if you need to my help, ask me.^^
excuse me,I want to ask, when I execute 'videos2frames. sh'.
'Processing ./Air_Force_One.webm file...
./Air_Force_One.webm
bash: ffmpeg: command not found' What should I do?
from pytorch-vsumm-reinforce.
Hi, @wangsen-sen.
Install ffmpeg.
ex) if your OS is ubuntu, "sudo apt-get install ffmpeg".
from pytorch-vsumm-reinforce.
from pytorch-vsumm-reinforce.
Hi, @wangsen-sen.
Install ffmpeg.
ex) if your OS is ubuntu, "sudo apt-get install ffmpeg".
Thank you very much for your reply. This problem has just been solved. If you have any questions, I'll ask you again.Good luck to you.
from pytorch-vsumm-reinforce.
Hi, @wangsen-sen.
Install ffmpeg.
ex) if your OS is ubuntu, "sudo apt-get install ffmpeg".
Hello, excuse me again. I want to ask if the final video summary can be obtained through the file, which frame is included in the original video?
from pytorch-vsumm-reinforce.
Hi, @wangsen-sen.
you can check which frames is selected in result.h5 file.
selected frames are assigned '1', not selected frames are assigned '0'.
from pytorch-vsumm-reinforce.
Hi, @wangsen-sen.
you can check which frames is selected in result.h5 file.
selected frames are assigned '1', not selected frames are assigned '0'.
Hello,I processed the result.h5 file and got the final videos tested, but I want to know which frame of the video summary is composed of. Where should I look?
from pytorch-vsumm-reinforce.
Hi, @wangsen-sen.
you can check selected frames using following code.
pytorch-vsumm-reinforce/summary2video.py
Line 41 in 77f7c93
from pytorch-vsumm-reinforce.
from pytorch-vsumm-reinforce.
Related Issues (20)
- Module Not Found Error HOT 15
- summary2video.py
- Question about Reward funtion ? HOT 1
- original Youtube and OVP datasets HOT 9
- How to find Reward Diversity score ?
- 0.0% Fscore for videos and probably wrong Summary. HOT 1
- Can not download the dataset.
- Could u tell me the relationship between 'gtscore' and 'gtsummary'? HOT 1
- Dataset for video summaization HOT 26
- Link to download dataset in repo is dead. HOT 2
- H5 dataset generation
- frame score
- Few Frame Ids from MachineSummary not available in VideoFrames generated. HOT 1
- Processed features and original videos HOT 1
- Problem with video index when running "summary2video.py" HOT 1
- GoogLe Net implementation HOT 5
- splits
- dist_mat = dist_mat.min(1, keepdim=True)[0] IndexError: Dimension out of range HOT 1
- DataSet Out of Date
- FileNotFoundError: [Errno 2] No such file or directory: 'path_to_your_model.pth.tar' HOT 1
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 pytorch-vsumm-reinforce.