ThistutorialwasdesignedforeasilydivingintoTensorFlow,throughexamples.Forreadability,itincludesbothnotebooksandsourcecodeswithexplanation,forbothTFv1&v2.
ItissuitableforbeginnerswhowanttofindclearandconciseexamplesaboutTensorFlow.Besidesthetraditional'raw'TensorFlowimplementations,youcanalsofindthelatestTensorFlowAPIpractices(suchaslayers,estimator,dataset,...).
Update(05/16/2020):MovingalldefaultexamplestoTF2.ForTFv1examples:checkhere.
Tutorialindex0-PrerequisiteIntroductiontoMachineLearning.IntroductiontoMNISTDataset.1-IntroductionHelloWorld(notebook).Verysimpleexampletolearnhowtoprint"helloworld"usingTensorFlow2.0+.BasicOperations(notebook).AsimpleexamplethatcoverTensorFlow2.0+basicoperations.2-BasicModelsLinearRegression(notebook).ImplementaLinearRegressionwithTensorFlow2.0+.LogisticRegression(notebook).ImplementaLogisticRegressionwithTensorFlow2.0+.Word2Vec(WordEmbedding)(notebook).BuildaWordEmbeddingModel(Word2Vec)fromWikipediadata,withTensorFlow2.0+.GBDT(GradientBoostedDecisionTrees)(notebooks).ImplementaGradientBoostedDecisionTreeswithTensorFlow2.0+topredicthousevalueusingBostonHousingdataset.3-NeuralNetworksSupervisedSimpleNeuralNetwork(notebook).UseTensorFlow2.0'layers'and'model'APItobuildasimpleneuralnetworktoclassifyMNISTdigitsdataset.SimpleNeuralNetwork(low-level)(notebook).RawimplementationofasimpleneuralnetworktoclassifyMNISTdigitsdataset.ConvolutionalNeuralNetwork(notebook).UseTensorFlow2.0+'layers'and'model'APItobuildaconvolutionalneuralnetworktoclassifyMNISTdigitsdataset.ConvolutionalNeuralNetwork(low-level)(notebook).RawimplementationofaconvolutionalneuralnetworktoclassifyMNISTdigitsdataset.RecurrentNeuralNetwork(LSTM)(notebook).Buildarecurrentneuralnetwork(LSTM)toclassifyMNISTdigitsdataset,usingTensorFlow2.0'layers'and'model'API.Bi-directionalRecurrentNeuralNetwork(LSTM)(notebook).Buildabi-directionalrecurrentneuralnetwork(LSTM)toclassifyMNISTdigitsdataset,usingTensorFlow2.0+'layers'and'model'API.DynamicRecurrentNeuralNetwork(LSTM)(notebook).Buildarecurrentneuralnetwork(LSTM)thatperformsdynamiccalculationtoclassifysequencesofvariablelength,usingTensorFlow2.0+'layers'and'model'API.UnsupervisedAuto-Encoder(notebook).Buildanauto-encodertoencodeanimagetoalowerdimensionandre-constructit.DCGAN(DeepConvolutionalGenerativeAdversarialNetworks)(notebook).BuildaDeepConvolutionalGenerativeAdversarialNetwork(DCGAN)togenerateimagesfromnoise.4-UtilitiesSaveandRestoreamodel(notebook).SaveandRestoreamodelwithTensorFlow2.0+.BuildCustomLayers&Modules(notebook).Learnhowtobuildyourownlayers/modulesandintegratethemintoTensorFlow2.0+Models.Tensorboard(notebook).Trackandvisualizeneuralnetworkcomputationgraph,metrics,weightsandmoreusingTensorFlow2.0+tensorboard.5-DataManagementLoadandParsedata(notebook).BuildefficientdatapipelinewithTensorFlow2.0(Numpyarrays,Images,CSVfiles,customdata,...).BuildandLoadTFRecords(notebook).ConvertdataintoTFRecordsformat,andloadthemwithTensorFlow2.0+.ImageTransformation(i.e.ImageAugmentation)(notebook).ApplyvariousimageaugmentationtechniqueswithTensorFlow2.0+,togeneratedistortedimagesfortraining.6-HardwareMulti-GPUTraining(notebook).TrainaconvolutionalneuralnetworkwithmultipleGPUsonCIFAR-10dataset.TensorFlowv1ThetutorialindexforTFv1isavailablehere:TensorFlowv1.15Examples.Orseebelowforalistoftheexamples.
DatasetSomeexamplesrequireMNISTdatasetfortrainingandtesting.Don'tworry,thisdatasetwillautomaticallybedownloadedwhenrunningexamples.MNISTisadatabaseofhandwrittendigits,foraquickdescriptionofthatdataset,youcancheckthisnotebook.
OfficialWebsite:https://yann.lecun.com/exdb/mnist/.
InstallationTodownloadalltheexamples,simplyclonethisrepository:
gitclonehttps://github.com/aymericdamien/TensorFlow-ExamplesTorunthem,youalsoneedthelatestversionofTensorFlow.Toinstallit:
pipinstalltensorflowor(withGPUsupport):
pipinstalltensorflow_gpuFormoredetailsaboutTensorFlowinstallation,youcancheckTensorFlowInstallationGuide
TensorFlowv1Examples-IndexThetutorialindexforTFv1isavailablehere:TensorFlowv1.15Examples.
0-PrerequisiteIntroductiontoMachineLearning.IntroductiontoMNISTDataset.1-IntroductionHelloWorld(notebook)(code).Verysimpleexampletolearnhowtoprint"helloworld"usingTensorFlow.BasicOperations(notebook)(code).AsimpleexamplethatcoverTensorFlowbasicoperations.TensorFlowEagerAPIbasics(notebook)(code).GetstartedwithTensorFlow'sEagerAPI.2-BasicModelsLinearRegression(notebook)(code).ImplementaLinearRegressionwithTensorFlow.LinearRegression(eagerapi)(notebook)(code).ImplementaLinearRegressionusingTensorFlow'sEagerAPI.LogisticRegression(notebook)(code).ImplementaLogisticRegressionwithTensorFlow.LogisticRegression(eagerapi)(notebook)(code).ImplementaLogisticRegressionusingTensorFlow'sEagerAPI.NearestNeighbor(notebook)(code).ImplementNearestNeighboralgorithmwithTensorFlow.K-Means(notebook)(code).BuildaK-MeansclassifierwithTensorFlow.RandomForest(notebook)(code).BuildaRandomForestclassifierwithTensorFlow.GradientBoostedDecisionTree(GBDT)(notebook)(code).BuildaGradientBoostedDecisionTree(GBDT)withTensorFlow.Word2Vec(WordEmbedding)(notebook)(code).BuildaWordEmbeddingModel(Word2Vec)fromWikipediadata,withTensorFlow.3-NeuralNetworksSupervisedSimpleNeuralNetwork(notebook)(code).Buildasimpleneuralnetwork(a.k.aMulti-layerPerceptron)toclassifyMNISTdigitsdataset.RawTensorFlowimplementation.SimpleNeuralNetwork(tf.layers/estimatorapi)(notebook)(code).UseTensorFlow'layers'and'estimator'APItobuildasimpleneuralnetwork(a.k.aMulti-layerPerceptron)toclassifyMNISTdigitsdataset.SimpleNeuralNetwork(eagerapi)(notebook)(code).UseTensorFlowEagerAPItobuildasimpleneuralnetwork(a.k.aMulti-layerPerceptron)toclassifyMNISTdigitsdataset.ConvolutionalNeuralNetwork(notebook)(code).BuildaconvolutionalneuralnetworktoclassifyMNISTdigitsdataset.RawTensorFlowimplementation.ConvolutionalNeuralNetwork(tf.layers/estimatorapi)(notebook)(code).UseTensorFlow'layers'and'estimator'APItobuildaconvolutionalneuralnetworktoclassifyMNISTdigitsdataset.RecurrentNeuralNetwork(LSTM)(notebook)(code).Buildarecurrentneuralnetwork(LSTM)toclassifyMNISTdigitsdataset.Bi-directionalRecurrentNeuralNetwork(LSTM)(notebook)(code).Buildabi-directionalrecurrentneuralnetwork(LSTM)toclassifyMNISTdigitsdataset.DynamicRecurrentNeuralNetwork(LSTM)(notebook)(code).Buildarecurrentneuralnetwork(LSTM)thatperformsdynamiccalculationtoclassifysequencesofdifferentlength.UnsupervisedAuto-Encoder(notebook)(code).Buildanauto-encodertoencodeanimagetoalowerdimensionandre-constructit.VariationalAuto-Encoder(notebook)(code).Buildavariationalauto-encoder(VAE),toencodeandgenerateimagesfromnoise.GAN(GenerativeAdversarialNetworks)(notebook)(code).BuildaGenerativeAdversarialNetwork(GAN)togenerateimagesfromnoise.DCGAN(DeepConvolutionalGenerativeAdversarialNetworks)(notebook)(code).BuildaDeepConvolutionalGenerativeAdversarialNetwork(DCGAN)togenerateimagesfromnoise.4-UtilitiesSaveandRestoreamodel(notebook)(code).SaveandRestoreamodelwithTensorFlow.Tensorboard-Graphandlossvisualization(notebook)(code).UseTensorboardtovisualizethecomputationGraphandplottheloss.Tensorboard-Advancedvisualization(notebook)(code).GoingdeeperintoTensorboard;visualizethevariables,gradients,andmore...5-DataManagementBuildanimagedataset(notebook)(code).BuildyourownimagesdatasetwithTensorFlowdataqueues,fromimagefoldersoradatasetfile.TensorFlowDatasetAPI(notebook)(code).IntroducingTensorFlowDatasetAPIforoptimizingtheinputdatapipeline.LoadandParsedata(notebook).Buildefficientdatapipeline(Numpyarrays,Images,CSVfiles,customdata,...).BuildandLoadTFRecords(notebook).ConvertdataintoTFRecordsformat,andloadthem.ImageTransformation(i.e.ImageAugmentation)(notebook).Applyvariousimageaugmentationtechniques,togeneratedistortedimagesfortraining.6-MultiGPUBasicOperationsonmulti-GPU(notebook)(code).Asimpleexampletointroducemulti-GPUinTensorFlow.TrainaNeuralNetworkonmulti-GPU(notebook)(code).AclearandsimpleTensorFlowimplementationtotrainaconvolutionalneuralnetworkonmultipleGPUs.MoreExamplesThefollowingexamplesarecomingfromTFLearn,alibrarythatprovidesasimplifiedinterfaceforTensorFlow.Youcanhavealook,therearemanyexamplesandpre-builtoperationsandlayers.
TutorialsTFLearnQuickstart.LearnthebasicsofTFLearnthroughaconcretemachinelearningtask.Buildandtrainadeepneuralnetworkclassifier.ExamplesTFLearnExamples.AlargecollectionofexamplesusingTFLearn.
评论