Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GAN+BetaVAE models #1

Open
wants to merge 65 commits into
base: main
Choose a base branch
from
Open

GAN+BetaVAE models #1

wants to merge 65 commits into from

Conversation

AtarSander
Copy link

Project consists of two separate models created for car images generation:

  • GAN model - trained on all parts of dataset, tested, with results in README.md.
  • betaVAE model - works, but development still in progress to achieve satisfying results.

AtarSander and others added 30 commits March 18, 2024 22:39
…sample image from NuImages dataset.

- new file car_finder with class CarFinder
- function fetch_vehicles_bounding_boxes iterates through each object and checks if its a vehicle
…es bounding boxes for each image in dataset.

- function iterates through images in dataset and uses fetch_vehicles_bboxes_from_img to get bounding boxes of all vehicles
…mages of cars from given bounding boxes. Minor names changes in car_finder.

- function cut_out_bbox uses cv2 library for cutting an image fragment where the car is positioned
- function cut_out_vehicles iterates through dataset and cuts out all of vehicles there
- in car_finder changed names for clarity
…nder.

- check_bbox_size checks if bounding box of a vegicle is not below given threshold
- implemented check_bbox_size into fetch_vehicles_bboxes_from_img
…for possible data pruning/augmentation in the future. Added .gitignore.

- functions brigthness, sharpness, focus, contrast, noise_frequency, color_balance, uniformity measure different image metrics
- their results are added into dictionary in function analyze_image
- set image enables changing an image without creating new object
… For now it resizes images to one, target width and size. Created requirements file.

- DataPreprocessor consist of function is_too_small which is used in resize_image for checking what type of interpolation to use for the best effect
- deleted old commented code from image_quality_analyzer
…eQualityAnalyzer and DataPreprocessor

- created analyze_dataset function which iterates through filenames in given directory and calculates metrics for each image
- created resize dataset which iterates through filenames in given directory and resizes each image
- created Generator model class for generating images from noise input
- created Discriinator model class for veryfiying image accuracy
… model.

- Generator and Discriminator created on init, needed parameters passed as init arguments
- traning happens inside train function which is split into smaller parts
- separated functions for initializing weights, optim setup, loss calculations, backprop and evaluation to keep the code clean
…lasses.

- both models use xavier normal init for Conv2d or ConvTranspose2d layers and constant init for BatchNorm2d layers
- fixed nn.Module inheritance in, added forward methods
- fixed optimizer arguments in GAN, added retain_graph to backprop
- deleted comment in carfinder
- load_dataset uses torchvision.transforms for chaning input images into traning data for GAN model.
…odel. Updated requirements, and GAN class.

- test.py uses all of the class components to first extract and preprocess training data, and then train the model.
- torch and matplotlib added to requirements
- plots now saved as a file in GAN.
- created src folder for cleaner structure
- fixed import paths
…odel.py, implemented weights saving and added progress bar to car_cutter.

- In GAN, Generator and Discriminator fixed cuda usage so it works for every step of the training.
- Implemented models weights saving in GAN. New directory models created for keeping the weights.
- Added progress bar to cut_out_vehicles_from_dataset function in CarCutter to keep note of the progress (it takes a lot of time).
GAN network performs training without crashing or returning errors. In this state it doesn't provide satisfying results after training (work needed with parameters tuning).
… measurement per epoch, implemented tensorboard visualization.

- in model.py changed features dimension in convolutional blocks for both generator and discriminator
- in gan.py implemented elapsed time measurement per epoch for training
- in gan.py added temporary implementation of tensorboard visualization for training
- label loop iterates through given directory files
- it uses label_file to pick if the car is placed front, back or sideways to camera (or bad picture and discard)
- it is possible to pick sort_type
- it is possible to print images in cv2 window while labeling
…dded labeler class and labeling script to enable labeling images, started work on data augmeneter.

- in traning loop comented epoch end condition and implemented time constraints
- created class labeler for labeling images to correct subdirectories
- labeling script enables same thing with different technique
- data augmenter implements function for creating similar images to the original
- implemented flipping, rotating, brightness and contrast adjusting and gaussian noise application functions
- augment_dataset function iterates through a folder and creates 6 more variations of each image
…ories.

- added .vscode to .gitignore
- fixed path passing in data augmenter
- added line clearing in terminal for progress bar and implemented it in classes using the progress bar
- implemented giving path to logs in GAN manually
- logs directory consists of fake and real subdir for tensorboard log keeping
mikorozek and others added 30 commits April 24, 2024 22:33
…, removed unused code in gan, fixed types in model eval.

- implemented try-except handling within commands in ADShell, especially ones with parameters passed from terminal
- fixed bugged model calls in ADShell
- changed name of .json config file, added additional parameters for complete training flexilibty
- corrected types in both model_eval and ADShell
- added link to dataset in kaggle
- added instalation instruction
- implemented usage guide with separate section for training, inference and evaluation
- added images of generated cars
- grammar corrections
- class inherits from nn.Module
- it consists of encoder and decoder with helper functions for building them
- they are joined in forward method together with reparametrize
…taVAETrainer class.

- removed beta parameter from beta_vae class (it's needed for training, not creating the model)
- added weights initialization for decoder and encoder
- created rough draft of BetaVAETrainer class for training process with data loading, forward prop, loss calculation and backpropagation
…py, updated autodoppelganger shell for betavae.

- fixed wrong arguments passing in beta_vae
- added weights saving and loading into BetaVAETrainer
- added printing training_stats
- added generating samples
- implemented commands in adshell for betavae usage
- Added normalization for GAN generation.
- Implemented cpu usage in both models generation.
- generate disentangled samples in both ad shell and train
- added more error catching
- replaced old style data resizing with appropriate torchvision transformations
- added many data augmentations transformation in place of unused data augmentation class
- removed unecessary blank line in train.py
- removed test print statement in gan
- corrected mean transformation in data_preprocessor
- implemented saving of weight every 20 epoch in train.py
- updated autodoppelganger_shell accordingly
…training is finished.

- updated json config file
- changed weight saving logic in adshell (for bvae only)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants