TensorFlow Tutorial #18 TFRecords & Dataset API

  Рет қаралды 36,762

Hvass Laboratories

Hvass Laboratories

Күн бұрын

How to use TFRecords with the Dataset and Estimator APIs in TensorFlow.
github.com/Hva...
This tutorial does NOT work with TensorFlow 2 and later versions, and it would take too much time and effort to update it.

Пікірлер: 67
@strachol13
@strachol13 6 жыл бұрын
I have managed to get 78% accuracy on 'test set' pictures (on the 'train set' the loss hovers around 0.02-0.002) after some tweaks to the actual files in datasets. I changed them so those are more equal in numbers. (there were too much spooneys). Also I shufled the pictures in test and train folders so those are more uniform and not that test folder is full of cutlery on grass as opposed to more abstract backgrounds in the train folders. (This was using CNN approach) the end spread of predictions was very uniform 82,102,107 and with 78% accuracy I think it is preety good score on such 'hard' dataset. So the code is definitelly on the good side. Also people, please remember that after trying different approaches you must actually restart your model (delete chackpoints) bacause if it is already overfitted (by past training sessions with bad approaches) then trying to fix it is nearly impossible. It's better to start with clean model and then when results are better then continue on the same model by doing smaller tweaks. I learned so much from this tutorial especially by experimenting. Thank you very much! It was awesome.
@hvasslabs
@hvasslabs 6 жыл бұрын
Thanks very much for posting your experiments! I'm glad to know that the code was fine but the data-set just needed some tweaking!
@strachol13
@strachol13 6 жыл бұрын
After another tweaks I got the model to 88.3% accuracy on test set mainly by adding 2 convolutional layers, experimenting with kernel sizes, strides and number of filters in each convolutional layer. Also adding another flettened layer helped a bit. The code is good platform to make experiments with custom models. That's great if your main goal is to learn more and not just use one of the complete ones in keras like lenet, resnet50 etc.
@hvasslabs
@hvasslabs 6 жыл бұрын
That is very cool, thanks for posting your results! Have you tried doing Hyper-Parameter Optimization on the model? See Tutorial #19.
@girlmeetsboynfallsn
@girlmeetsboynfallsn 5 жыл бұрын
GitHub.io › io › tf-slim › 2016/12/21 Web results Tfrecords Guide - Daniil's blog Dec 21, 2016 · A post showing how to convert your dataset to .tfrecords file and later on use it as a part of a computational graph. @PROPERTYSPROMO
@Kaizala1933
@Kaizala1933 6 жыл бұрын
Thanks dude, working with tf.Data has jus been a pain in the ass for the past 4 days...
@bendesign5555
@bendesign5555 5 жыл бұрын
Very useful tutorial thanks again! Can you omit the Estimator API and use the TFRecords on their own?
@richardf9112
@richardf9112 5 жыл бұрын
What a fantastic tutorial!!! Informative and well organized thank you so much
@hvasslabs
@hvasslabs 5 жыл бұрын
Thank you!
@mihailmihaylov6556
@mihailmihaylov6556 4 жыл бұрын
Hi! I have followed your tutorials and they are all extremely helpful. These are the only good tutorials I have found. One question though, would you make an update on how to load tfrecords with tfdataset and a customer estimator for the "beloved" tensorflow 2 ? I have been struggling for quite some time now, and I cannot find any reasonable documentation whatsoever. Thanks in advance!
@hvasslabs
@hvasslabs 4 жыл бұрын
Thanks for the compliment! I recently updated some of the tutorials to TensorFlow v.2 but I won't be updating the others. It simply takes too much time and effort for me. If you have found out how to do it yourself by modifying this tutorial, then please put the modified version on github and post a link here.
@weichengzhu6605
@weichengzhu6605 6 жыл бұрын
Hi Hvass, thank you for your nice tutorials. Any suggestion or tutorial on using estimator and dataset API for tensorflow serving? Thanks
@hvasslabs
@hvasslabs 6 жыл бұрын
If you can't find any tutorial on that subject then you should make one.
@weichengzhu6605
@weichengzhu6605 6 жыл бұрын
Hvass Laboratories Yeah, that's a good idea. I mean for the estimator it's not supposed to be used in the way that to call the predict in production because every time it reloads the model from file systems. Instead, the estimator is supposed to be used with the TF serving. Need to add the serving receiver input_fn and then export the model. From tutorial point you've done great work.
@hvasslabs
@hvasslabs 6 жыл бұрын
朱伟成 That makes sense, thanks for pointing it out. There wasn't much information available on this topic when I made this tutorial, that's why it wasn't clear to me. You really should consider making a tutorial on this because you seem to know a lot more about it. Feel free to build on my tutorial if you like. Please post a link here so others may find it.
@youmustbenewhereguy
@youmustbenewhereguy 4 жыл бұрын
Hi, nice tutorial. A question tho, If I have 2D array float as an input, not an image, do I have to .tostring() and wrap it in bytes too? doing that somehow returning different size of array when parsing it back.
@malekibrahim7697
@malekibrahim7697 4 жыл бұрын
Can you still use these functions if your data labels are not one-hot encoded?
@BeGunNer
@BeGunNer 6 жыл бұрын
7:26 HAhaha so much saltiness Hvass. I love this video, but I started out laughing to a bunch of code in on a screen in a cafe. This does not make me look like a normal person.
@hvasslabs
@hvasslabs 6 жыл бұрын
Hehe ... You have it easy because I have learned this material the hard way and then I communicate it to you so you can learn it much more easily. I have wasted a ton of time because of crap API, crap documentation and crap code. So I am mad sometimes and need to vent my frustration :-)
@blackrachmaninov
@blackrachmaninov 5 жыл бұрын
Very nice video ! How to deal with a label which is a list and not a single value ?
@sam41619
@sam41619 5 жыл бұрын
many thanks for uploading this. Just a quick note: I have a task where I need to resize the images before making tfrecords, I used cv2 for resizing followed by 'img.tostring()' but when I saw the size of tfrecords file, it was quite large, I tried using python's native file open to store the image in tfrecord without downsizing and the resultant size of tfrecord file was much lower. Any comments on that?
@engin-hearing5978
@engin-hearing5978 3 жыл бұрын
Thank you! super useful :-)
@noli-timere-crede-tantum
@noli-timere-crede-tantum 6 жыл бұрын
I wish code reviews at work were done in this fashion. Painful, but instructive
@hvasslabs
@hvasslabs 6 жыл бұрын
Thank you!
@timephonic
@timephonic 6 жыл бұрын
Hi Magnus, Your tutorials are very helpful. I was wondering can you make a tutorial on handling multilabel image classification in tensorflow?
@hvasslabs
@hvasslabs 6 жыл бұрын
You shouldn't expect it as it takes a very long time to research and make these videos and that is not really a topic I am interested in myself. Why not do it yourself?
@timephonic
@timephonic 6 жыл бұрын
Relax. Yup sure. Good idea.
@PavanKumar-jc1qn
@PavanKumar-jc1qn 5 жыл бұрын
Hi, This is an Excellent presentation. After watching your video I am trying to run another deep learning program that uses estimators written in tensorflow but the gpu utilization is stuck at 8%. How can I improve the GPU utilization. Any pointers? Thank you Regards, Pavan
@hvasslabs
@hvasslabs 5 жыл бұрын
This is a quite broad question and it may be due to many factors. It could be that your GPU is actually not used by TensorFlow at all - if you run KZbin in the background that might show up as 8% GPU usage. If TensorFlow is actually using the GPU, then it could be because your Neural Network is very simple. I haven't used the Estimator API since I did this video, but if you just use normal Keras, then the problem can also be that your batch-size is too small.
@divyamehta5282
@divyamehta5282 5 жыл бұрын
Great tutorial Thanx for help.
@MQ2011de
@MQ2011de 6 жыл бұрын
I like this man.
@balajichetty305
@balajichetty305 5 жыл бұрын
Hi, Nice tutorial. In my case, I am using model.fit method. And I am getting the following error. TypeError: Unrecognized keyword arguments: {'input_fn': , 'steps': 200} help me how to use in model.fit Thanks
@ThibaultNeveu
@ThibaultNeveu 6 жыл бұрын
Thank for this video!
@syedjameer9511
@syedjameer9511 6 жыл бұрын
Hello Hvass Laboratories Can please make a video session image captioning . It is really worth of learning and I have learned CNN from your tutorials.But when move to image captioning . It is combination of ENCODER AND DECODER. So could you please make a video session on image captioning. It would be helpful
@hvasslabs
@hvasslabs 6 жыл бұрын
I don't think I will do a video on that topic. It takes me a very long time to research and produce these videos, and I pay for it myself, so I have to be very selective about the topics I cover.
@kislaykunal8921
@kislaykunal8921 6 жыл бұрын
Ok, so if anybody had access denied you have to specify a file name for the records, not just a directory name.
@EdBordin
@EdBordin 6 жыл бұрын
The reason the API is so hard to use is that it comes straight out of the protobuf compiler... they should have wrapped it in a higher level API.
@PadminiMansingh
@PadminiMansingh 4 жыл бұрын
How to split own image dataset by xtrain and xtest
@suharsh96
@suharsh96 6 жыл бұрын
THANK YOU !. I THOUGHT I WAS STUPID
@Salmariazi
@Salmariazi 6 жыл бұрын
Thank you so much for this tutorial! Tensorflow documentation is horrible!
@christianherz2916
@christianherz2916 5 жыл бұрын
I felt the same way! 7:27 really made me laugh.
@nathanclin70
@nathanclin70 5 жыл бұрын
Could you provide the link to the tutorial in Chinese? Thanks
@hvasslabs
@hvasslabs 5 жыл бұрын
github.com/Hvass-Labs/TensorFlow-Tutorials-Chinese
@jordanlee1439
@jordanlee1439 6 жыл бұрын
7:26 😂😂
@stillinmusic
@stillinmusic 6 жыл бұрын
hahahahah "exponentially goodness"
@kernel2006
@kernel2006 6 жыл бұрын
Turtle Nerd Gasm
@adeeb12321
@adeeb12321 6 жыл бұрын
*Thanks*
@eddy5952
@eddy5952 5 жыл бұрын
Yes. I guess the reason people feel hard to understand tf api is that we do not have a good "context".
@jianxiongji7604
@jianxiongji7604 6 жыл бұрын
lol what is that tutorial in Chinese?
@mohitkaushik1292
@mohitkaushik1292 4 жыл бұрын
2 years passed and the APIs are still a pain..
@tingnews7273
@tingnews7273 5 жыл бұрын
Hi there. Why not make a tutorial about the tensor2tensor. I found the idea of it is very important. And just like the api. It's hard to modify to impliment the new paper. If you can find another chinese tutorial and teach us. It will be helpful for the guys outside google
@hvasslabs
@hvasslabs 5 жыл бұрын
Why don't you make it? I think I've done enough.
@tingnews7273
@tingnews7273 5 жыл бұрын
@@hvasslabs You know when learn google things . Just cant get it . Learn it again and again , sitll just hello world . Run the example is ok. But advance tutorial . For example. My own dataset or want to implement some paper. Dont how to do it.....
@arkoraa
@arkoraa 6 жыл бұрын
subbed for 7:26
@hvasslabs
@hvasslabs 6 жыл бұрын
TURTLE Nerdgasm! I meant to say TOTAL Nerdgasm :-)
@Leibniz_28
@Leibniz_28 3 жыл бұрын
Waiting for the tf2 tutorial
@hvasslabs
@hvasslabs 3 жыл бұрын
Try and hold your breath while waiting :-)
@蜜熊胖胖猪
@蜜熊胖胖猪 6 жыл бұрын
Don'y you think the whole open source community nowadays become more and more arrogant? Like if you don't understand their description than it is your fault. And I really can not understand, why those people write descriptions and examples so abstract, I don't believe their brains are more complicated than normal one's, the only reason they write a shit I could image is just arrogant attitude。 But of course, they will say: this is a free tools, you do not pay anything, why you still complain?
@hvasslabs
@hvasslabs 6 жыл бұрын
Did you watch my video titled Pulp Code? You might like it :-)
@marr73
@marr73 6 жыл бұрын
they might be ignorant too
@swordflyshen8439
@swordflyshen8439 2 жыл бұрын
Theme: API document sucks
@PadminiMansingh
@PadminiMansingh 4 жыл бұрын
May I have ur mail-id sir
@girlmeetsboynfallsn
@girlmeetsboynfallsn 5 жыл бұрын
GitHub.io › io › tf-slim › 2016/12/21 Web results Tfrecords Guide - Daniil's blog Dec 21, 2016 · A post showing how to convert your dataset to .tfrecords file and later on use it as a part of a computational graph. @PROPERTYSPROMO
TensorFlow Tutorial #19 Hyper-Parameter Optimization
34:29
Hvass Laboratories
Рет қаралды 23 М.
TensorFlow Tutorial #23 Time-Series Prediction
28:06
Hvass Laboratories
Рет қаралды 195 М.
How it feels when u walk through first class
00:52
Adam W
Рет қаралды 20 МЛН
didn't manage to catch the ball #tiktok
00:19
Анастасия Тарасова
Рет қаралды 31 МЛН
버블티로 부자 구별하는법4
00:11
진영민yeongmin
Рет қаралды 16 МЛН
Speed up your TensorFlow code using TFRecords and dataset pipelines
26:07
TensorFlow high-level APIs: Part 1 - loading data
7:04
TensorFlow
Рет қаралды 122 М.
TensorFlow Tutorial #20 Natural Language Processing
34:14
Hvass Laboratories
Рет қаралды 36 М.
TensorFlow Tutorial 18 - Custom Dataset for Images
25:16
Aladdin Persson
Рет қаралды 99 М.
Vision Transformer - Keras Code Examples!!
21:54
Connor Shorten
Рет қаралды 42 М.
Why Does Diffusion Work Better than Auto-Regression?
20:18
Algorithmic Simplicity
Рет қаралды 343 М.
Programming with Math | The Lambda Calculus
21:48
Eyesomorphic
Рет қаралды 208 М.
How it feels when u walk through first class
00:52
Adam W
Рет қаралды 20 МЛН