Instead of getting all of the image IDs and then cycling through them and outputting each one, you would first collect them into a single array and then use array_unique()
to remove the duplicates.
if( $categories_du_projet ) :
$image_array();
foreach( $categories_du_projet as $term ) :
if( $image_du_projet ) :
$image_array[] = $image_du_projet;
endif;
endforeach;
$image_array = array_unique( $image_array );
foreach( $image_array as $image_article ) :
//now run your output method using $image_article rather than $image_du_projet
//you'll probably have to change how you're obtaining things like the URL, ALT, etc.
endforeach;
endif;
What I’m not sure of is $image_du_projet = get_field( 'image_du_projet' );
and what that actually gets. I’m assuming it’s the ID of the image. If that’s wrong you’ll probably need to modify things a bit.
Perhaps then you’d need to add this:
$image_du_projet_id = $image_du_projet['ID'];
$image_array[] = $image_du_projet_id;
Sorry I can’t give a definitive answer in that regard but there’s no way for me to really test it as I don’t have ACF or those fields configured anywhere.