Skip to content

Dina-x/AgriGen

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 

Repository files navigation

AgriGen: Text-Guided Image Generation for Agricultural Crops

AgriGen is an integrated AI-based engineering system specialized in text-to-image generation for the agricultural domain. The project aims to overcome the limitations of closed-source commercial models by providing an open-source and interpretable solution. The system utilizes deep learning techniques to generate high-quality images of fruits, vegetables, nuts, and seeds from simple textual descriptions.


Key Features

  • Text-to-Image Generation Generate realistic agricultural crop images from text prompts.

  • Latent Space Exploration Manipulate latent representations to control image characteristics.

  • Dynamic Styling Apply multiple visual styles such as Sketch, Lighting Enhancement, and Grayscale.

  • Interactive Web Interface The system features a user-friendly interface built with Streamlit, allowing users to customize styles and generate images in real-time.

[AgriGen Web Interface] لقطة شاشة 2026-05-10 131928

Figure 1: Screenshot of the AgriGen interactive web application.


Technical Architecture

The project evolved from an initial VAE-based design into a more advanced implementation for higher image quality.

  • Base Model: Stable Diffusion v1.5
  • Fine-Tuning Technique: LoRA (Low-Rank Adaptation) for efficient domain-specific training.
  • Optimization: Attention Slicing and VAE Slicing for resource-efficient inference.
  • Inference Scheduler: DPMSolverMultistepScheduler for faster image generation.

Dataset & Evaluation

The model was trained on the Fruits-360 Dataset and evaluated using the CLIP model to ensure high semantic alignment.

Evaluation Accuracy: 94.44%

Visual Evaluation Samples

[Evaluation Samples] لقطة شاشة 2026-05-10 132157

Figure 2: Samples from the evaluation process showing True vs. Predicted labels.

Confusion Matrix

لقطة شاشة 2026-05-10 132210

Figure 3: Performance breakdown across different agricultural categories.


Results Showcase (Demo)

Below are sample outputs generated by AgriGen using different prompts and artistic styles.

Banana Apple Tomato
Banana Result Apple Result Tomato Result
Prompt: "Banana"
Style: Natural
Prompt: "Apple"
Style: Lighting Enhancement
Prompt: "Tomato"
Style: Artistic Sketch

About

An open-source, text-guided image generation system for agricultural crops based on Stable Diffusion v1.5 with LoRA fine-tuning and a Streamlit UI.

Topics

Resources

Stars

Watchers

Forks

Contributors