wuhuikai / FaceSwap

Swap face between two photos.
724 stars 225 forks source link

How to use for loop to vist all file? #42

Closed aprillefou666 closed 1 year ago

aprillefou666 commented 1 year ago

​Hi, I try to produce lots of images at once, like codes below,but it seems it doesn't work, ​How can I make it work? ​Thanks a lot

[in]: import os DOG = os.listdir("/content/drive/MyDrive/FaceSwap-master/dog")

for i in DOG: !python main.py --src imgs/kage.jpg --dst DOG/i --out results/i --correct_color

[out]: [ WARN:0@1.155] global /io/opencv/modules/imgcodecs/src/loadsave.cpp (239) findDecoder imread_('DOG/i'): can't open/read file: check file path/integrity Traceback (most recent call last): File "main.py", line 27, in dst_faceBoxes = select_all_faces(dst_img) File "/content/drive/MyDrive/FaceSwap-master/face_detection.py", line 74, in select_all_faces faces = face_detection(im) File "/content/drive/MyDrive/FaceSwap-master/face_detection.py", line 11, in face_detection faces = detector(img, upsample_times) TypeError: call(): incompatible function arguments. The following argument types are supported:

  1. (self: _dlib_pybind11.fhog_object_detector, image: array, upsample_num_times: int=0) -> _dlib_pybind11.rectangles
wuhuikai commented 1 year ago

Is DOG/i an image?

aprillefou666 commented 1 year ago

"DOG" is a folder "i" is "for i"

thx

wuhuikai commented 1 year ago

--dst must be an image