מבוא בינה מלאכותית RB34-04 : זיהוי פנים של תמונה אדם – יצירת מוסיקה עם A.I

מבוא בינה מלאכותית RB34-04 : זיהוי פנים של תמונה אדם – יצירת מוסיקה עם A.I

חלק א :

מה חדש – סוכני בינה מלאכותית מתאחדים

 

 

 

 

חלק א:   יצירת  שירים ומוסיקה עם בינה מלאכותית  – ושילוב סרטון וידאו עם בינה מלאכותית

יחידת החשמונאים  :

https://suno.com/s/IHMZAKUEAWd5CTNg

 

 

נעשה על ידי בינה מלאכותית  A.I  זוהר ארגוב ועפרה חזה – גדולי הזמר הישראלי 

 

 

 

איך עשו את השיר

 


 

 

Suno היא פלטפורמה מבוססת בינה מלאכותית המאפשרת יצירת מוזיקה באמצעות מחולל טקסט-למוזיקה. הפלטפורמה מאפשרת למשתמשים ליצור שירים מקוריים עם שירה וליריקה על ידי הזנת תיאורים טקסטואליים. מאז השקתה בדצמבר 2023, Suno זמינה באופן נרחב, כולל שיתוף פעולה עם מיקרוסופט לשילוב הפלטפורמה ב-Microsoft Copilot. citeturn0search8

Suno מציעה אפליקציות למכשירי iOS ואנדרואיד, המאפשרות למשתמשים ליצור מוזיקה ישירות מהטלפון הנייד שלהם. citeturn0search3turn0search1 הפלטפורמה משתמשת במודלים מתקדמים ליצירת מוזיקה בהתאם לתיאורים שהוזנו על ידי המשתמש, ומאפשרת התאמה אישית של סגנונות מוזיקליים, כלי נגינה וסוגי קול. citeturn0search5

Suno מציעה תוכניות מנוי שונות, כולל תוכנית חינמית עם 50 קרדיטים יומיים, ותוכניות פרימיום המאפשרות יצירת מוזיקה לשימוש מסחרי. citeturn0search3 הפלטפורמה מתאימה למגוון משתמשים, כולל מוזיקאים מקצועיים, חובבים, יוצרי תוכן ועסקים, ומאפשרת להם ליצור מוזיקה איכותית במהירות ובקלות. citeturn0search5

 


תרגיל כיתה 1 

  1. היכנס ל chatGPT ובקש לרשום שיר קצר
  2. כתוב פרמטרים שיופיעו בשיר כמו מקום תיאורים האם השיר צריך להיות מרגש גיל השומע , בקש שזה יהיה עם חרוזים אם חשוב לך – (בדוק שיש חרוזים בשפה העברית אם זה בעברית )
  3. העתק את טקסט השיר
  4.  פתח את תוכנת הבינה מלאכותית ליצירת שירים  https://suno.com/
  5. שים לב שאתה בוחר את מצב custom

מעודכן לפי שלבים

 

ראש סרטון הדרכה  קצר :

 


 חלק ב : 

1. תרגיל כיתה : תרגול רשת ANN וסביבת קולאב COLAB

בניית רשת נוירונים בעזרת בינה מלאכותית – קראו את התרגיל עד הסוף

1.1הצגו את גרף הנתונים בעזרת תוכנת פייתון

1.1.2 בנה בעזרת בינה מלאכותית רשת נוירונים  בקוד פייתון  – בסביבת פיתוח קולאב אשר מקבל את הנתונים הבאים

1.2 הצג את גרף הלמידה הפעל על 40 איפוקס  , 100 איפוקס  האם הרשת למדה או דרוש יותר אימון ?

הצג גרף של VAL ו COST FUCTION \ ERROR LOST

1.3 נבא את התוצאות : הבאות

0.1 , 1.5  . -2.85  , 2.6

הנתונים של סידרה a  ואת הערכים לניסוי

נתונים ערכים לשאלה :

 

 

 

 

 



העשרה

1. יצירת מוזיקה (טקסט → מוזיקה)

  • MusicGen (Meta) – יצירת מוזיקה מבוססת טקסט.
  • Riffusion – יצירת מוזיקה באמצעות Stable Diffusion.
  • Magenta (Google) – יצירת מוזיקה מבוססת AI.

2. סינתזה קולית (טקסט → קול/שירה)

  • XTTS-v2 (Coqui TTS) – דיבור מציאותי עם רגש.
  • Tortoise-TTS – סינתזה קולית מדויקת ואיכותית.
  • ElevenLabs – יצירת דיבור ושירה ברמה גבוהה.
  • VITS – דיבור ריאליסטי עם התאמה אישית.

3. עיבוד וניתוח אודיו

  • Librosa – ניתוח והפקת תכונות קוליות.
  • Torchaudio – עיבוד קול בעזרת PyTorch.
  • FFmpeg – המרת פורמטים ועריכת אודיו.

4. יצירת כלי נגינה דיגיטליים

  • Fluidsynth – יצירת צלילים מסינתיסייזרים.
  • MIDIUtil – יצירת קובצי MIDI לכלי נגינה דיגיטליים.

💡 שילוב להפקת שירים: MusicGen + XTTS-v2 + Librosa.


 

חלק ג : יצירת  וידאו  מטקסט – שיווק מוצר עם בינה מלאכותית

 

pika.art

text to video

 

 

 

יצירת  וידאו : מתמונה וטקסט – שיווק מוצר עם בינה מלאכותית

 

image.png

1.תרגיל כיתה

  1. צור סרטון וידאו לפי רעיון משלך  או גיפ נוסע בים או טיגרס  הופך לנשר

 

 


חלק ד :

 

 

 

 

 


 

 

 


 

 

 


 

 

 

Face Comparison with InsightFace

 :embedding vector

mbedding Vector?

  • An embedding is just a list of numbers.

  • These numbers describe the important features of a face (shape of nose, distance between eyes, jawline, etc.).

  • The list is usually long (for InsightFace, often 512 numbers).

  • Together, those numbers create a unique “fingerprint” of the face.


Why is it useful?

  • The raw image (like 100×100 pixels = 10,000 numbers) is too big to compare directly.

  • The embedding reduces this to 512 numbers that keep only the most important face features.

  • Two embeddings from the same person will look very similar.

  • Two embeddings from different people will look very different.


Simple Example

Think of it like describing a person in short words:

  • Instead of writing a full biography, you say:

    • Height: 1.8

    • Hair: 0.3

    • Skin tone: 0.7

    • Nose: 0.5

    • Smile: 0.9

This short list is the embedding vector.
It’s not the full photo, but enough to recognize who it is.

This example shows how to use InsightFace to compare two face images and decide if they belong to the same person. The program uses cosine similarity between face embeddings.

Explanation

  • 512 numbers total → this is the embedding vector.

  • Each number captures some hidden feature of the face.

  • The exact meaning of each number is not human-readable (like “eye width” or “nose length”), but together they form the face fingerprint.

When comparing two faces, InsightFace checks how close these 512-number fingerprints are, usually using cosine similarity.


Step 1 – Imports and setup

import sys
print(sys.executable)

import cv2
import numpy as np
from insightface.app import FaceAnalysis

  • sys.executable prints the Python path in use.

  • cv2 is OpenCV for handling images.

  • numpy is used for math.

  • FaceAnalysis is the InsightFace tool for detection and embeddings.


Step 2 – Load the InsightFace model

app = FaceAnalysis(name="buffalo_l")
app.prepare(ctx_id=-1, det_size=(640, 640))
  • buffalo_l is a strong pre-trained face recognition model.

  • ctx_id=-1 forces CPU usage.

  • det_size=(640,640) sets the detection image size.


Step 3 – Load two images

img1 = cv2.imread(r"d:\temp\trump1.jpeg")
img2 = cv2.imread(r"d:\temp\trump1.jpeg")

if img1 is None or img2 is None:
raise FileNotFoundError("Could not open one of the images.")

  • Loads the two face images from disk.

  • Raises an error if any image cannot be read.


Step 4 – Detect and encode faces

faces1 = app.get(img1)
faces2 = app.get(img2)

if len(faces1) == 0 or len(faces2) == 0:
raise ValueError("No face detected in one of the images.")

embedding1 = faces1[0].embedding
embedding2 = faces2[0].embedding

print("Embedding shape:", embedding1.shape)

  • Detects faces in both images.

  • Each face object contains bounding box, landmarks, and a 512-dimensional embedding.

  • Here we take the first detected face.


Step 5 – Cosine similarity function

def cosine_similarity(a, b):
return np.dot(a, b) / (np.linalg.norm(a) * np.linalg.norm(b))

similarity = cosine_similarity(embedding1, embedding2)
print(f"Cosine similarity: {similarity:.4f}")

  • Cosine similarity measures the angle between two vectors.

  • Value close to 1.0 means the faces are very similar.

  • Value near 0.0 means no relation.


Step 6 – Decision

threshold = 0.35
if similarity > threshold:
print("Result: SAME person")
else:
print("Result: DIFFERENT persons")
  • If similarity is above the threshold, the images are considered the same person.

  • Threshold can be tuned (typical range: 0.3–0.5).


How it works

  1. InsightFace detects and aligns the face.

  2. It encodes the face into a vector of 512 numbers (the embedding).

  3. Cosine similarity compares how close two vectors are.

  4. If the vectors are close enough, the faces are the same person.

 


 

compares Trump1, Trump2, and Obama embeddings, and rewrite it with step-by-step remarks so even someone new can follow