JeisonPham / ECE-285-Project

0 stars 0 forks source link

Change MNIST data to be patches for convolution #14

Closed JeisonPham closed 1 year ago

JeisonPham commented 1 year ago

Right now the MNIST dataset is made up of 28 x 28 images. We can view the noisy image as $Y = X + \epsilon$. We are attempting to predict the original input $X$ which should remain the same. $Y$ however needs to be changed as we can view $Y$ as instead a collection of patches. There's a numpy function for sliding windows.. So each patch becomes a row. It should also have the ability to apply a model to the images since it is more memory efficient to transform the images beforehand than passing it through a chain of models. image

general factory function will look something like

def generate_model(input_dim, num_neurons, output_dim, num_epochs, beta,
                   model_chain,learning_rate, batch_size, rho, device='cpu'):
    """

    :param input_dim: The input dimension of the model. For CNN convex formulation it should be kernel size
    :param num_neurons: The number of neurons, can be adjusted through evolutionary methods
    :param output_dim: the number of features that should be predicted
    :param num_epochs: 
    :param beta: 
    :param model_chain: Should be a list of already trained models
    :param learning_rate: 
    :param batch_size: 
    :param rho: 
    :param device: 
    :return: 
    """
    G = sample_gate_vectors(42, d=input_dim, num_neurons=num_neurons)
    model = ConvexReLU(G, c=output_dim, p=num_neurons, d=input_dim)
    train_dataset = NoisyMnist(..., model_chain) # should return Nwh x 9 
    test_dataset = NoiseMnist(..., model_chain) 
JacobGlennAyers commented 1 year ago

Second draft is set up on the Noisy_MNIST branch

JacobGlennAyers commented 1 year ago

Completed using the pytorch unfold function. Merged from the Noisy_MNIST branch