Hackster is hosting Hackster Holidays, Ep. 7: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Friday!Stream Hackster Holidays, Ep. 7 on Friday!

Augmented Autonomous Vision using GANs

Transform day-to-night images with CycleGAN to enhance visual data for applications in autonomous driving and urban planning.

AdvancedFull instructions providedOver 4 days21
Augmented Autonomous Vision using GANs

Things used in this project

Hardware components

AMD Instinct™ MI210 accelerators
AMD Instinct™ MI210 accelerators
×1

Software apps and online services

VS Code
Microsoft VS Code
Jupyter Notebook
Jupyter Notebook

Story

Read more

Custom parts and enclosures

Augmented-Autonomous-Vision-using-Generative-Adversarial-Networks

This script implements a CycleGAN model for translating images between day and night domains. Follow these instructions to set up and run the CycleGAN model: ### Prerequisites 1. **Python Libraries**: Ensure you have the following libraries installed: - PyTorch - torchvision - numpy - tqdm - (Optional) any other dependencies for loading and processing images. 2. **Data Preparation**: - Prepare two datasets: one containing images from the day domain and the other from the night domain. - The datasets should be organized in a format compatible with the DataLoader. Each dataset should be a directory containing images. ### Setup 1. **Directory Structure**: - Place your day images in a directory (e.g., `data/day`). - Place your night images in a separate directory (e.g., `data/night`). 2. **Parameters**: - `batch_size`: Set the batch size for training. - `target_shape`: Define the target shape for resizing images. - `n_epochs`: Specify the number of training epochs. - `lambda_identity`: Weight for the identity loss. - `lambda_cycle`: Weight for the cycle consistency loss. - `device`: Set the computing device (e.g., 'cuda' for GPU or 'cpu'). ### Running the Code 1. **Loading the Data**: - The DataLoader will automatically load images from the specified directories. Ensure that the `dataset` variable is correctly set up to point to your image directories. 2. **Training**: - Call the `train()` function to start the training process. This function handles the training loop, updates the generators and discriminators, and saves model checkpoints periodically. - Optionally, set `save_model=True` in the `train()` function to save the trained models. 3. **Monitoring**: - The training process will print out the generator and discriminator losses at regular intervals defined by `display_step`. 4. **Model Checkpoints**: - Model checkpoints are saved during training to allow you to resume training or use the model for inference later. ### Example To run the training, simply execute the script. Ensure you have configured the parameters and data directories as needed. ```python # Example usage train(save_model=True)

Schematics

Augmented-Autonomous-Vision-using-Generative-Adversarial-Networks

This script implements a CycleGAN model for translating images between day and night domains. Follow these instructions to set up and run the CycleGAN model:

### Prerequisites

1. **Python Libraries**: Ensure you have the following libraries installed:
- PyTorch
- torchvision
- numpy
- tqdm
- (Optional) any other dependencies for loading and processing images.

2. **Data Preparation**:
- Prepare two datasets: one containing images from the day domain and the other from the night domain.
- The datasets should be organized in a format compatible with the DataLoader. Each dataset should be a directory containing images.

### Setup

1. **Directory Structure**:
- Place your day images in a directory (e.g., `data/day`).
- Place your night images in a separate directory (e.g., `data/night`).

2. **Parameters**:
- `batch_size`: Set the batch size for training.
- `target_shape`: Define the target shape for resizing images.
- `n_epochs`: Specify the number of training epochs.
- `lambda_identity`: Weight for the identity loss.
- `lambda_cycle`: Weight for the cycle consistency loss.
- `device`: Set the computing device (e.g., 'cuda' for GPU or 'cpu').

### Running the Code

1. **Loading the Data**:
- The DataLoader will automatically load images from the specified directories. Ensure that the `dataset` variable is correctly set up to point to your image directories.

2. **Training**:
- Call the `train()` function to start the training process. This function handles the training loop, updates the generators and discriminators, and saves model checkpoints periodically.
- Optionally, set `save_model=True` in the `train()` function to save the trained models.

3. **Monitoring**:
- The training process will print out the generator and discriminator losses at regular intervals defined by `display_step`.

4. **Model Checkpoints**:
- Model checkpoints are saved during training to allow you to resume training or use the model for inference later.

### Example

To run the training, simply execute the script. Ensure you have configured the parameters and data directories as needed.

```python
# Example usage
train(save_model=True)

Code

Augmented-Autonomous-Vision-using-Generative-Adversarial-Networks

This script implements a CycleGAN model for translating images between day and night domains. Follow these instructions to set up and run the CycleGAN model: ### Prerequisites 1. **Python Libraries**: Ensure you have the following libraries installed: - PyTorch - torchvision - numpy - tqdm - (Optional) any other dependencies for loading and processing images. 2. **Data Preparation**: - Prepare two datasets: one containing images from the day domain and the other from the night domain. - The datasets should be organized in a format compatible with the DataLoader. Each dataset should be a directory containing images. ### Setup 1. **Directory Structure**: - Place your day images in a directory (e.g., `data/day`). - Place your night images in a separate directory (e.g., `data/night`). 2. **Parameters**: - `batch_size`: Set the batch size for training. - `target_shape`: Define the target shape for resizing images. - `n_epochs`: Specify the number of training epochs. - `lambda_identity`: Weight for the identity loss. - `lambda_cycle`: Weight for the cycle consistency loss. - `device`: Set the computing device (e.g., 'cuda' for GPU or 'cpu'). ### Running the Code 1. **Loading the Data**: - The DataLoader will automatically load images from the specified directories. Ensure that the `dataset` variable is correctly set up to point to your image directories. 2. **Training**: - Call the `train()` function to start the training process. This function handles the training loop, updates the generators and discriminators, and saves model checkpoints periodically. - Optionally, set `save_model=True` in the `train()` function to save the trained models. 3. **Monitoring**: - The training process will print out the generator and discriminator losses at regular intervals defined by `display_step`. 4. **Model Checkpoints**: - Model checkpoints are saved during training to allow you to resume training or use the model for inference later. ### Example To run the training, simply execute the script. Ensure you have configured the parameters and data directories as needed. ```python # Example usage train(save_model=True)```

Credits

Shravan Venkatraman
1 project • 1 follower
Aravintakshan S A 21BCE1137
0 projects • 2 followers
Abeshek A
0 projects • 2 followers
Pavan Kumar S 21BCE1179
0 projects • 1 follower

Comments