Papers
Topics
Authors
Recent
Search
2000 character limit reached

NijiGAN: Real-to-Anime GAN Framework

Updated 9 May 2026
  • NijiGAN is a generative adversarial network framework for real-to-anime image translation, integrating continuous-depth NeuralODEs with a CUT-based architecture.
  • It employs pseudo-paired data in a semi-supervised contrastive learning paradigm to achieve competitive FID and MOS scores while halving the parameter count.
  • The architecture unifies multiple loss functions and leverages high-quality anime references to minimize artifacts and enhance visual fidelity.

NijiGAN is a generative adversarial network (GAN) framework designed for high-fidelity, real-to-anime image translation. It integrates Neural Ordinary Differential Equations (NeuralODEs) into a contrastive semi-supervised learning paradigm, aiming to improve visual quality and computational efficiency compared to prior models such as Scenimefy and AnimeGAN. NijiGAN is distinguished by its continuous-depth modeling in the generator architecture, reliance on pseudo-paired data for semi-supervised training, and the unification of multiple contrastive and adversarial losses to address domain gaps in image stylization (Santoso et al., 2024).

1. Architectural Overview

NijiGAN leverages a modified contrastive unpaired translation (CUT) generator architecture originally found in Scenimefy. The model consists of three principal components:

  • Encoder (GencG_{enc}): A stack of convolutional layers transforms a 256×256256 \times 256 RGB image xx (real or pseudo-paired) into a multi-scale latent representation h(0)h(0).
  • Continuous-depth bottleneck (Neural ODE block): Instead of discrete residual (ResNet) blocks, the bottleneck is parameterized by a vector field fθf_\theta and models the latent evolution via the initial value problem

dh(t)dt=fθ(t,h(t)),h(0)=h0,t[0,T],\frac{dh(t)}{dt} = f_\theta(t, h(t)), \quad h(0) = h_0, \quad t \in [0, T],

where h(T)h(T) is computed using the Dormand–Prince ODE solver and subsequently forwarded to the decoder.

  • Decoder (GdecG_{dec}): Upsampling (deconvolutional) layers reconstruct the anime-style image from h(T)h(T).

The adversarial setup deploys two discriminators: DpD_p (conditionally discriminates supervised pairs of real/pseudo input and output) and 256×256256 \times 2560 (distinguishes unpaired real anime images from generated outputs in the unsupervised branch) (Santoso et al., 2024).

2. NeuralODE Integration and Parameterization

Traditional ResNet-based architectures apply discrete residual updates, formally,

256×256256 \times 2561

In the limit 256×256256 \times 2562, this process yields a continuous dynamical system,

256×256256 \times 2563

with solution

256×256256 \times 2564

NijiGAN implements 256×256256 \times 2565 as a convolution–batch norm–activation module, optimized using the Dormand–Prince RK45 solver. Replacing 256×256256 \times 2566 discrete ResNet blocks with a single NeuralODE block of tunable depth 256×256256 \times 2567 substantially reduces parameter count and potentially increases the model’s effective capacity to propagate features, as demonstrated by parameter count (5.477M) nearly halving the Scenimefy baseline (11.378M) (Santoso et al., 2024).

3. Semi-Supervised Contrastive Learning

NijiGAN’s training objective merges supervised and unsupervised translation through a two-branch semi-supervised scheme:

  • Supervised branch: Utilizes pseudo-paired data 256×256256 \times 2568 generated by Scenimefy, preventing reliance on artifacts from StyleGAN-produced low-quality pairs.

Key supervised losses: - Conditional GAN loss (256×256256 \times 2569): A patch-based discriminative loss operating on channel-wise concatenated input-output pairs. - Patch-wise contrastive loss (StylePatchNCE): Multi-scale contrastive loss for style features between generated and reference patches. - Supervised aggregate loss:

xx0

where xx1.

  • Unsupervised branch: Operates over unpaired LHQ images and anime references.

    • GAN loss (xx2) using PatchGAN.
    • Semantic relation consistency (SRC) loss:

    xx3

    enforcing invariance in internal feature similarity distributions. - Hard negative contrastive loss (hDCE): Penalizes the model for failing to differentiate true negatives in representation space.

The aggregate unsupervised loss is:

xx4

with xx5.

  • Total objective: Weighted sum annealed over training epochs xx6:

xx7

4. Training Datasets and Optimization

Training utilizes the following datasets:

  • Pseudo-paired set: 24,000 LHQ images and Scenimefy-generated anime translations, resized to xx8.
  • Unpaired real-world inputs: 10,000 LHQ images (real-world photos).
  • Anime references: 4,821 frames from five Makoto Shinkai anime films, providing diverse, high-quality style exemplars.

Optimization details:

  • Adam optimizer xx9, 25 epochs, approximately 24,000 steps per epoch.
  • Batch size is not specified, but is typically 1–4 for h(0)h(0)0 images in CUT-based networks.
  • h(0)h(0)1 throughout.
  • The initial 10 epochs anneal in supervised loss, beginning with h(0)h(0)2.

5. Empirical Results and Ablation Studies

Quantitative and qualitative evaluation demonstrates NijiGAN’s trade-offs in fidelity, parameter efficiency, and artifact suppression.

Model FID (↓) MOS (↑) Parameters (M)
CartoonGAN 45.79 2.708
AnimeGAN 56.88 2.160
Scenimefy 60.32 2.232 11.378
NijiGAN 58.71 2.192 5.477

NijiGAN closes the gap with Scenimefy on FID (58.71 vs 60.32) and achieves comparable MOS (2.192 vs 2.232), while halving parameter count. Efficiency benchmarking shows equivalent peak GPU memory (9.694 GB for NijiGAN vs 9.718 GB for Scenimefy), slightly lower throughput (1.533 s vs 1.253 s per 5-run batch), and higher TFLOPS (0.771 vs 0.387).

Ablation studies reveal:

  • Removal of NeuralODE or contrastive learning degrades perceptual quality, increasing blur and artifacts and worsening FID/MOS.
  • VGG perceptual loss is integral for structure retention, but excessive weighting (e.g., h(0)h(0)3) over-smooths anime features.
  • ResNet blocks reintroduce checkerboard artifacts and inflate parameter count.

6. Key Contributions and Dataset Release

NijiGAN's technical innovations and practical outcomes include:

  • The integration of NeuralODEs into the CUT generator, reducing parameters by approximately half while achieving competitive or improved visual fidelity.
  • The elimination of low-quality, StyleGAN-generated paired data, instead leveraging Scenimefy pseudo-pairs for supervised signals.
  • Unified semi-supervised training incorporating patchwise contrastive, conditional GAN, semantic relation consistency, and hard negative losses, which collectively minimize domain shifts in unpaired translation.
  • Empirical demonstration of reduced checkerboard artifacts, improved smoothness, and stable training across metrics.
  • Introduction and public release of a new high-resolution anime scene dataset (4,821 Makoto Shinkai frames), expanding resources for future scene stylization research (Santoso et al., 2024).

7. Context and Impact

NijiGAN situates itself within the trajectory of generative scene translation, building on CUT-style contrastive learning and semi-supervised objectives while advancing architectural efficiency through continuous-depth modeling. Its release of a new anime reference dataset addresses a data scarcity in high-fidelity style transfer research. Its methodological structure—combining NeuralODEs, contrastive learning, and pseudo-pair supervision—establishes a reference point for subsequent models aiming to balance translation quality, parameter efficiency, and practical deployment constraints in real-to-anime image generation (Santoso et al., 2024).

Definition Search Book Streamline Icon: https://streamlinehq.com
References (1)

Topic to Video (Beta)

No one has generated a video about this topic yet.

Whiteboard

No one has generated a whiteboard explanation for this topic yet.

Follow Topic

Get notified by email when new papers are published related to NijiGAN.