In my project, I extracted frames from a video and in another folder I have ground truth for each frame. I want to map the ground truth image of each frame of a video (in my case, it is saliency prediction ground truth) on its related frame image. As an example I have the following frame:
And the following is ground truth mask:
and the following is the mapping of ground truth on the frame.
How can I do that. Also, I have two folders that inside each of them, there are several folders that inside each of them the there are stored frames. How can I do this operation with these batch data?
This is the hierarchy of my folders:
frame_folder: folder_1, folder_2, ......
├── frames
│ ├── 601 (601 and 602 and etc are folders that in the inside there are image frames that their name is like 0001.png,0002.png, ...)
│ ├── 602
.
.
.
│ └── 700
├── ground truth
│ ├── 601 (601 and 602 and etc are folders that in the inside there are ground truth masks that their name is like 0001.png,0002.png, ...)
│ ├── 602
.
.
.
│ └── 700
Update: Using the answer proposed by @hkchengrex , I faced with an error. When there is only one folder in the paths, it works well but when I put several folders (frames of different videos) based on the question I face with the following error. the details are in below:
multiprocessing.pool.RemoteTraceback:
"""
Traceback (most recent call last):
File "/home/user/miniconda3/envs/vtn/lib/python3.10/multiprocessing/pool.py", line 125, in worker
result = (True, func(*args, **kwds))
TypeError: process_video() takes 1 positional argument but 6 were given
"""
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/user/Video_processing/Saliency_mapping.py", line 69, in <module>
pool.apply(process_video, videos)
File "/home/user/miniconda3/envs/vtn/lib/python3.10/multiprocessing/pool.py", line 357, in apply
return self.apply_async(func, args, kwds).get()
File "/home/user/miniconda3/envs/vtn/lib/python3.10/multiprocessing/pool.py", line 771, in get
raise self._value
TypeError: process_video() takes 1 positional argument but 6 were given