From cf22ff2694148cb0ad735f47a32225eb78480cce Mon Sep 17 00:00:00 2001 From: Benjamin Loison Date: Fri, 22 Mar 2024 12:59:52 +0100 Subject: [PATCH] Add comments --- datasets/fake/generate_dataset.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/datasets/fake/generate_dataset.py b/datasets/fake/generate_dataset.py index a52e0cc..9206cf3 100644 --- a/datasets/fake/generate_dataset.py +++ b/datasets/fake/generate_dataset.py @@ -18,6 +18,7 @@ NUMBER_OF_IMAGES_PER_PHONE = 100 # Compared to images. PRNU_FACTOR = 0.1 +# Generate PRNUs and images of phones. # Is such `np.maximum` probabilistically correct with our theoretical method? See #19. def randomImage(scale): return np.maximum(np.random.normal(loc = 0, scale = scale, size = (IMAGE_SIZE, IMAGE_SIZE)), 0) @@ -39,8 +40,10 @@ prnus = [toPilImage(prnu) for prnu in prnus] images = [[toPilImage(image) for image in images[phoneIndex]] for phoneIndex in range(NUMBER_OF_PHONES)] #images[0][0].show() +# Compute CAI of phone images. caiImages = [[contextAdaptiveInterpolator(image.load(), image) for image in images[phoneIndex]] for phoneIndex in tqdm(range(NUMBER_OF_PHONES))] +# Guess the phone by consider the one reaching the lowest RMS difference between the estimated PRNU and the actual one. def getPhoneIndexByNearestPrnu(estimatedPrnu): nearestPrnuRmsDiff = None nearestPrnuPhoneIndex = None @@ -51,6 +54,7 @@ def getPhoneIndexByNearestPrnu(estimatedPrnu): nearestPrnuPhoneIndex = phoneIndex return nearestPrnuPhoneIndex +# Predict the phones based on the estimated PRNUs and compute each method accuracy. # What about CAI on `phoneImagesMean`? See https://gitea.lemnoslife.com/Benjamin_Loison/Robust_image_source_identification_on_modern_smartphones/issues/9#issuecomment-1369. correctGuessesByMeanImages = 0 correctGuessesByMeanCAIImages = 0