AhmedMOstaFA10 commited on
Commit
2db2a17
·
verified ·
1 Parent(s): 06fed79

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +76 -57
README.md CHANGED
@@ -1,83 +1,102 @@
1
- ---
2
- license: mit
3
- ---
4
 
5
- # ArtifyAI - COCO Dataset Downloader and Organizer
6
 
7
- Welcome to ArtifyAI, a project designed to download images from the COCO dataset and organize them into your Google Drive for further use in machine learning and computer vision projects.
8
 
9
- ## Introduction
10
 
11
- This project automates the process of downloading a subset of images from the COCO dataset and storing them directly in Google Drive. It's aimed at researchers and developers who need a quick way to set up their dataset for training image-based models. The notebook is structured to be easy to follow, even for non-technical users.
12
 
13
- ## Requirements
 
 
14
 
15
- To use this notebook, you need:
16
 
17
- - Google Colab (optional, but recommended for ease of use)
18
- - Google Drive (to store the dataset)
19
- - Basic knowledge of Python (optional)
20
- - Internet connection (for downloading images)
21
- - Libraries:
22
- - `pycocotools`
23
- - `requests`
24
- - `tqdm`
25
- - `matplotlib`
26
- - `numpy`
27
- - `shutil`
28
 
29
- ## Installation
30
 
31
- 1. **Clone the repository (optional)**:
32
- ```bash
33
- git clone https://github.com/your-repo/ArtifyAI.git
34
- cd ArtifyAI
35
- ```
36
 
37
- 2. **Open the notebook**:
38
- - You can directly upload the notebook (`ArtifyAI_v1_0.ipynb`) to your Google Colab environment or use it locally in your Python environment.
39
 
40
- 3. **Install dependencies**:
41
- If you're running this locally, make sure to install the required libraries:
42
- ```bash
43
- pip install pycocotools tqdm matplotlib numpy requests
44
- ```
45
 
46
- ## Running the Project
 
 
 
47
 
48
- Once all dependencies are installed, follow these steps:
 
 
 
 
 
49
 
50
- 1. **Open Google Colab**:
51
- - If you're using Google Colab, upload the notebook to your Colab environment.
52
-
53
- 2. **Mount Google Drive**:
54
- - The notebook will prompt you to mount your Google Drive. Ensure your account is connected so that the images are downloaded and saved to a designated folder in your drive.
 
 
 
55
 
56
- 3. **Run the Code**:
57
- - Execute the cells sequentially to start downloading the COCO dataset images. The notebook uses `pycocotools` to fetch image URLs from the COCO API and downloads them using `requests`. Progress is tracked with `tqdm`.
 
 
 
58
 
59
- 4. **Transfer Images to Google Drive**:
60
- - After downloading, the images will automatically be moved to a folder in your Google Drive (`MyDrive/coco_dataset`).
 
61
 
62
- ## Using Google Colab
 
 
 
 
63
 
64
- For non-technical users, we recommend using [Google Colab](https://colab.research.google.com/). It provides a cloud-based environment where you can run the notebook without installing Python or any dependencies on your local machine.
65
 
66
- 1. **Upload the Notebook**:
67
- - Simply drag and drop the `.ipynb` file into Colab.
 
68
 
69
- 2. **Mount Google Drive**:
70
- - The notebook includes a step to mount Google Drive for file storage. Follow the on-screen instructions to authorize access.
71
 
72
- 3. **Run the Notebook**:
73
- - Execute each cell in the notebook by clicking the play button next to each cell. Ensure all code cells are run in order.
 
 
74
 
75
- ## Moving Files to Google Drive
 
76
 
77
- After downloading the images, the notebook will move them to a specified folder in your Google Drive, making it easy for you to access them later.
 
 
 
 
 
 
 
 
 
78
 
79
- - The default folder is `/content/drive/MyDrive/coco_dataset`, but you can modify the path if needed.
80
 
81
- ## License
82
 
83
- This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
 
1
+ # ArtifyAI v1.0: Text-to-Image Generation
 
 
2
 
3
+ ArtifyAI v1.0 is a project designed to generate images from text using the T5 model for text summarization and the Stable Diffusion model for image generation. This version also provides functionality to save model weights and load them for future use, making it easier to resume your work.
4
 
5
+ ## Overview
6
 
7
+ ArtifyAI v1.0 uses T5 for text processing, Stable Diffusion for image generation, and includes functionality for saving and loading the model's weights. You can easily store model weights in Google Drive and use them later without re-downloading everything.
8
 
9
+ ## Features
10
 
11
+ - **Text Processing**: Utilizes T5 for text summarization and generation.
12
+ - **Image Generation**: Uses Stable Diffusion for high-quality image generation based on textual descriptions.
13
+ - **Model Saving**: Allows you to save and reload model weights (e.g., UNet) to/from Google Drive.
14
 
15
+ ## Installation
16
 
17
+ ### Prerequisites
 
 
 
 
 
 
 
 
 
 
18
 
19
+ Ensure that you have the following to run this project:
20
 
21
+ 1. Python 3.7+
22
+ 2. CUDA-compatible GPU (for faster performance)
23
+ 3. [Hugging Face Transformers](https://huggingface.co/transformers/)
24
+ 4. [Diffusers](https://huggingface.co/docs/diffusers/index)
25
+ 5. [PyTorch](https://pytorch.org/) with CUDA support
26
 
27
+ ### Step-by-Step Setup
 
28
 
29
+ 1. **Clone the Repository**:
30
+ ```bash
31
+ git clone https://github.com/your-username/ArtifyAI.git
32
+ cd ArtifyAI
33
+ ```
34
 
35
+ 2. **Install Dependencies**:
36
+ ```bash
37
+ pip install torch transformers diffusers
38
+ ```
39
 
40
+ 3. **Download the Pretrained Models**:
41
+ Use the following code to load the models:
42
+ ```python
43
+ from transformers import T5Tokenizer, T5ForConditionalGeneration
44
+ from diffusers import StableDiffusionPipeline
45
+ import torch
46
 
47
+ # Load models
48
+ t5_tokenizer = T5Tokenizer.from_pretrained("t5-small")
49
+ t5_model = T5ForConditionalGeneration.from_pretrained("t5-small")
50
+ ArtifyAI_model = StableDiffusionPipeline.from_pretrained("CompVis/stable-diffusion-v1-4", torch_dtype=torch.float16)
51
+
52
+ # Set model to GPU if available
53
+ ArtifyAI_model = ArtifyAI_model.to("cuda" if torch.cuda.is_available() else "cpu")
54
+ ```
55
 
56
+ 4. **Mount Google Drive for Model Saving**:
57
+ To save model weights in Google Drive, mount your drive and specify the save path:
58
+ ```python
59
+ from google.colab import drive
60
+ drive.mount('/content/drive')
61
 
62
+ save_path = '/content/drive/My Drive/models/unet_weights.pth'
63
+ torch.save(ArtifyAI_model.unet.state_dict(), save_path)
64
+ ```
65
 
66
+ 5. **Load Model Weights**:
67
+ Reload the model's weights later using:
68
+ ```python
69
+ ArtifyAI_model.unet.load_state_dict(torch.load('/content/drive/My Drive/models/unet_weights.pth'))
70
+ ```
71
 
72
+ ## Usage
73
 
74
+ 1. **Run the Jupyter Notebook**: Open `ArtifyAI_v1_0.ipynb` in Jupyter to run the code and explore the pipeline.
75
+ 2. **Save/Load Model Weights**: Use the provided code to store and retrieve model weights from Google Drive.
76
+ 3. **Generate Custom Images**: Modify the text input to generate unique images.
77
 
78
+ ## Example
 
79
 
80
+ Here's how you can save and reload model weights:
81
+ ```python
82
+ # Save the UNet model's weights
83
+ torch.save(ArtifyAI_model.unet.state_dict(), '/content/drive/My Drive/models/unet_weights.pth')
84
 
85
+ # Load the saved weights
86
+ ArtifyAI_model.unet.load_state_dict(torch.load('/content/drive/My Drive/models/unet_weights.pth'))
87
 
88
+ ## For Non-Technical Users
89
+
90
+ If you're not familiar with coding or AI, follow these steps to use ArtifyAI:
91
+
92
+ 1. **Install Python**: Download and install Python 3.7+ from the [official Python website](https://www.python.org/downloads/).
93
+
94
+ 2. **Install Dependencies**: After installing Python, open a terminal and run:
95
+ ```bash
96
+ pip install torch transformers diffusers
97
+ ```
98
 
99
+ 3. **Run the Project**: Use the code snippets provided in the notebook or above to generate images from text.
100
 
101
+ 4. **Save Your Work**: If you are using Google Colab, remember to save your models to Google Drive to keep your work.
102