TensorFlow-Examples

我要开发同款
匿名用户2021年11月11日
38阅读
开发技术Python
所属分类人工智能、机器学习/深度学习
授权协议View license

作品详情

TensorFlowExamples

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.TensorFlowv1

ThetutorialindexforTFv1isavailablehere:TensorFlowv1.15Examples.Orseebelowforalistoftheexamples.

Dataset

SomeexamplesrequireMNISTdatasetfortrainingandtesting.Don'tworry,thisdatasetwillautomaticallybedownloadedwhenrunningexamples.MNISTisadatabaseofhandwrittendigits,foraquickdescriptionofthatdataset,youcancheckthisnotebook.

OfficialWebsite:https://yann.lecun.com/exdb/mnist/.

Installation

Todownloadalltheexamples,simplyclonethisrepository:

gitclonehttps://github.com/aymericdamien/TensorFlow-Examples

Torunthem,youalsoneedthelatestversionofTensorFlow.Toinstallit:

pipinstalltensorflow

or(withGPUsupport):

pipinstalltensorflow_gpu

FormoredetailsaboutTensorFlowinstallation,youcancheckTensorFlowInstallationGuide

TensorFlowv1Examples-Index

ThetutorialindexforTFv1isavailablehere: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.MoreExamples

ThefollowingexamplesarecomingfromTFLearn,alibrarythatprovidesasimplifiedinterfaceforTensorFlow.Youcanhavealook,therearemanyexamplesandpre-builtoperationsandlayers.

TutorialsTFLearnQuickstart.LearnthebasicsofTFLearnthroughaconcretemachinelearningtask.Buildandtrainadeepneuralnetworkclassifier.ExamplesTFLearnExamples.AlargecollectionofexamplesusingTFLearn.
声明:本文仅代表作者观点,不代表本站立场。如果侵犯到您的合法权益,请联系我们删除侵权资源!如果遇到资源链接失效,请您通过评论或工单的方式通知管理员。未经允许,不得转载,本站所有资源文章禁止商业使用运营!
下载安装【程序员客栈】APP
实时对接需求、及时收发消息、丰富的开放项目需求、随时随地查看项目状态

评论