neuralchen / SimSwap

An arbitrary face-swapping framework on images and videos with one single trained model!
Other
4.57k stars 899 forks source link

Had trouble with training, seems no img loaded. Could someone show me the structure of the dataset? #414

Open JulesLiu opened 1 year ago

JulesLiu commented 1 year ago

The system is win11, but since the codes recognize the path properly when I tried with the swapping functions, so I guess the OS/path style is not the cause. The final part I got when I started training:

… … which_epoch: 10000 -------------- End ---------------- GPU used : 0 processing Swapping dataset images... Finished preprocessing the Swapping dataset, total dirs number: 0... Traceback (most recent call last): File "train.py", line 159, in train_loader = GetLoader(opt.dataset,opt.batchSize,8,1234) File "A:\Users\UserName\anaconda3\envs\simswap\SimSwap-main\data\data_loader_Swapping.py", line 119, in GetLoader drop_last=True,shuffle=True,num_workers=num_workers,pin_memory=True) File "A:\Users\UserName\anaconda3\envs\simswap\lib\site-packages\torch\utils\data\dataloader.py", line 266, in init sampler = RandomSampler(dataset, generator=generator) # type: ignore File "A:\Users\UserName\anaconda3\envs\simswap\lib\site-packages\torch\utils\data\sampler.py", line 105, in init "value, but got num_samples={}".format(self.num_samples)) ValueError: num_samples should be a positive integer value, but got num_samples=0

My images are in the 'root' of the path I used in the training command, yeah, they are all in the same folder. My guess is that my dataset structure/style is different from the official one. But the datasets provided by the authors, especially the 512 one, is toooo large. Could someone show me the structure of the original/official dataset folders so that I can modify mine to make sure the codes can recognize it properly?

BTW, the dataset is the faces of target face from the video, right? For example, if I want to replace the Trump's face in a video, I should use his faces as the dataset, after finishing training, use that specific model, and one image of the other guy, do the swapping?

Thanks in advance!

LindiaC commented 11 months ago

Hi, I encountered the same problem and the solution are as follows: Suppose you put the images into SimSwap/dataset. And you are running the code under SimSwap. Then you should set the data path to dataset or ../dataset instead of /dataset.