mmaction2
mmaction2 copied to clipboard
NameError: name 'args' is not defined
(open-mmlab) C:\Users\admin\Desktop\mmaction2\mmaction2>python tools/data/build_rawframes.py C:\Users\admin\Desktop\mmaction2\mmaction2\data\mydataset\input_sample C:\Users\admin\Desktop\mmaction2\mmaction2\data\mydataset\output_sample --task both --level 1 --flow-type tvl1 --ext mp4 Reading videos from folder: C:\Users\admin\Desktop\mmaction2\mmaction2\data\mydataset\input_sample Extension of videos: mp4 Total number of videos found: 3 multiprocessing.pool.RemoteTraceback: """ Traceback (most recent call last): File "C:\Users\admin\anaconda3\envs\open-mmlab\lib\multiprocessing\pool.py", line 121, in worker result = (True, func(*args, **kwds)) File "C:\Users\admin\anaconda3\envs\open-mmlab\lib\multiprocessing\pool.py", line 44, in mapstar return list(map(*args)) File "C:\Users\admin\Desktop\mmaction2\mmaction2\tools\data\build_rawframes.py", line 29, in extract_frame out_full_path = args.out_dir NameError: name 'args' is not defined """
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "tools/data/build_rawframes.py", line 276, in
(open-mmlab) C:\Users\admin\Desktop\mmaction2\mmaction2>
Anyone can help me to fix this error?
For convenience, you can set args
as a global variant.
@dreamerlin , does this problem occur in the official script?
I rerun it successfully. Based on my wild guess, it may cause by the version of Python
I am having the same issue
A workaround is to edit the build_rawframes.py file and hardcode wherever the args variable is used. For example,
before:
out_full_path = args.out_dir #on line 29
after:
out_full_path = r'C:\path\to\mmaction2\data\ucf101'
Saved here: https://github.com/open-mmlab/mmaction2/issues/1719
you use windows so the behaviors of multiprocesses is spawn not like fork in linux . the program in other processes can not go through the main block,so they cant get the args . you can try to put args out of the main block ,or put the args as a argument into the subprocesses.
you use windows so the behaviors of multiprocesses is spawn not like fork in linux . the program in other processes can not go through the main block,so they cant get the args . you can try to put args out of the main block ,or put the args as a argument into the subprocesses.
Thank you so much, it works!