TensorFlow.jsisanopen-sourcehardware-acceleratedJavaScriptlibraryfortraininganddeployingmachinelearningmodels.
DevelopMLintheBrowserUseflexibleandintuitiveAPIstobuildmodelsfromscratchusingthelow-levelJavaScriptlinearalgebralibraryorthehigh-levellayersAPI.
DevelopMLinNode.jsExecutenativeTensorFlowwiththesameTensorFlow.jsAPIundertheNode.jsruntime.
RunExistingmodelsUseTensorFlow.jsmodelconverterstorunpre-existingTensorFlowmodelsrightinthebrowser.
RetrainExistingmodelsRetrainpre-existingMLmodelsusingsensordataconnectedtothebrowserorotherclient-sidedata.
AboutthisrepoThisrepositorycontainsthelogicandscriptsthatcombineseveralpackages.
APIs:
TensorFlow.jsCore,aflexiblelow-levelAPIforneuralnetworksandnumericalcomputation.TensorFlow.jsLayers,ahigh-levelAPIwhichimplementsfunctionalitysimilartoKeras.TensorFlow.jsData,asimpleAPItoloadandpreparedataanalogoustotf.data.TensorFlow.jsConverter,toolstoimportaTensorFlowSavedModeltoTensorFlow.jsTensorFlow.jsVis,in-browservisualizationforTensorFlow.jsmodelsTensorFlow.jsAutoML,SetofAPIstoloadandrunmodelsproducedbyAutoMLEdge.Backends/Platforms:
TensorFlow.jsCPUBackend,pure-JSbackendforNode.jsandthebrowser.TensorFlow.jsWebGLBackend,WebGLbackendforthebrowser.TensorFlow.jsWASMBackend,WebAssemblybackendforthebrowser.TensorFlow.jsWebGPU,WebGPUbackendforthebrowser.TensorFlow.jsNode,Node.jsplatformviaTensorFlowC++adapter.TensorFlow.jsReactNative,ReactNativeplatformviaexpo-gladapter.Ifyoucareaboutbundlesize,youcanimportthosepackagesindividually.
IfyouarelookingforNode.jssupport,checkouttheTensorFlow.jsNodedirectory.
ExamplesCheckoutourexamplesrepositoryandourtutorials.
GalleryBesuretocheckoutthegalleryofallprojectsrelatedtoTensorFlow.js.
Pre-trainedmodelsBesuretoalsocheckoutourmodelsrepositorywherewehostpre-trainedmodelsonNPM.
BenchmarksLocalbenchmarktool.Usethiswebpagetooltocollecttheperformancerelatedmetrics(speed,memory,etc)ofTensorFlow.jsmodelsandkernelsonyourlocaldevicewithCPU,WebGLorWASMbackends.Youcanbenchmarkcustommodelsbyfollowingthisguide.Multi-devicebenchmarktool.Usethistooltocollectthesameperformancerelatedmetricsonacollectionofremotedevices.GettingstartedTherearetwomainwaystogetTensorFlow.jsinyourJavaScriptproject:viascripttagsorbyinstallingitfromNPMandusingabuildtoollikeParcel,WebPack,orRollup.
viaScriptTagAddthefollowingcodetoanHTMLfile:
评论