Questions tagged [cgan]

13 questions
1
vote
0 answers

Implementation of the discriminator in CGAN

I am trying to implement CGAN with convolutions. I have written a discriminator. The code is running but I am not sure if it is correct or not. Below is my code import torch import torch.nn as nn import torch.optim as optim from torchvision.utils…
1
vote
0 answers

I want to optimize the conditon gan model (generator),error: shape '[64, 3, 64, 64]' is invalid for input of size 2952192 ,

This is original github source: https://github.com/otepencelik/GAN-Artwork-Generation I want to rerun this model and use it another area (CGAN). I want to change the network to generate multiple label and increase the performance but it didn't work…
Jackie J
  • 11
  • 2
1
vote
0 answers

best way of using float as the conditional input for cGAN? one-hot encoder?

I'm trying to make a model for outputing an image based on speed (a float input). This can for example range from 1.0 to 6.0. so basically it is an cGAN, with a latent noise and a float as combined input. I wonder what's the best way to encode my…
icarus.z
  • 45
  • 4
0
votes
0 answers

Data cardinality is ambiguous: x sizes: 15, 15 y sizes: 30 Make sure all arrays contain the same number of samples

def train_gan(self, epochs, batch_size=30, save_interval=50): print('Train') self.img_rows = 256 self.img_cols = 256 # Load and preprocess the dataset print('start train_gan') # Define the…
0
votes
0 answers

Can I call a generator model created with functional api into this Model subclass of a cGAN (tensorflow , keras)?

Currently, this is what I have for a cGAN model using model subclassing (ignore that the discriminator model is missing). # Create the generator. generator = keras.Sequential( [ keras.layers.InputLayer((generator_in_channels,)), …
0
votes
0 answers

Problems with the network architecture for a conditional GAN that works with 64x64x3 images

I am trying to create a cGAN that generates new anime faces. The data I am using is given in the link: https://www.kaggle.com/datasets/splcher/animefacedataset. As is evident, there is no class label associated with the dataset. Hence, I have used…
0
votes
1 answer

ValueError: Input 0 of layer “Discriminator” is incompatible with the layer: expected shape=(None, 3), found shape=(100, 2)

import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns from sklearn import preprocessing from sklearn.preprocessing import StandardScaler from sklearn.metrics import precision_score, recall_score, f1_score,\ …
0
votes
0 answers

Why is my cDCGAN model behaving like this?

Training a cDCGAN model using PyTorch to generate Covid X-ray images at a resolution of 128x128. Currently limited to 2 classes over 500 epochs while developing. Actual Losses Why does it behave like this? Results Class 0 - 6012 samples Class 1 -…
0
votes
0 answers

cGAN: RuntimeError: The size of tensor a (100) must match the size of tensor b (7) at non-singleton dimension 0

I am new to cGAN architectures and I was trying out on the MNIST which worked out quite fine but not my own data set. The data set has 7 classes and an Input size of each image (64, 64, 3). I am using Pytorch with Python 3.10: class…
soku
  • 1
0
votes
0 answers

Input 0 of layer "conv2d" is incompatible with the layer: expected axis -1 of input shape to have value 1

I am trying to make a Cgan and I want to do an interpolation between the categories, but I get the following error "Input 0 of layer "conv2d" is incompatible with the layer: expected axis -1 of input shape to have value 1, but received input with…
0
votes
0 answers

Conditional GAN loss

I'm a little confused, I applied an existing code to the cgan and then plotted a plot diagram for the loss. It showed me three vector values ​​of loss for the generator while the discriminant took only one loss vector. Why?
Lolo
  • 1
  • 1
0
votes
1 answer

In layers.append(nn.BatchNorm1d(out_feat, 0.8)) and layers.append(nn.LeakyReLU(0.2, inplace=True)) What is meant by 0.8 and 0.2?

class Generator(nn.Module): def init(self): # defines an init function which is used to initialize all the required variables super(Generator, self).init() self.label_emb = nn.Embedding(opt.n_classes, opt.n_classes) def block(in_feat,…
0
votes
0 answers

Getting Error in tf.cast while implementing CGAN

Question HI, I am implementing CGAN in TensorFlow. Please help me understand the cause of the error and how to resolve it. Code def train(dataset, epochs): for epoch in range(epochs): start = time.time() for image_batch in dataset: …