Git Product home page Git Product logo

Comments (7)

quantarb avatar quantarb commented on May 22, 2024 2

I added a new parameter called save_swaps. If you check this option or set this value to True, it will save the swapped images for a video file as well as the video itself. Please see the updated colab notebook below.

https://colab.research.google.com/gist/quantarb/6327c2ef8f72ebeb0e41541f8476f4ce/sber-swap.ipynb

from ghost.

netrunner-exe avatar netrunner-exe commented on May 22, 2024 1

Here you go. I modified the colab notebook. This notebook does the following.

1. Iterate through each image zip file or video file in your dst folder.

2. Extract images from the zip file or video file into a temp folder.

3. Attempts to sber swap each image in the temp folder and saves the swapped image in the swapped folder.

4. If the original file was a zip, it will zipped all the images and save it as a zip file with the same name in the result folder.

5. If the original file was a video file it will make a video from all the swapped images and save it with the name in the result folder.

https://colab.research.google.com/gist/quantarb/5073703261652edde5464db0cacd9059/sber-swap.ipynb

Big thanks for the reply and for the link! At the moment I'm using my own version of Colab and using video processing either as written in the readme. Yes, I can export video to frames with FFmpeg or opencv and batch process the images and then assemble them into a video or GIF, but I mean it would be great to have the option like --save_frames to save the final images during processing in a separate folder! Thanks

from ghost.

quantarb avatar quantarb commented on May 22, 2024

Here you go. I modified the colab notebook. This notebook does the following.

  1. Iterate through each image zip file or video file in your dst folder.
  2. Extract images from the zip file or video file into a temp folder.
  3. Attempts to sber swap each image in the temp folder and saves the swapped image in the swapped folder.
  4. If the original file was a zip, it will zipped all the images and save it as a zip file with the same name in the result folder.
  5. If the original file was a video file it will make a video from all the swapped images and save it with the name in the result folder.

https://colab.research.google.com/gist/quantarb/6327c2ef8f72ebeb0e41541f8476f4ce/sber-swap.ipynb

from ghost.

antonsanchez avatar antonsanchez commented on May 22, 2024

In video_processing.py there is a function read_video. In that function you could simply save the images to disk.

from ghost.

netrunner-exe avatar netrunner-exe commented on May 22, 2024

In video_processing.py there is a function read_video. In that function you could simply save the images to disk.

Hey! If I understand correctly, this function is responsible for counting frames from the video, but I meant to save full frames with the face already replaced. I tried to add in def get_final_video something like cv2.imwrite("/content/sber-swap/tmp_frames", result_frames[i]) but unfortunately I'm not strong in Python to do it right.

from ghost.

Lyntai avatar Lyntai commented on May 22, 2024

I added a new parameter called save_swaps. If you check this option or set this value to True, it will save the swapped images for a video file as well as the video itself. Please see the updated colab notebook below.

https://colab.research.google.com/gist/quantarb/6327c2ef8f72ebeb0e41541f8476f4ce/sber-swap.ipynb

You did a splendid job, congrats! I tried the multiple functions and they work very well, I just have a question:
I noticed that the swapped face is the first one encountered on dest or the one we place on the target folder, is there a simple way to swap every face in the images/videos?

from ghost.

quantarb avatar quantarb commented on May 22, 2024

I added a new parameter called save_swaps. If you check this option or set this value to True, it will save the swapped images for a video file as well as the video itself. Please see the updated colab notebook below.
https://colab.research.google.com/gist/quantarb/6327c2ef8f72ebeb0e41541f8476f4ce/sber-swap.ipynb

You did a splendid job, congrats! I tried the multiple functions and they work very well, I just have a question: I noticed that the swapped face is the first one encountered on dest or the one we place on the target folder, is there a simple way to swap every face in the images/videos?

Not to my knowledge. You would need to pass in all face images in the target_face_paths to swap all the faces.

from ghost.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.