CODEPROGRAMMER Telegram 2539
🖥 Face swap on python.

pip install --user opencv-python insightface matplotlib
# скачай 'inswapper_128.onnx' отсюда 'clck.ru/36ct6v' и закинь в папку с кодом
import cv2
import insightface
from insightface.app import FaceAnalysis
import matplotlib.pyplot as plt

app = FaceAnalysis(name='buffalo_l')
app.prepare(ctx_id=0, det_size=(640, 640))
swapper = insightface.model_zoo.get_model('inswapper_128.onnx')

def swap_faces(img):
img = cv2.imread(img)
fig, ax = plt.subplots(1, 1, figsize=(10, 5))
ax.imshow(img[:,:,::-1])
ax.axis('off'); plt.show()
faces = app.get(img)
face1, face2 = faces[0], faces[1]
imgnew = img.copy()
imgnew = swapper.get(imgnew, face1, face2, paste_back=True)
imgnew = swapper.get(imgnew, face2, face1, paste_back=True)
fig, ax = plt.subplots(1, 1, figsize=(10, 5))
ax.imshow(imgnew[:,:,::-1])
ax.axis('off'); plt.show()
return imgnew


swap_faces('ТУТ ТВОЁ ИЗОБРАЖЕНИЕ')


🎥 Video: https://www.youtube.com/shorts/78CFNgTTX54

👌 @CodeProgrammer
❤‍🔥8👍41



tgoop.com/CodeProgrammer/2539
Create:
Last Update:

🖥 Face swap on python.

pip install --user opencv-python insightface matplotlib
# скачай 'inswapper_128.onnx' отсюда 'clck.ru/36ct6v' и закинь в папку с кодом
import cv2
import insightface
from insightface.app import FaceAnalysis
import matplotlib.pyplot as plt

app = FaceAnalysis(name='buffalo_l')
app.prepare(ctx_id=0, det_size=(640, 640))
swapper = insightface.model_zoo.get_model('inswapper_128.onnx')

def swap_faces(img):
img = cv2.imread(img)
fig, ax = plt.subplots(1, 1, figsize=(10, 5))
ax.imshow(img[:,:,::-1])
ax.axis('off'); plt.show()
faces = app.get(img)
face1, face2 = faces[0], faces[1]
imgnew = img.copy()
imgnew = swapper.get(imgnew, face1, face2, paste_back=True)
imgnew = swapper.get(imgnew, face2, face1, paste_back=True)
fig, ax = plt.subplots(1, 1, figsize=(10, 5))
ax.imshow(imgnew[:,:,::-1])
ax.axis('off'); plt.show()
return imgnew


swap_faces('ТУТ ТВОЁ ИЗОБРАЖЕНИЕ')


🎥 Video: https://www.youtube.com/shorts/78CFNgTTX54

👌 @CodeProgrammer

BY Python | Machine Learning | Coding | R




Share with your friend now:
tgoop.com/CodeProgrammer/2539

View MORE
Open in Telegram


Telegram News

Date: |

A few years ago, you had to use a special bot to run a poll on Telegram. Now you can easily do that yourself in two clicks. Hit the Menu icon and select “Create Poll.” Write your question and add up to 10 options. Running polls is a powerful strategy for getting feedback from your audience. If you’re considering the possibility of modifying your channel in any way, be sure to ask your subscribers’ opinions first. Users are more open to new information on workdays rather than weekends. 1What is Telegram Channels? Step-by-step tutorial on desktop: So far, more than a dozen different members have contributed to the group, posting voice notes of themselves screaming, yelling, groaning, and wailing in various pitches and rhythms.
from us


Telegram Python | Machine Learning | Coding | R
FROM American