Condition à ajouter dans une fonction

je veux récupérer le chemin de img1 et img2

si les deux chemins sont identiques, alors ajouter la valeur 1 dans le tableau labels, sinon, ajouter la valeur 0.

voilà le code que j’ai travaillé avec le, et il reste d’ajouter la vérification des chemins mentionnée ci-dessus :

La fonction de fusion

def fusion(dataset_path):
# Load and process the images
dataset_images = sorted([filename for filename in os.listdir(dataset_path) if filename.endswith(‘.jpg’)])
results = []
labels = []
size = 224
for i in range(0, len(dataset_images)-1, 2):
img1 = charger_image(os.path.join(dataset_path, dataset_images[i]))
img2 = charger_image(os.path.join(dataset_path, dataset_images[i+1]))
# Resize both images to a common size
img1_resized = np.array(Image.fromarray(img1).resize((size , size)))
img2_resized = np.array(Image.fromarray(img2).resize((size , size)))

    # Call the stack_images_vertically function with the two resized images
    new_img = stack_images_vertically(img1_resized, img2_resized)
    results.append(new_img)

return results, labels