Install TensorFlow Addons on Jetson Nano - Q-engineering

文章推薦指數: 80 %
投票人數:10人

TensorFlow Addons give you additional functionality not yet included in the core of TensorFlow. If it has proven useful, a particular Addon merged into the ... Q-engineering × Machinelearning Computervision Embeddedvision Deeplearning Math Optics Shop Contact Gotocontent InstallTensorFlowAddonsonJetsonNano TensorFlowLite TensorFlow Introduction.TensorFlowAddonsgiveyouadditionalfunctionalitynotyetincludedinthecoreofTensorFlow.Ifithasprovenuseful,aparticularAddonmergedintotheTensorFlowpackage.OtheralgorithmsremainintheAddonsherd,onlyappreciatedbyaselectfewoftheTF-community.Duetotheexperimentalnatureofthepackage,versionshaveashortlifespan.Fourteenversionshavebeenreleasedin2020alone.Wehopetokeepupwiththepace.Ifnot,pleaseletusknow,andwewilltrytoprovidethemissingversiononourGitHubpage. Tensorflow.Assaid,theAddonsworkwiththeTensorFlowframework,soyouneedtohaveaworkingTensorFlowversiononyoursystem.Ifrequired,youcaninstallarecentTensorFlowversionaccordingtooneofourguides.YoucancheckyourTensorFlowversionwiththedifferentAddonsversionhere. Thewheel.OnceyouhaveTensorFlowupandrunning,youcaninstalltheAddons.TheeasiestwaytoinstalltheTensorFlow-AddonsisbyusingthewheelwehaveplacedonourGitHubpage.It'stheoutcomeofthetime-consuminginstallationfromscratchbyBazel,giveninthenextparagraph.Pleasefollowtheinstructions. #downloadthewheel$wgethttps://github.com/Qengineering/TensorFlow-Addons-Jetson-Nano/raw/main/tensorflow_addons-0.13.0.dev0-cp36-cp36m-linux_aarch64.whl#installthewheel$sudo-Hpip3installtensorflow_addons-0.13.0.dev0-cp36-cp36m-linux_aarch64.whl Youcannowchecktheinstallation,ascanbeseeninthescreendumpbelow. Installationfromscratch.BuildingtheTensorFlow-Addonsfromscratchisnotsodifficult.Itonlytakestimetocompileallcode.Intheend,yougetthesamewheelasweputonGitHub.Ifyouwanttosavesometime,feelfreetousethiswheel.IncaseyouwanttobuildtheAddonsyourself,here'sthecompleteguide.Bazel.First,youneedbazel,acommonlyusedbuildtoollikeCMake.WehavealreadyusedbazelduringthebuildingofTensorFlowfromscratch.PleaseseethisparagraphonhowtoinstallbazelonyourJetsonNano.TensorFlowcode.TheAddonsusetheTensorFlowcodefortheCUDAacceleration.YouneedtodownloadtheTensorFlowrepoandissuea./configurecommand.Youdon'tactuallybuildTensorFlow,youjustsetuptheenvironments,soBaselcandeterminewhichCUDAarchitectureit'sfacing.WeusedTensorFlow2.4.1intheinstructions,butitcanbeanyversionofyourchoice.Youonlyhavetochangethenumbering. #downloadTensorFlow2.4.1$wget-Otensorflow.ziphttps://github.com/tensorflow/tensorflow/archive/v2.4.1.zip#unpackandgivethefolderaconvenientname$unziptensorflow.zip$mvtensorflow-2.4.1tensorflow$cdtensorflow#revealtheCUDAlocation$sudosh-c"echo'/usr/local/cuda/lib64'>>/etc/ld.so.conf.d/nvidia-tegra.conf"$sudoldconfig#givethesettings$./configure jetson@nano:~/tensorflow$./configureYouhavebazel3.1.0-(@non-git)installed.Pleasespecifythelocationofpython.[Defaultis/usr/bin/python3]:FoundpossiblePythonlibrarypaths: /usr/local/lib/python3.6/dist-packages /usr/lib/python3.6/dist-packages /usr/lib/python3/dist-packagesPleaseinputthedesiredPythonlibrarypathtouse. Defaultis[/usr/local/lib/python3.6/dist-packages]/usr/lib/python3/dist-packagesDoyouwishtobuildTensorFlowwithOpenCLSYCLsupport?[y/N]:nNoOpenCLSYCLsupportwillbeenabledforTensorFlow.DoyouwishtobuildTensorFlowwithROCmsupport?[y/N]:nNoROCmsupportwillbeenabledforTensorFlow.DoyouwishtobuildTensorFlowwithCUDAsupport?[y/N]:yCUDAsupportwillbeenabledforTensorFlow.DoyouwishtobuildTensorFlowwithTensorRTsupport?[y/N]:yTensorRTsupportwillbeenabledforTensorFlow.FoundCUDA10.2in:   /usr/local/cuda-10.2/targets/aarch64-linux/lib   /usr/local/cuda-10.2/targets/aarch64-linux/includeFoundcuDNN8in:   /usr/lib/aarch64-linux-gnu   /usr/includeFoundTensorRT7in:   /usr/lib/aarch64-linux-gnu   /usr/include/aarch64-linux-gnuPleasespecifyalistofcomma-separatedCUDAcomputecapabilitiesyouwanttobuildwith.Youcanfindthecomputecapabilityofyourdeviceat:https://developer.nvidia.com/cuda-gpus.Eachcapabilitycanbespecifiedas"x.y"or"compute_xy"toincludebothvirtualandbinaryGPUcode,oras"sm_xy"toonlyincludethebinarycode.Pleasenotethateachadditionalcomputecapabilitysignificantlyincreasesyourbuildtimeandbinarysize,andthatTensorFlowonlysupportscomputecapabilities>=3.5[Defaultis:3.5,7.0]:5.3DoyouwanttouseclangasCUDAcompiler?[y/N]:nnvccwillbeusedasCUDAcompiler.Pleasespecifywhichgccshouldbeusedbynvccasthehostcompiler.[Defaultis/usr/bin/gcc]:Pleasespecifyoptimizationflagstouseduringcompilationwhenbazeloption"--config=opt"isspecified[Defaultis-march=native-Wno-sign-compare]:Wouldyouliketointeractivelyconfigure./WORKSPACEforAndroidbuilds?[y/N]:nNotconfiguringtheWORKSPACEforAndroidbuilds.PreconfiguredBazelbuildconfigs.Youcanuseanyofthebelowbyadding"--config=<>"toyourbuildcommand.See.bazelrcformoredetails. --config=mkl         #BuildwithMKLsupport. --config=monolithic  #Configformostlystaticmonolithicbuild. --config=ngraph      #BuildwithIntelnGraphsupport. --config=numa        #BuildwithNUMAsupport. --config=dynamic_kernels #(Experimental)Buildkernelsintoseparatesharedobjects. --config=v2          #BuildTensorFlow2.xinsteadof1.x.PreconfiguredBazelbuildconfigstoDISABLEdefaultonfeatures: --config=noaws       #DisableAWSS3filesystemsupport. --config=nogcp       #DisableGCPsupport. --config=nohdfs      #DisableHDFSsupport. --config=nonccl      #DisableNVIDIANCCLsupport.Configurationfinished BuildingtheAddons.AftertheinstallationofbazelandpreparingtheTensorFlowcode,youcannowdownloadtheAddonsrepo.BeforeyoustartcompilingtheAddons,youhavetomodifytheconfigure.pyscripttosettherightenvironmentvariablesforthebazelbuild.Anotherscriptthatneedsourattentionisbuild_pip_pkg.sh.Herewemustchangethe'old'pythontopython3togetthewheelgenerationworking.WehavemadeapullrequesttotheTensorFlow-Addoncommunitytomodifytheconfigure.pyandbuild_pip_pkg.shfortheJetsonNano.Untiltheyapprovethepull,pleaseusethescriptonourGitHubpage.Seethefollowingcommands. #gettheaadons$cd~$gitclone--depth=1https://github.com/tensorflow/addons.git#getthemodifiedconfigurescriptandreplacetheoriginalone$wgethttps://github.com/Qengineering/TensorFlow-Addons-Jetson-Nano/raw/main/configure.py$mvconfigure.py./addons/#getthemodifiedbuild_pip_pkg.shscriptandreplacetheoriginalone$wgethttps://github.com/Qengineering/TensorFlow-Addons-Jetson-Nano/raw/main/build_pip_pkg.sh$mvbuild_pip_pkg.sh./addons/build_deps#symlinkthetensorflowlibto/usr/lib$sudoln-s/usr/local/lib/python3.6/dist-packages/tensorflow/python/_pywrap_tensorflow_internal.so/usr/lib/lib_pywrap_tensorflow_internal.so#theJetsonNanoconfigurationwillbeset$cd~/addons$python3./configure.py#andstartthebuild$bazelclean$bazelbuildbuild_pip_pkg#finishwiththewheelgeneration$sudobazel-bin/build_pip_pkg/tmp/tensoraddons_pkg#installthewheel$cd/tmp/tensoraddons_pkg$sudo-Hpip3installtensorflow_addons-0.13.0.dev0-cp36-cp36m-linux_aarch64.whl#youcanremovetheaddonsfolder,asitisnolongerneeded$sudorm-rf~/addons Backtocontent



請為這篇文章評分?