Papers › Linear Semantics in Generative Adversarial Networks

Linear Semantics in Generative Adversarial Networks

1 Apr 2021CVPR 2021 1arXiv:2104.00487archive 2025-07-28

Jianjin Xu, Changxi Zheng

Generative Adversarial Networks (GANs) are able to generate high-quality images, but it remains difficult to explicitly specify the semantics of synthesized images. In this work, we aim to better understand the semantic representation of GANs, and thereby enable semantic control in GAN's generation process. Interestingly, we find that a well-trained GAN encodes image semantics in its internal feature maps in a surprisingly simple way: a linear transformation of feature maps suffices to extract the generated image semantics. To verify this simplicity, we conduct extensive experiments on various GANs and datasets; and thanks to this simplicity, we are able to learn a semantic segmentation model for a trained GAN from a small number (e.g., 8) of labeled images. Last but not least, leveraging our findings, we propose two few-shot image editing approaches, namely Semantic-Conditional Sampling and Semantic Image Editing. Given a trained GAN and as few as eight semantic annotations, the user is able to generate diverse images subject to a user-provided semantic layout, and control the synthesized image semantics. We have made the code publicly available.

PaperPDFConference PDFCodeCode Syntology ran

In Syntology Open this paper in Syntology's Atlas, the map of the papers in Syntology's graph and their citations.

For agents, Syntology's MCP tool lists every function and class Syntology harvested from this paper and whether it ran (how to connect): get_harvested_code_for_paper(arxiv_id="2104.00487")

Code

Syntology Ran 0 of 15 code samples harvested from 1 repository linked to this paper; 15 have no recorded run.

By repository: official repository: 15 samples from 1 repository, 0 ran. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

AtlantixJJ/LinearGAN officialmentioned in papermentioned on GitHubpytorchMIT report

Repository list and official/mentioned flags are the archive's, frozen 2025-07-28. Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.

Code Syntology ran Syntology

15 samples harvested; 0 ran; 0 honoured the contract we drafted; 15 have no recorded run. Read from Syntology's graph 2026-09-24; that is when this build read the record, not when the samples ran.

15unverified

Licence: 0 of the 15 samples are pointer only, meaning Syntology does not serve that copy's text. This page shows no code text for any sample; each one links to its file in the repository.

Harvested from AtlantixJJ/LinearGAN. “Ran” means the sample executed on a synthesized input. It does not mean the output is correct, and nothing here reproduces the paper's results. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself; “our draft was wrong” and “fixture could not drive it” are failures of Syntology's instrument, not of the code.

Each sample ends with its code_sha256, Syntology's identity for that exact code. An agent fetches the stored sample with Syntology's MCP tool get_code(code_sha256="…") (how to connect); click an identity to copy that call.

Repository labels, per sample. official repository: The archive marks this repository official for the paper. named in the paper: The archive records that the paper mentions this repository; it is not marked official. community (archive-listed): In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper. found in paper text by Syntology: Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted. community: Not in the archive's code links for this paper; a community repository Syntology harvested. Samples from a repository marked official are listed first. Licence labels name the repository's licence as recorded at harvest. “Pointer only” means Syntology does not serve that copy's text, for one of four reasons: no licence file was found; the licence was not identified; the licence is recorded as permissive but that copy's record is not marked cleared; or the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar). Some licences outside that list permit redistribution, such as WTFPL, and GPL-3.0 under its conditions; they are simply not on the list. Hover a licence label for the reason. File links open the file on GitHub at the default branch, which may have changed since the harvest.

G_from_SE AtlantixJJ/LinearGAN/evaluate.py official repository unverified MIT (permissive) · 2d79fedbd2e3646f · report
aggregate_iou AtlantixJJ/LinearGAN/evaluate.py official repository unverified MIT (permissive) · bc4b2e8dd74b03fe · report
formal_name AtlantixJJ/LinearGAN/figure/layer_plot.py official repository unverified MIT (permissive) · 5dd080ab390953df · report
gaussian_func AtlantixJJ/LinearGAN/lib/op.py official repository unverified MIT (permissive) · fd34493454efc92f · report
get_classes AtlantixJJ/LinearGAN/figure/layer_plot.py official repository unverified MIT (permissive) · fb61c14dfdff06f2 · report
get_label_color AtlantixJJ/LinearGAN/lib/visualizer.py official repository unverified MIT (permissive) · 18a135c1c6e8a12e · report
get_text AtlantixJJ/LinearGAN/figure/layer_plot.py official repository unverified MIT (permissive) · a3f50a610e7c3cd8 · report
int2onehot AtlantixJJ/LinearGAN/lib/op.py official repository unverified MIT (permissive) · 6d654ffc5a2f11c6 · report
lerp AtlantixJJ/LinearGAN/lib/op.py official repository unverified MIT (permissive) · 51c0c1703f9f7417 · report
mask_cross_entropy_loss AtlantixJJ/LinearGAN/lib/loss.py official repository unverified MIT (permissive) · 7c24cc243ee9ccfb · report
mask_focal_loss AtlantixJJ/LinearGAN/lib/loss.py official repository unverified MIT (permissive) · b4015457d599aa2b · report
read_ade20k_labels AtlantixJJ/LinearGAN/lib/misc.py official repository unverified MIT (permissive) · eee4b2def7c9d062 · report
read_results AtlantixJJ/LinearGAN/evaluate.py official repository unverified MIT (permissive) · a4df817ebb088365 · report
read_selected_labels AtlantixJJ/LinearGAN/lib/misc.py official repository unverified MIT (permissive) · 1a392f9ca44359d5 · report
set_cuda_devices AtlantixJJ/LinearGAN/lib/misc.py official repository unverified MIT (permissive) · 0214a8f261e7bb84 · report

Tasks

Semantic Segmentation

Results from the paper archive 2025-07-28

No leaderboard rows for this paper in the archive.

Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections