Skip to content

VGG'11 model on FashionMNIST dataset #16

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

Merged
merged 5 commits into from
Jul 28, 2020
Merged

Conversation

zaleslaw
Copy link
Contributor

Related to the issue #11

@zaleslaw
Copy link
Contributor Author

@Craigacp and @karllessard please have a look

Copy link
Collaborator

@Craigacp Craigacp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks.

this.imageSize = trainingImages.get(0).shape().size();
}

private static ByteNdArray readArchive(String archiveName) throws IOException {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use the mnist loader here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but I tried don't touch the MNISTDataset code here. The best idea - to refactor (convert path to archives to paramters in constructor, for example). In this way, it will have the common loader parametrized by path

import org.tensorflow.framework.optimizers.Optimizer;
import org.tensorflow.model.examples.mnist.data.ImageBatch;
import org.tensorflow.op.Ops;
import org.tensorflow.op.core.*;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer no star imports in the example code too, @karllessard what do you think?

@@ -22,7 +22,7 @@
import org.tensorflow.tools.ndarray.ByteNdArray;
import org.tensorflow.tools.ndarray.index.Index;

class ImageBatchIterator implements Iterator<ImageBatch> {
public class ImageBatchIterator implements Iterator<ImageBatch> {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These should probably have a little bit of documentation if they are public.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree

@zaleslaw
Copy link
Contributor Author

@Craigacp @karllessard I fixed comments in this repository codestyle.
Also, I suggested a few minor improvements in package structure: I'm going to add more examples for diferent architectures (but it could be based on the same datasets) and as a result I suggest the model-architecture centric package naming (not dataset as now).

What do you think?

@karllessard
Copy link
Collaborator

Hey @zaleslaw , sorry for the late reply, looks good on my side, I'm ok with this new organization. The only comment is that the datasets package is at the same level as the examples, so it is a bit misleading as one might expect to see examples of Dataset usage there, while there are just common utilities for the other examples. Should we rename it common then?

I did not went in deep analysis of your VGG model though but I trust you there ;) Wdyt @Craigacp ?

@zaleslaw
Copy link
Contributor Author

@karllessard I'll fix the package structure according your comment.
About VGG model - it's close to CNN example (I tried to keep the structure and naming in one style), but added some high-level functions for layer building, it's not Keras yet, but close to the Sequential model logic

Copy link
Collaborator

@Craigacp Craigacp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we ok to redistribute MNIST and FashionMNIST?

@@ -0,0 +1,50 @@
/*
* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't want an Oracle copyright at the top.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow, thanks!

ByteNdArray trainingLabels = readArchive(TRAINING_LABELS_ARCHIVE);
ByteNdArray testImages = readArchive(TEST_IMAGES_ARCHIVE);
ByteNdArray testLabels = readArchive(TEST_LABELS_ARCHIVE);
ByteNdArray trainingImages = readArchive(trainingImagesArchive);
Copy link
Collaborator

@Craigacp Craigacp Jul 22, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe there should be two methods here, one for MNIST and one for FashionMNIST? Then we don't have to carry around the string constants in all the classes that use them. This method can remain if people want to load in the extra MNIST test data from last years NeurIPS by supplying their own downloaded version.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe, but I've copied an existing approach, from my perspective for examples the best way to have them as a resources.

@karllessard
Copy link
Collaborator

Are we ok to redistribute MNIST and FashionMNIST?

I think that is a fair question. When I've dropped the MNIST dataset in the resource folder at first, it was kind of a temporary solution until we write a simple HTTP client to download it instead. Now by adding this new dataset, we are getting closer to crystallize this hack as something permanent, which I would prefer we avoid before the project grows too much...

So if you are ready to tackle this @zaleslaw , it would be great to change the data loader to use an HTTP client instead and remove the datasets from the resource folder. Wdyt?

@zaleslaw
Copy link
Contributor Author

@karllessard I could switch and return to MNIST to run the VGG model and remove Fashion MNIST but I'm not ready now to write http loader. My point of view - that resources is the best place to keep small datasets for examples, it's not a hack, it's a feature:) if datasets are small like MNIST and FashionMNIST.

Maybe I'm wrong about datasets keeping, and we could separate it on two parts - merge this and create a ticket for HTTP loader?

What do you think, guys?

@Craigacp
Copy link
Collaborator

I'd be happy to redistribute them if we have the rights to do so, but it's a legal question not a convenience one.

@zaleslaw
Copy link
Contributor Author

@karllessard I've repaired the license in code files and checked license for FashionMNIST dataset
Also I added a Readme file with the link to the dataset

I suggest to merge PR and create the separate ticket for HTTP client to obtain datasets from the web

@karllessard karllessard merged commit 1177e2c into tensorflow:master Jul 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants