The given code is showing me the error; I am making the folder under folder under folder according to different classes and its videos. train is folder contains different class folder, every class folder have certain videos. directory of train is something like this;
---train
----class1
----video11.mp4
----video12.mp4
...
----class2
----video21.mp4
----video22.mp4
...
...
I want to create folders of above directory like this;
---train_data
----class1
----video11
----video12
...
----class2
----video21
----video22
...
...
I have written this code, but this is showing error, I don't know why os.mkdir is not working here
import cv2
import os
from tqdm import tqdm
for data_dir, dest_dir in ["train", 'train_data'],["val", 'val_data']:
for classes in tqdm(os.listdir(data_dir)):
for videos in os.listdir(data_dir + '/' + classes):
print(videos)
print(classes)
print(dest_dir)
if not os.path.exists(dest_dir + '/' + classes + '/' + videos):
os.mkdir(dest_dir + '/' + classes + '/' + videos)
Error:
v_ApplyEyeMakeup_g01_c01.avi
ApplyEyeMakeup
train_data
0%| | 0/101 [00:00<?, ?it/s]
Traceback (most recent call last):
File "F:/Research/Action Recognition/Mine/data.py", line 12, in <module>
os.mkdir(dest_dir + '/' + classes + '/' + videos)
FileNotFoundError: [WinError 3] The system cannot find the path specified: 'train_data/ApplyEyeMakeup/v_ApplyEyeMakeup_g01_c01.avi'
My directory is;