DSGT-DLP / Deep-Learning-Playground

Web Application where people new to Deep Learning can input a dataset and toy around with basic Pytorch modules without writing any code
MIT License
26 stars 8 forks source link

Migrate Image Training Endpoint to Django #1011

Closed codingwithsurya closed 12 months ago

codingwithsurya commented 1 year ago

Migrate Image Training Endpoint to Django

Github Issue Number Here: Feature#993

What user problem are we solving?

With the ongoing migration from Flask Blueprint to Django for better scalability and maintainability, we need to ensure that the training endpoints for image datasets continue to function as expected. Users need a reliable endpoint to submit image training requests and this migration aims to improve the overall infrastructure.

What solution does this PR provide?

This PR introduces the /image route within the Django framework, replacing the old Flask Blueprint route. The new route handles image training requests, particularly focusing on classification tasks as regression is not supported. The structure of this endpoint is mirrored from the specified reference, with adjustments made to fit the Django framework. The old image train code served as inspiration for ensuring that the necessary features and behaviors are retained.

Testing Methodology

Testing yet to be done but to verify the functionality and integrity of the new /image route, but when testing begins, we can submit training requests using torch built-in datasets (MNIST, FashionMNIST) to ensure that models train as expected and the endpoint returns accurate results.

Also use postman for testing .

Any other considerations

codingwithsurya commented 1 year ago

@karkir0003 @dwu359

took a stab at this. a couple questions i had was.

  1. What should the correct path be in ImageDefaultDatasetCreator constructor (dataset.py)? Here is the code I am referring to:

self.train_set = datasets.__dict__[dataset_name](root='./backend/image_data_uploads', train=True, download=True, transform=self.train_transform)

self.test_set = datasets.__dict__[dataset_name](root='./backend/image_data_uploads', train=False, download=True, transform=self.test_transform)

With transition to django, is the path for data uploads still gonna be in backend/data_uploads?

  1. Does my image.py look good in /routes/image? Is there any particular i have to add for image training?

  2. Any additional schemas for image classification? I think i got the right ones.

If everything looks good here (no red flags in code), i can begin testing with our default datsets to make sure our trainspace flow is working as intended.

karkir0003 commented 1 year ago

for image data uploads, please dont use backend/ dir.

codingwithsurya commented 1 year ago

for image data uploads, please dont use backend/ dir.

sure, then what directory do i use? I dont see a similar directory in /training

karkir0003 commented 1 year ago

i think u can test the endpoint out @codingwithsurya

karkir0003 commented 1 year ago

for image data uploads, please dont use backend/ dir.

sure, then what directory do i use? I dont see a similar directory in /training

should be clarified

codingwithsurya commented 1 year ago

for image data uploads, please dont use backend/ dir.

sure, then what directory do i use? I dont see a similar directory in /training

should be clarified

yea looks good. i just commited what we talked about. and i'll test on colab as well soon when i get a chance.

codingwithsurya commented 1 year ago

added minor comments on static typing python

addressed all these

codingwithsurya commented 1 year ago

TO-DO: find viable nnSequential PyTorch MNIST Architecture for testing

codingwithsurya commented 1 year ago

TODO: Cross-Entropy Loss not computing correctly. Figure out correct param for FLATTEN in current architecture.

Otherwise, we can make our own

codingwithsurya commented 12 months ago

Update: MNIST dataset testing works!

TODO: Train/test transforms as parameter to endpoint. CIFAR10 Testing.

sonarcloud[bot] commented 12 months ago

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 6 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication