NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io


prompt = "((photo of dcnwtxhg)) Headshot portrait of a man in Business casual clothing with suit and tie, realistic face, professional attire, confident expression, natural lighting, sharp focus, high-resolution (4k), professional photography, clean and polished look, with a outdoor background"
negative_prompt = "sectarian mark, deformed iris, random other person, deformed pupils, semirealistic, sgi, 3d,dual man, render sketch, cartoon, drawing, anime:1.4), text, closeup, cropped, out of frame, worst quality, low quality, jpeg artifact, ugly, duplicate, morbid, mutilated, extra finger, blurry, extra limbs, cloned face, missing legs, extra arm, many finger, long neck"
num_samples = 4
guidance_scale = 7.5
num_inference_steps = 24
height = 512
width = 512


# Define the path to the folder where you want to save the images
output_folder = "/home/ubuntu/socialitecomm/output_tom"

# Set the initial count of generated images
generated_images = 0

verified_folder = "/home/ubuntu/socialitecomm/Good_images"

while len(os.listdir(verified_folder)) < 140:
with autocast("cuda"), torch.inference_mode():
images = pipe(
prompt,
height=height,
width=width,
negative_prompt=negative_prompt,
num_images_per_prompt=num_samples,
num_inference_steps=num_inference_steps,
guidance_scale=guidance_scale,
generator=g_cuda
).images

# Save the images to the output folder with random names
for i, img in enumerate(images):
# Generate a random filename
random_chars = ''.join(random.choices(string.ascii_letters + string.digits, k=10))
img_path = os.path.join(output_folder, f"output_{random_chars}.png")
img.save(img_path)
print(f"Image {i+1} saved successfully: {img_path}")




from deepface import DeepFace
import os
import shutil


# Load pre-trained models
models = "Facenet512"
DeepFace.build_model(models)

# Path to the folder containing the photos
folder_path = "/home/ubuntu/socialitecomm/output_tom"

for filename in os.listdir(folder_path):
if filename.endswith(".jpg") or filename.endswith(".png"):
# Full path to the photo
img_path = os.path.join(folder_path, filename)

try:
# Perform face detection
img_pathh = "/home/ubuntu/socialitecomm/greg_image/IMG_8722.jpg"
detections = DeepFace.detectFace(img_pathh, detector_backend="opencv")

# Check if face detection is successful
if len(detections) == 0:
# Remove the photo from the folder
os.remove(img_path)
print(f"Photo {filename} does not contain a detectable face. Removed from folder.")
continue

# Perform face recognition
result = DeepFace.verify("/home/ubuntu/socialitecomm/greg_image/IMG_8722.jpg", img_path, model_name="Facenet512", detector_backend = "opencv")

# Extract the matching percentage
matching_percentage = 1 - result["distance"]

# Update verified field based on matching percentage
result["verified"] = matching_percentage > 0.50

# Display the result
print(f"Matching Percentage: {matching_percentage*100:.2f}%, Verification result for {filename}: {result}")


import subprocess
command = "nvidia-smi"
result = subprocess.run(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
if result.returncode == 0:
print(result.stdout)
else:
print("Error:", result.stderr)

if result["verified"]:
# Move the verified image to a new folder
# verified_folder = "/content/drive/MyDrive/Good_images"
# shutil.move(img_path, os.path.join(verified_folder, filename))
verified_folder = "/home/ubuntu/socialitecomm/Good_images"
new_filename = f"image_{matching_percentage:.2f}_{filename}"
new_filepath = os.path.join(verified_folder, new_filename)
shutil.move(img_path, new_filepath)

# Rename the file
# os.rename(new_filepath, os.path.join(verified_folder, new_filename))
else:
# Move the unverified image to another folder
unverified_folder = "/home/ubuntu/socialitecomm/Bad_images"
new_filename = f"image_{matching_percentage:.2f}_{filename}"
new_filepath = os.path.join(unverified_folder, new_filename)
shutil.move(img_path, new_filepath)

except Exception as e:
print(f"Error processing photo {filename}: {str(e)}")
generated_images += len(images)
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.