The principle is to crop the face to be replaced and place it in the relative position of the face in the target photo, then add clothing, hair, and background to the face.
Finally, high-definition restoration and magnification can be applied: https://www.runninghub.cn/ai detail/1906435334542905346 to obtain 4K photos with ultimate detail.
The replacement effect is better for portrait photography. For faces that are very small, the face-swapping effect will be somewhat worse. If you have any specific questions, feel free to contact me in the Runninghub group.