This invention provides a method, apparatus, device, and medium for creating
generative model data pairs based on pixel comparison. The method includes: acquiring an original image and an object
mask image; filling the object region with a
solid magenta color and inputting it into an
image object elimination model to output a preliminary
elimination result image; unifying the resolution of the original image and the
elimination result image; calculating the three-channel difference value of the two images pixel by pixel, and generating an initial variable
mask based on a threshold T; performing a morphological opening operation on the initial variable
mask to generate an optimized variable mask; identifying regions connected to the object region and with an area greater than a first threshold from the optimized variable mask as shadow masks; generating a
noise mask; calculating the
interference ratio and the maximum
noise area; if the
interference ratio is greater than a second threshold or the maximum
noise area is greater than a third threshold, it is judged as an abnormal result and discarded; otherwise, the original image and the elimination result image are stored as valid data pairs; thus, the output results of the
generative model are filtered, improving the efficiency of data pair construction.