Skip to content

Conversation

@MarkDaoust
Copy link
Member

@MarkDaoust MarkDaoust commented Oct 17, 2018

It still needs an introduction and conclusion paragraph.

But this won't be visible on the site unless we add it to the "_toc.yaml"

Staging:

https://github.com/MarkDaoust/docs/blob/load_data/site/en/tutorials/load_data/images.ipynb

https://colab.sandbox.google.com/github/MarkDaoust/docs/blob/load_data/site/en/tutorials/load_data/images.ipynb

@random-forests
Copy link
Member

random-forests commented Oct 17, 2018

Thank you for writing this! Good timing, too. Together with Kiran's notebook on tf records, this would make a great start to a "Loading data" collection.

Suggestions:

Under "Load and format the images"

  • Instead of normalizing the image by "image = (image/128.0) - 1", instead, how about "image = image / 255"?

  • This would also simplify the code to display the images (instead of "plt.imshow((image+1)/2)", we can write "plt.imshow(image)")

  • How about demo'ing the "load_and_format_image" function, just to demonstrate it works like regular Python code when eager is enabled? To do so, you could add a short block under it, that calls the method using something like "load_and_format_image('/root/.keras/datasets/flower_photos/tulips/7166644048_b00a14f01b.jpg', 0)" (I know there's a bunch of output, maybe catch it in a object, show how to get the .numpy() value, and print out the shape

Under "Pipe to a model for training"

  • Explain the prefetch parameter.

Under "Quick Transfer learning with keras.Applications"

  • Leave the depth_multiplier at the default value.

  • Finally, split the dataset into train / test, so we can show a quick evaluation after the transfer learning section, which is really cool.

Overall this is great!

@MarkDaoust
Copy link
Member Author

Instead of normalizing the image by "image = (image/128.0) - 1", instead, how about "image = image / 255"?

Done.
The tf.keras.applications.mobilenet expects data to be normalized to [-1,1].
I've switched it to use [0,1] for most of it, with a transform to [-1,1] in the transfer learning section.

demo'ing the "load_and_format_image"

Done.

Explain the prefetch parameter.

Done

Leave the depth_multiplier at the default value.

Done

Finally, split the dataset into train / test, so we can show a quick evaluation after the transfer learning section, which is really cool.

I'd rather avoid going into too much detail here. I just want to get to "see how easy that was!" and leave the rest for a real tutorial.

@MarkDaoust MarkDaoust added the cla: yes CLA has been signed label Oct 23, 2018
+Split H2/H3. +minor cleanup and clarifications.
@MarkDaoust MarkDaoust requested review from jsimsa and mrry and removed request for wolffg November 28, 2018 18:53
@MarkDaoust
Copy link
Member Author

+tf.data

Hey Derek, Jiri,

Does this seem like a reasonable approach to loading image directories with tf.data?

@jsimsa
Copy link
Contributor

jsimsa commented Nov 29, 2018

Thanks @MarkDaoust did a pass and left some comments.

Copy link
Contributor

@mrry mrry left a comment

Choose a reason for hiding this comment

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

Thanks for getting this started, Mark!

},
"cell_type": "markdown",
"source": [
"One disadvantage to using an im memory cache is that the cache must be rebuilt on each run, giving the same startup delay each time the dataset is started:"
Copy link
Contributor

Choose a reason for hiding this comment

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

I think @rohan100jain has some changes in flight that will help this no longer be the case.

@yifeif yifeif added the ready to pull Start merge process label Dec 4, 2018
@MarkDaoust
Copy link
Member Author

(not really merging, just testing copybara)

@MarkDaoust MarkDaoust removed the ready to pull Start merge process label Dec 4, 2018
@MarkDaoust MarkDaoust added ready to pull Start merge process and removed ready to pull Start merge process labels Dec 4, 2018
@rcrowe-google rcrowe-google added the ready to pull Start merge process label Dec 4, 2018
@lamberta lamberta removed the ready to pull Start merge process label Dec 4, 2018
@lamberta lamberta added the notebook: new New Colab notebook tutorial label Dec 26, 2018
@MarkDaoust MarkDaoust added the ready to pull Start merge process label Jan 14, 2019
@MarkDaoust MarkDaoust merged commit 262f768 into tensorflow:master Jan 18, 2019
MarkDaoust added a commit that referenced this pull request Jan 18, 2019
PiperOrigin-RevId: 229997672
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla: yes CLA has been signed notebook: new New Colab notebook tutorial ready to pull Start merge process

7 participants