Skip to content

Abhigyan126/Minecraft-Skin-Generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Minecraft Skin Generator using WGAN-GP

A deep learning model that generates unique Minecraft character skins using a Wasserstein GAN with Gradient Penalty (WGAN-GP).

implementation

Check out Nextjs implementation: https://blockface.vercel.app/

Sample

render png 09-47-12-210 render render-2 render-3 render-4 render-5 render-6 render-8 render-9

Overview

This project implements a generative adversarial network to create unique Minecraft character skins. It uses advanced techniques including self-attention mechanisms, adaptive residual blocks, and spectral normalization to produce high-quality, diverse character skins.

Arcitecture

graph TD
    subgraph Data_Pipeline
        A[Raw Minecraft Skins] -->|Preprocessing| B[MinecraftImageDataset]
        B -->|Validation| C{Image Check}
        C -->|Valid| D[DataLoader]
        C -->|Invalid| E[Error Log]
        D -->|Batch Processing| F[Normalized Tensors]
    end

    subgraph Generator_Architecture
        G[Latent Space] -->|Dense Layer| H[Initial Features]
        H -->|Reshape| I[4x4 Feature Maps]
        I -->|Block 1| J[8x8 Features + Self-Attention]
        J -->|Block 2| K[16x16 Features + Self-Attention]
        K -->|Block 3| L[32x32 Features]
        L -->|Block 4| M[64x64 Features]
        M -->|Final Conv| N[Generated Skin]
        
        subgraph Residual_Block
            R1[Input] -->|Conv1| R2[Norm + LeakyReLU]
            R2 -->|Conv2| R3[Norm]
            R1 -->|Shortcut| R4[1x1 Conv]
            R3 -->|SE Block| R5[Channel Recalibration]
            R4 --> R6[Add]
            R5 --> R6
        end
    end

    subgraph Critic_Architecture
        O[Input Image] -->|Initial Block| P[Feature Maps]
        P -->|Block 1| Q[Deep Features + Self-Attention]
        Q -->|Block 2| S[Deeper Features]
        S -->|Block 3| T[Final Features]
        T -->|Flatten| U[Vector]
        U -->|Linear| V[Criticism Score]
    end

    subgraph Training_Loop
        W[Real & Fake Pairs] -->|Forward Pass| X[Loss Computation]
        X -->|Gradient Penalty| Y[WGAN-GP Loss]
        Y -->|Backprop| Z[Parameter Updates]
        Z -->|New Batch| W
    end

    subgraph Evaluation_Metrics
        AA[Generated Samples] -->|SSIM| AB[Structural Similarity]
        AA -->|Visual Check| AC[Sample Gallery]
        AB -->|Tracking| AD[Loss Curves]
        AC -->|Save| AE[Sample Archive]
    end

    subgraph Post_Processing
        AF[Raw Generated Skin] -->|Format Convert| AG[PNG Output]
        AG -->|SkinPy| AH[3D Render]
        AH -->|Multiple Views| AI[Final Visualization]
    end

    F -->|Real Images| W
    N -->|Fake Images| W
    N -->|Output| AA
    V -->|Feedback| X
Loading

Features

  • WGAN-GP architecture with gradient penalty for stable training
  • Self-attention mechanisms for better global coherence
  • Adaptive residual blocks with squeeze-and-excitation
  • Spectral normalization for improved training stability
  • SSIM (Structural Similarity Index) monitoring during training
  • Multi-GPU support for faster training
  • Custom dataset handling with image validation

Environment Setup

It's recommended to use Python 3.11.x with Conda:

conda create -n minecraft-gan python=3.11
conda activate minecraft-gan

pip install -r requirements.txt

Project Structure

minecraft-skin-generator/
├── test/
│   ├── save/
│   │   └── *.png
│   └── *.py
├── model/
│   ├── docs/
│   │   └── *.txt
│   ├── samples/
│   │   ├── model v5/
│   │   │   └── *.png
│   │   └── model v3/
│   │       └── *.png
│   └── *.pth
├── train/
│   └── *.py
├── ipynb_files/
│   └── *.ipynb
├── generated_skins/
│   ├── *.txt
│   └── *.png
└── README.md

Usage

# for training
python train/train.py

# for testing
python test/test.py

Files Description

Training Files (train/)

  • Main training scripts for the GAN
  • Data loading and preprocessing utilities
  • Model configuration and hyperparameter settings

Model Files (model/)

  • Saved model checkpoints (.pth)
  • Sample outputs in version-specific directories
  • Documentation and model architecture details

Testing Files (test/)

  • Scripts for generating and testing skins
  • Save directory for test outputs
  • Validation utilities

Jupyter Notebooks (ipynb_files/)

  • Development and experimentation notebooks
  • Training visualization and analysis

Generated Skins (generated_skins/)

  • Output directory for generated sample Minecraft skins
  • Associated metadata

Monitoring and Evaluation

The training process includes:

  • Generator and Critic loss tracking
  • SSIM score monitoring
  • Regular sample generation for visual inspection

About

WGAN-GP GAN model to generate unique Minecraft skin every run.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published