Deepfakes are images or videos of people that were modified by a deep learning algorithm to fake the actor doing or saying something.
This example follows along with our blog post about deepfakes in politics. We'll load a small number of deepfake videos in FiftyOne that have been classified by a model deisgned to detect deepfakes and analyze its performance.
Here's a popular example of a deepfake:
%%html
<iframe width="560" height="315" src="https://www.youtube.com/embed/cQ54GDm1eL0" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
If you haven't already, install FiftyOne:
!pip install fiftyone
Download the dataset containing deepfake videos and labels. Then unzip it and set the path below:
# Path to the unzipped dataset you downloaded
DATASET_PATH = "/path/to/deepfakes"
import fiftyone as fo
dataset = fo.Dataset.from_dir(DATASET_PATH, dataset_type=fo.types.FiftyOneDataset)
100% |████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 7/7 [110.0ms elapsed, 0s remaining, 63.6 samples/s]
print(dataset)
Name: 2020.11.02.12.17.48 Media type: video Num samples: 7 Persistent: False Info: {} Tags: ['obama', 'trump'] Sample fields: media_type: fiftyone.core.fields.StringField filepath: fiftyone.core.fields.StringField tags: fiftyone.core.fields.ListField(fiftyone.core.fields.StringField) metadata: fiftyone.core.fields.EmbeddedDocumentField(fiftyone.core.metadata.Metadata) ground_truth: fiftyone.core.fields.EmbeddedDocumentField(fiftyone.core.labels.Classification) prediction: fiftyone.core.fields.EmbeddedDocumentField(fiftyone.core.labels.Classification) confidence: fiftyone.core.fields.FloatField Frame fields: frame_number: fiftyone.core.fields.FrameNumberField
# View dataset in the App
session = fo.launch_app(dataset)
App launched
Click on the confidence
checkbox on the bottom-left of the App to see the confidence of the deepfake detector:
Double click on a video to enlarge it:
The dataset has tags that show the true identity of some speakers:
You can use the view bar to, for example, show only videos with a certain tag:
# View only Obama videos
session.view = dataset.match_tags("obama")