제너럴공국

Jetson Nano에 특정 버전 TensorFlow 설치하기 본문

전자전기공학/Jetson Nano

Jetson Nano에 특정 버전 TensorFlow 설치하기

제너럴3세 2021. 1. 1. 17:26
반응형

오늘은 젯슨 나노의 초기 환경 설정 및 텐서플로우 설치과정을 정리해보겠습니다.
저는 텐서플로우 버전때문에 애를 좀 먹어서, 이 부분을 중점적으로 정리해보겠습니다.
2단계7단계가 가장 중요합니다!!!


<하드웨어 단계>

1단계) Jetson nano와 다른 부속품도 같이 구매하였습니다.

  1. Jetson nano
  2. 전용어댑터(5V 4A)
  3. 무선 랜카드(intel 8260AC 867MBPS [SZH-IWA006])
  4. 무선 랜카드 안테나+케이블[SZH-IWA013] 
  5. Jetson Nano 금속 케이스 블랙 2 [SZH-JET005]

전용어댑터의 요구 전류가 좀 특이합니다. 같이 구입하시는 거 추천드립니닷.

저는 2대를 구매했습니다.


<이미지 플래시 단계>

2-1단계) 이미지 파일 최신 버전 다운로드
 공식 사이트에서 이미지 파일을 다운로드 받습니다. 아래 사이트에서 젯슨 나노의 초기 사용과 "최신 이미지 파일"을 다운 받을 수 있습니다. 하지만!!! 여기서 문제가 있습니다. 

저 노란 부분을 누르면 최신 image 파일을 다운받을 수 있습니다.

2-2단계) 이미지 파일 구 버전 다운로드
 젯슨 나노는 이전 버전의 OS 이미지를 제공합니다. 아래 사이트에서 접근이 가능한대요. 이 기능이 왜 중요할까요? 바로 젯슨 이미지마다 텐서플로우와 호환성(Compatibility)이 다르기 때문입니다.

 아래 표는 굉장히 중요한 표입니다. 본인이 특정 버전의 텐서플로우를 사용하고 싶다면 꼭 그에 해당하는 JetPack Version을 설치해주어야해요. 다른 버전에서 다른 텐서플로우를 작동시킬 수 있는 방법이 있긴하지만, 저는 너무 어렵고 복잡해서 포기했습니다. 처음부터 잘 설치해주는게 마음편해요.

저는 1.15.0의 Tensorflow를 사용해야 해서 4.2.x의 JetPack을 설치했습니다.

docs.nvidia.com/deeplearning/frameworks/install-tf-jetson-platform-release-notes/tf-jetson-rel.html#tf-jetson-rel

 

Release Notes For Jetson Platform :: NVIDIA Deep Learning Frameworks Documentation

This document describes the key features, software enhancements and improvements, and known issues regarding Tensorflow 1.15.3 and 2.2.0 on the Jetson platform. Key Features and Enhancements This release includes the following key features and enhancements

docs.nvidia.com

3단계) 그럼 이제 내가 어떤 버전 JetPack 이미지 필요한지 알았으니, 아래 Archive에서 다운받으시면 됩니다. 저 형광펜 부분을 클릭하시면 됩니다.

developer.nvidia.com/embedded/jetpack-archive

 

JetPack Archive

This page includes access to previously released versions of JetPack. Archived versions are no longer supported. The latest version of JetPack is always available under the main NVIDIA JetPack product page.

developer.nvidia.com

4단계) balena etcher로 이미지 플래시.이 부분은 공식 홈페이지가 가장 잘 설명해주더라구요.

developer.nvidia.com/embedded/learn/get-started-jetson-nano-devkit#write

 

Getting Started With Jetson Nano Developer Kit

The NVIDIA® Jetson Nano™ Developer Kit is a small AI computer for makers, learners, and developers. After following along with this brief guide, you’ll be ready to start building practical AI applications, cool AI robots, and more.

developer.nvidia.com


<텐서플로우 설치 단계>

5단계) 텐서플로우 설치 - 제 한국어 설명과 영어 설명을 함께 보시는거 추천해요.
docs.nvidia.com/deeplearning/frameworks/install-tf-jetson-platform/index.html#prereqs

 

Installing TensorFlow For Jetson Platform :: NVIDIA Deep Learning Frameworks Documentation

Installing TensorFlow for Jetson Platform provides you with the access to the latest version of the framework on a lightweight, mobile platform without being restricted to TensorFlow Lite.

docs.nvidia.com

6단계) Prerequisites and Dependencies 설치

#Install system packages required by TensorFlow
$ sudo apt-get update
$ sudo apt-get install libhdf5-serial-dev hdf5-tools libhdf5-dev zlib1g-dev zip libjpeg8-dev liblapack-dev libblas-dev gfortran

#Install and upgrade pip3
$ sudo apt-get install python3-pip
$ sudo pip3 install -U pip testresources setuptools

#Install the Python package dependencies
$ sudo pip3 install -U numpy==1.16.1 future==0.18.2 mock==3.0.5 h5py==2.10.0 keras_preprocessing==1.1.1 keras_applications==1.0.8 gast==0.2.2 futures protobuf pybind11

7단계) Tensorflow 설치

$ sudo pip3 install --extra-index-url https://developer.download.nvidia.com/compute/redist/jp/v$JP_VERSION tensorflow==$TF_VERSION+nv$NV_VERSION

위의 코드에서 본인의 Jetpack 버전TensorFlow 버전을 잘 입력해주세요. 위에서도 보여드렸던, 표를 다시 한 번 보고 잘 입력해주세요.

  1. $JP_VERSION: 젯팻 버전의 앞자리 2개의 숫자를 가져오면 됩니다. Ex) 4.2.x 버전은 42, 4.3 버전은 43
  2. $TF_VERSION: 텐서플로우 버전을 입력해주시면 됩니다. Ex) 1.15.0
  3. $NV_VERSION: NVIDIA container 버전을 입력해주시면 됩니다.  Ex) 19.12

Ex) TensorFlow 1.15.0를  컨테이너 19.12, JetPack 4.3에서 설치하고자 한다면 아래코드를 입력하면 됩니다.

$ sudo pip3 install --extra-index-url https://developer.download.nvidia.com/compute/redist/jp/v43 tensorflow-gpu==1.15.0+nv19.12

Ex) TensorFlow 1.13.1를  컨테이너 19.03, JetPack 4.2.x에서 설치하고자 한다면 아래코드를 입력하면 됩니다.

$ sudo pip3 install --extra-index-url https://developer.download.nvidia.com/compute/redist/jp/v42 tensorflow-gpu==1.13.1+nv19.3

본인이 해당하는 버전을 입력해 주시면 됩니다.

8단계) 설치는 1~2시간이 소요됩니다. 기다려주세욧. 저는 잘 됬네요.

python3
import tensorflow as tf

잘 설치됬네요 ㅎㅎ


<완료>

9단계) 이제 텐서플로우로 잘 작업해주시면 됩니다. 그리고 저는 OpenCV가 디폴트로 깔려있더라구요. ㅎㅎ 이것저것 해봤습니다.

간단하게 디스플레이로 디스플레이 인식해봤습니다.

-끝-

반응형
Comments