Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Config file #7

Closed
miaoqiz opened this issue Aug 12, 2020 · 10 comments
Closed

Config file #7

miaoqiz opened this issue Aug 12, 2020 · 10 comments

Comments

@miaoqiz
Copy link

miaoqiz commented Aug 12, 2020

Hi,

To run "run.py" inside "lgss", there seems to a "Config" file:


parser.add_argument('config', help='config file path')

Can you kindly point us to the path to it if it is somewhere in the current repository? or can you kindly provide a template?

Thanks so much and have a good day!

@AnyiRao
Copy link
Owner

AnyiRao commented Aug 14, 2020

Hi miaoqiz,

You may follow the running format in run.sh. python run.py $CONFIG.py

The path of the config file could be an absolute or relative path. :)

Best,

@miaoqiz
Copy link
Author

miaoqiz commented Aug 14, 2020

Hi,

Thanks again for the quick reply!

The "run.sh" script ran well after all the modality datasets were collected.

However, if following the three lines of commands in "GETTING_STARTED.md":


  • cd pre
  • python demodownload.py ## Download a YouTube video with pytube
  • python ShotDetect/shotdetect.py --print_result --save_keyf --save_keyf_txt ## Cut shot
  • cd ../lgss
  • python run.py config/demo.py ## Cut scene

has the following error:


...data and model loaded
...test with saved model
=> Loaded checkpoint '../run/image50/model_best.pth.tar'
0
Traceback (most recent call last):
File "run.py", line 220, in
main()
File "run.py", line 198, in main
gts, preds = test(cfg, model, test_loader, criterion, mode='test_final')
File "run.py", line 122, in test
test_loss /= batch_num
ZeroDivisionError: division by zero


When printing the length of "train_loader", "test_loader", and "val_loader", they are all "0". Thus it cannot enter the inference session inside "test(...)" function in "run.py".

Also, where do you define the source of data retrieved in the following lines in "get_data.py".


trainSet = Preprocessor(cfg, partition['train'], data_dict)
testSet = Preprocessor(cfg, partition['test'], data_dict)
valSet = Preprocessor(cfg, partition['val'], data_dict)


In the "config", it says:

'dataset': {'name': 'demo', 'mode': ['image']}

Does it mean it is located in the "data/demo" folder?

Also, what is the output like for cut-scenes? are there individual videos or time code?

Thanks so much and have a good day!

@miaoqiz
Copy link
Author

miaoqiz commented Sep 22, 2020

Hi there,

How are you?

Thanks for updating the code base!

There seems to be an issue when running:


python run.py ../config/demo.py


...visualize scene video in demo mode, the above quantitive metrics are invalid
None
Traceback (most recent call last):
File "run.py", line 210, in
main()
File "run.py", line 205, in main
scene_dict, scene_list = pred2scene(cfg, threshold=0.8)
File "SceneSeg/lgss/utilis/dataset_utilis.py", line 171, in pred2scene
scene_list,pair_list = get_demo_scene_list(cfg,pred_list)
File "SceneSeg/lgss/utilis/dataset_utilis.py", line 60, in get_demo_scene_list
for pair in pair_list:
TypeError: 'NoneType' object is not iterable


Can you kindly advise?

Also, the sample link in "pre/demodownload.py" seems to yield error related to "key".

Thanks so much and have a good day!

@AnyiRao
Copy link
Owner

AnyiRao commented Sep 22, 2020

Hi @miaoqiz

Thanks for your question.

For sure, since the demo video has no ground truth, the script python run.py ../config/demo.py generates an invalid ground truth and also yields invalid metrics.

pre/demodownload.py uses pytube to download a video from youtube. But it seems that the link is likely to be invalid for a while. It may similar to the question you posted in #8. You may also try pafy to download videos.

Best,

Hi there,

How are you?

Thanks for updating the code base!

There seems to be an issue when running:

python run.py ../config/demo.py

...visualize scene video in demo mode, the above quantitive metrics are invalid
None
Traceback (most recent call last):
File "run.py", line 210, in
main()
File "run.py", line 205, in main
scene_dict, scene_list = pred2scene(cfg, threshold=0.8)
File "/media/filmlight/F/Deep_Learning2/SceneSeg/lgss/utilis/dataset_utilis.py", line 171, in pred2scene
scene_list,pair_list = get_demo_scene_list(cfg,pred_list)
File "/media/filmlight/F/Deep_Learning2/SceneSeg/lgss/utilis/dataset_utilis.py", line 60, in get_demo_scene_list
for pair in pair_list:
TypeError: 'NoneType' object is not iterable

Can you kindly advise?

Also, the sample link in "pre/demodownload.py" seems to yield error related to "key".

Thanks so much and have a good day!

@miaoqiz
Copy link
Author

miaoqiz commented Sep 22, 2020

@AnyiRao Thanks!

Do you mean the "pair_list" is used to construct ground truth images if available? specifically, since in this scenario, the video is from somewhere else, after we segment the video, there are no ground-truth frames to compare with, the "pair_list" is thereby empty.

Also, can you kindly explain how to interpret the file format inside the "shot_txt" folder? There are 5 columns. It is unclear which one is which.

Lastly, there seems to be a small typo in "pre/place/extract_feat.py" at line#191:


img_path = get_img_folder(args.img_path, video_id)


Do you mean -

img_path = get_img_folder(args.source_img_path, video_id)


Thanks so much and have a good day!

@AnyiRao
Copy link
Owner

AnyiRao commented Sep 23, 2020

Hi @miaoqiz

Thanks for your question. The code segment you are referring to is https://github.com/AnyiRao/SceneSeg/blob/master/lgss/utilis/dataset_utilis.py#L43

The purpose of pair_list is to convert prediction {shotid:int(label)} to scenes, please see L55-L59 in the dataset_utilis.py So probably in your case, there is no scene being detected.

As stated in #5, shot_txt is the shot and frame correspondence to recover the time of each scene. You may also refer here for scene318. To be specific, the column number is the shotid (starting from 0), and the five numbers at this column are the start frame, end frame, keyframe1, keyframe2, keyframe3. And these files will be auto-parsed by the data processing codes in this repo.

Thanks for pointing out. Already fixed. 👍

Best,

@AnyiRao Thanks!

Do you mean the "pair_list" is used to construct ground truth images if available? specifically, since in this scenario, the video is from somewhere else, after we segment the video, there are no ground-truth frames to compare with, the "pair_list" is thereby empty.

Also, can you kindly explain how to interpret the file format inside the "shot_txt" folder? There are 5 columns. It is unclear which one is which.

Lastly, there seems to be a small typo in "pre/place/extract_feat.py" at line#191:

img_path = get_img_folder(args.img_path, video_id)

Do you mean -

img_path = get_img_folder(args.source_img_path, video_id)

Thanks so much and have a good day!

@miaoqiz
Copy link
Author

miaoqiz commented Sep 23, 2020

@AnyiRao Thanks so much!

The link is: https://www.youtube.com/watch?v=BSG5iHK9Scw

The content is similar to what you had before.

Visually you can observe many scene changes. Can you kindly help to see if there are any scenes to be detected?

Thanks so much!

@lmaors
Copy link

lmaors commented Oct 26, 2020

@miaoqiz Have you solved the problem,‘TypeError: 'NoneType' object is not iterable’

@miaoqiz
Copy link
Author

miaoqiz commented Oct 26, 2020

As @AnyiRao explained, probably only for some videos, the tool is able to detect scenes by converting shots. Thanks!

@miaoqiz miaoqiz closed this as completed Oct 26, 2020
@v-prgmr
Copy link

v-prgmr commented Nov 21, 2022

@miaoqiz the scenes are getting detected only for the sample video. For any other movie clip (marvel kind of action / drama) , the scenes are not getting detected and therefore I get the NoneType error. Did you manage find a way to get this working somehow for other movie clips?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants