Correct a typo but PRNU classifier still looking random
This commit is contained in:
parent
36f5b69f5e
commit
41926663b7
@ -22,9 +22,9 @@ PRNU_FACTOR = 0.1
|
||||
def randomImage(scale):
|
||||
return np.maximum(np.random.normal(loc = 0, scale = scale, size = (IMAGE_SIZE, IMAGE_SIZE)), 0)
|
||||
|
||||
prnus = [randomImage(scale = 0.1) for _ in range(NUMBER_OF_PHONES)]
|
||||
prnus = [randomImage(scale = PRNU_FACTOR) for _ in range(NUMBER_OF_PHONES)]
|
||||
|
||||
images = [[randomImage(scale = 10) + prnus[phoneIndex] for _ in range(NUMBER_OF_IMAGES_PER_PHONE)] for phoneIndex in range(NUMBER_OF_PHONES)]
|
||||
images = [[randomImage(scale = 1) + prnus[phoneIndex] for _ in range(NUMBER_OF_IMAGES_PER_PHONE)] for phoneIndex in range(NUMBER_OF_PHONES)]
|
||||
|
||||
# How to simplify?
|
||||
allImages = np.max([np.max(prnus) + np.max(images)])
|
||||
@ -49,8 +49,9 @@ def getPhoneIndexByNearestPrnu(estimatedPrnu):
|
||||
if nearestPrnuRmsDiff is None or prnuRmsDiff < nearestPrnuRmsDiff:
|
||||
nearestPrnuRmsDiff = prnuRmsDiff
|
||||
nearestPrnuPhoneIndex = phoneIndex
|
||||
return phoneIndex
|
||||
return nearestPrnuPhoneIndex
|
||||
|
||||
# Should choose between *average* and *mean*, I would prefer *mean*.
|
||||
# What about CAI on `phoneImagesMean`?
|
||||
correctGuessesByAverageImages = 0
|
||||
correctGuessesByAverageCAIImages = 0
|
||||
@ -65,13 +66,10 @@ for phoneIndex in range(NUMBER_OF_PHONES):
|
||||
print('RMS diff with average CAI images =', rmsdiff(caiImagesMean, phonePrnu))
|
||||
guessedPhoneIndexByAverageImages = getPhoneIndexByNearestPrnu(phoneImagesMean)
|
||||
guessedPhoneIndexByAverageCAIImages = getPhoneIndexByNearestPrnu(caiImagesMean)
|
||||
#print(f'Actual phone index {phoneIndex}, guessed phone index {guessedPhoneIndex}')
|
||||
print(f'Actual phone index {phoneIndex}, guessed phone index {guessedPhoneIndexByAverageImages} by averages images and {guessedPhoneIndexByAverageCAIImages} by average CAI images')
|
||||
correctGuessesByAverageImages += 1 if phoneIndex == guessedPhoneIndexByAverageImages else 0
|
||||
correctGuessesByAverageCAIImages += 1 if phoneIndex == guessedPhoneIndexByAverageCAIImages else 0
|
||||
#correct = phoneIndex == guessedPhoneIndex
|
||||
#if correct:
|
||||
# correctGuesses += 1
|
||||
|
||||
print(correctGuessesByAverageImages / NUMBER_OF_PHONES)
|
||||
print(correctGuessesByAverageCAIImages / NUMBER_OF_PHONES)
|
||||
print(f'{correctGuessesByAverageImages / NUMBER_OF_PHONES=}')
|
||||
print(f'{correctGuessesByAverageCAIImages / NUMBER_OF_PHONES=}')
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user