This example follows along with this blog post which looks at a CVPR 2020 paper titled Disentangled Image Generation Through Structured Noise Injection.
The paper presents a new way to control images generated by GANs.
Download the dataset used in the blog post from this Google Drive link (477MB).
The data was generated via the structured noise injection codebase.
Let's load the dataset into FiftyOne:
import fiftyone as fo
from fiftyone import ViewField as F
# The path to the unzipped dataset on disk
DATASET_PATH = "/path/to/structured_noise_injection_dataset"
# Load the data into FiftyOne
dataset = fo.Dataset.from_dir(DATASET_PATH, dataset_type=fo.types.FiftyOneDataset)
100% |████████████████████████████| 300/300 [1.9s elapsed, 0s remaining, 181.7 samples/s]
# View some information about the dataset
print(dataset)
Name: 2020.10.23.11.14.48 Media type: None Num samples: 300 Persistent: False Info: {} Tags: [] 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) face_id: fiftyone.core.fields.IntField mask_id: fiftyone.core.fields.EmbeddedDocumentField(fiftyone.core.labels.Classification) mask: fiftyone.core.fields.EmbeddedDocumentField(fiftyone.core.labels.Detections)
# Launch app and explore the dataset
session = fo.launch_app(dataset)
App launched
With the data loaded into FiftyOne, you can use the App's features to visually explore the dataset. You can also construct views into the dataset programmatically to identify particular samples of interest.
For example, let's compare the images in the dataset that were generated with different noise initializations for the mouth
region:
# Only include samples whose `mask_id` field has label `mouth`
view = dataset.match(F("mask_id.label") == "mouth")
# Open the view in the App
session.view = view