Compare commits

..

No commits in common. "1a910d2e2c49608297ad8737e44f98592e25a8e1" and "3f7b6bf21a6820ad2645e0bc73e25037a897eda7" have entirely different histories.

View File

@ -96,7 +96,8 @@ returnSingleColorChannelImage = lambda singleColorChannelImage, _minColor, _maxC
# - the second one is about estimating better and better the PRNU of each camera, as consider more and more training images and measuring the resulting attribution of cameras
for computeExtremes in tqdm(([True] if minColor is None or maxColor is None else []) + [False], 'Compute extremes'):
rescaleIfNeeded = returnSingleColorChannelImage if computeExtremes else rescaleRawImageForDenoiser
# As the second loop firstly if the denoiser is not `MEAN` or if `MEAN` predicts only on the whole training set, then compute noises of testing images.
# As the second loop firstly compute noises of testing images.
# What about `MEAN` denoiser condition?
if not computeExtremes:
print(f'{minColor=} {maxColor=}')
if DENOISER != Denoiser.MEAN or PREDICT_ONLY_ON_WHOLE_TRAINING_SET:
@ -138,8 +139,7 @@ for computeExtremes in tqdm(([True] if minColor is None or maxColor is None else
#plt.imsave(f'{escapeFilePath(actualCamera)}_{cameraTestingImageIndex}.png', cameraTestingImagesNoise[actualCamera][cameraTestingImageIndex])
# Loop over each camera to compute closeness between the considered testing image noise and the estimated PRNUs of the various cameras.
for camera in IMAGES_CAMERAS_FOLDER:
distance = abs(np.corrcoef(cameraTestingImagesNoise[actualCamera][cameraTestingImageIndex].flatten(), camerasIterativeMean[camera].mean.flatten()) - 1)
#distance = rmsDiffNumpy(cameraTestingImagesNoise[actualCamera][cameraTestingImageIndex], camerasIterativeMean[camera].mean)
distance = rmsDiffNumpy(cameraTestingImagesNoise[actualCamera][cameraTestingImageIndex], camerasIterativeMean[camera].mean)
print(f'{cameraTestingImageIndex=} {camera=} {actualCamera=} {distance=}')
if minimalDistance is None or distance < minimalDistance:
minimalDistance = distance