heroku復習
herokuの復習
すっかりやってなくて忘れたので復習がてらやり方をメモ
heroku
クラウド・アプリケーション・プラットフォーム | Heroku
やり方
とりあえず、ログインして簡単なwebアプリ作成まで DBとかはなし
手順
ログイン
ダッシュボード画面
以前のアプリは何を入れていたか忘れたし使ってないはずなので消したw
クライアント側にツールインストール
brew tap heroku/brew && brew install heroku heroku autocomplete
クライアントからログイン
heroku login
↓ へえ、web経由してログインするのか・・・
アプリを名前なしで作成すると任意の名前が自動生成される
クライアント側でgitを連携
$ git init $ heroku git:remote -a [アプリ名]
任意のファイルを作成
index.php
<?php echo "test"; ?>
push
git push heroku master
heroku open
heroku open
↓
終わり
なんで今更
ちょっと CORSの確認したくて手頃に使えそうなサービスないかと考えたら herokuでなんとか実現できそうかなって思って・・・
でも忘れたので再度メモ程度として残す
react-native環境設定
いろいろ参考にしたもの
React Native の始め方 - Qiita
React Native環境構築手順 - Qiita
ReactNative入門① ~インストールから起動まで~ - Qiita
https://deha.co.jp/magazine/react-native1/
環境
mac(catalina)
入れるもの
react-native
てじゅん
brewインストール*1
/usr/bin/ruby -e “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)”
※入っている場合はupdateとかしとけば良いはず
anyenvセットアップ*2
brew install anyenv anyenv init anyenv install --init echo 'eval "$(anyenv init -)"' >> ~/.zshrc
※”~/.zshrc”の箇所は環境に合わせて書き換える(私の環境はcatalinaだったのかbach_profileが使えなかった)
※anyenvを使う - Qiita
※手動?
anyenv install --init mkdir -p $(anyenv root)/plugin git clone https://github.com/znz/anyenv-update.git $(anyenv root)/plugins/anyenv-update anyenv update anyenv install nodenv exec $SHELL -l
nodenv install
nodenv install 14.11.0 nodenv global 14.11.0 node --version
watchman
brew install watchman
yarn install
brew install yarn
react native
mkdir -p $HOME/work/react-native cd $HOME/work/react-native yarn add --exact react-native yarn add --dev --exact @types/react-native
java
brew tap AdoptOpenJDK/openjdk brew cask install adoptopenjdk8 java -version
環境変数(~/.zshrc)に追記
export ANDROID_HOME=$HOME/Library/Android/sdk export PATH=$PATH:$ANDROID_HOME/emulator export PATH=$PATH:$ANDROID_HOME/tools export PATH=$PATH:$ANDROID_HOME/tools/bin export PATH=$PATH:$ANDROID_HOME/platform-tools
xcode(環境によっては既存のものを削除する必要あり)
app storeよりインストール
CocoaPods
sudo gem install cocoapods pod --version
雛形作成
cd $HOME/work/react-native npx react-native init MyApp --template react-native-template-typescript@6.3.16
実行
cd MyApp npx react-native run-android
↓
esetの弊害
所感
- react-nativeのセットアップよりgradleの対応の方に時間を取られた
- セキュリティソフト変えた方がいいかな?
- windows10でandoriidを動かす方法も調べるけど、PC持ってないからどうしようかな・・・
jetson nanoでusb接続したカメラより物体検知
USBカメラ接続
ラズパイのカメラもあるけど接続がUSBの方が簡単そうだったのでUSBにした
USB接続し、認識されていること確認
$ lsusb Bus 002 Device 002: ID xxxx:xxxx Realtek Semiconductor Corp. Bus 002 Device 001: ID xxxx:xxxx Linux Foundation 3.0 root hub Bus 001 Device 005: ID xxxx:xxxx Elecom Co., Ltd Bus 001 Device 004: ID xxxx:xxxx Logitech, Inc. Unifying Receiver Bus 001 Device 003: ID xxxx:xxxx Bus 001 Device 002: ID xxxx:xxxx Realtek Semiconductor Corp. Bus 001 Device 001: ID xxxx:xxxx Linux Foundation 2.0 root hub $ $ ls /dev/video* /dev/video0 $
実装
import jetson.inference import jetson.utils net = jetson.inference.detectNet("ssd-mobilenet-v2", threshold=0.5) camera = jetson.utils.gstCamera(1280, 720, "/dev/video0") display = jetson.utils.glDisplay() while display.IsOpen(): img, width, height = camera.CaptureRGBA() detections = net.Detect(img, width, height) print detections if len(detections) > 0: print("detect count= {0}".format(len(detections))) for detection in detections: print ("ClassID:{0}, Confidence:{1}" \ + ", Left:{2}, Top:{3}, Right:{4}, Bottom:{5}" \ + ", Width:{6}, Height:{7}, Area:{8}, Center:{9}" \ ).format(detection.ClassID , detection.Confidence , detection.Left , detection.Top , detection.Right , detection.Bottom , detection.Width , detection.Height , detection.Area , detection.Center ) display.RenderOnce(img, width, height) display.SetTitle("Object Detection | Network {:.0f} FPS".format(net.GetNetworkFPS()))
実験(汚部屋御免)
jetson nanoでカメラ画像より物体検知
うーん、動画うまく取る方法がわからん( ;∀;)
参考
jetson nanoで物体検知を行う
jetson nanoで物体検知を試した
日本語の情報がどのあたりが最新か不明のためでいろいろ手間取った ssh経由でやVNCでやろうとしたけど結局直接端末でやらないと面倒そうなので端末で制御
パッケージインストール
sudo apt-get update sudo apt-get install git cmake libpython3-dev python3-numpy
jetson-interfaceを利用して画像認識を行うため、git clone
git clone --recursive https://github.com/dusty-nv/jetson-inference cd jetson-inference mkdir build cd build cmake ../
↓ モデルダウンロード
# modelを選択する(デフォルトのまま) [ ] 1 Image Recognition - all models (2.2 GB) [ ] 2 > AlexNet (244 MB) [*] 3 > GoogleNet (54 MB) [ ] 4 > GoogleNet-12 (42 MB) [*] 5 > ResNet-18 (47 MB) [ ] 6 > ResNet-50 (102 MB) [ ] 7 > ResNet-101 (179 MB) [ ] 8 > ResNet-152 (242 MB) [ ] 9 > VGG-16 (554 MB) [ ] 10 > VGG-19 (575 MB) [ ] 11 > Inception-V4 (172 MB) [ ] 12 Object Detection - all models (395 MB) [ ] 13 > SSD-Mobilenet-v1 (27 MB) [*] 14 > SSD-Mobilenet-v2 (68 MB) [ ] 15 > SSD-Inception-v2 (100 MB) [*] 16 > PedNet (30 MB) [ ] 17 > NultiPed (30 MB) [*] 18 > FaceNet (24 MB) [*] 19 > DetectNet-COCO-Dog (29 MB) [ ] 20 > DetectNet-COCO-Bottle (29 MB) [ ] 21 > DetectNet-COCO-Chair (29 MB) [ ] 22 > DetectNet-COCO-Airplane (29 MB) [ ] 23 Semantic Segmentation - all (518 MB) [*] 24 > FCN-ResNet18-Cityscapes-512x256 (47 MB) [*] 25 > FCN-ResNet18-Cityscapes-1024x512 (47 MB) [ ] 26 > FCN-ResNet18-Cityscapes-2048x1024 (47 MB) [*] 27 > FCN-ResNet18-DeepScene-576x320 (47 MB) [ ] 28 > FCN-ResNet18-DeepScene-864x480 (47 MB) [*] 29 > FCN-ResNet18-MHP-512x320 (47 MB) [ ] 30 > FCN-ResNet18-MHP-512x320 (47 MB) [*] 31 > FCN-ResNet18-Pascal-VOC-320x320 (47 MB) [ ] 32 > FCN-ResNet18-Pascal-VOC-512x320 (47 MB) [*] 33 > FCN-ResNet18-SUN-RGBD-512x400 (47 MB) [ ] 34 > FCN-ResNet18-SUN-RGBD-640x512 (47 MB) [ ] 35 Semantic SEgmentation -legacy (1.4 GB) [ ] 36 > FCB-Alexnet-Cityscapes-SD (235 MB) [ ] 37 > FCB-Alexnet-Cityscapes-HD (235 MB) [ ] 38 > FCB-Alexnet-Aerial-FPV (7 MB) [ ] 39 > FCB-Alexnet-Pascal-VOC (235 MB) [ ] 40 > FCB-Alexnet-Synthia-CVPR (235 MB) [ ] 41 > FCB-Alexnet-Synthia-Summer-SD (235 MB) [ ] 42 > FCB-Alexnet-Synthia-Summer-HD (235 MB) [ ] 43 Image Processing - all models (138 MB) [ ] 44 > Deep-Homography-COCO (137 MB) [ ] 45 > Super-Resolution-BSD500 (1MB MB) → 了解
↓ PyTorchはスキップしても良いかも?
[ ] 1 PyTorch v1.1.0 for Python 2.7 [ ] 2 PyTorch v1.1.0 for Pythin 3.6 → 了解
↓ ビルド&インストール&ライブラリ登録
make sudo make install sudo ldconfig
動作確認
1回目(初回はいろいろ準備するものがあるようで時間がかかる)
cd $HOME/jetson-inference/build/aarch64/bin/ ./detectnet-console.py images/peds_0.jpg output_0.jpg
結果 ↓
2回目
./detectnet-console.py images/peds_1.jpg output_1.jpg
結果 ↓
参考
www.youtube.com jetson-inference/building-repo-2.md at master · dusty-nv/jetson-inference · GitHub
補足
# ダウンロードツール起動コマンド cd jetson-inference/tools ./download-models.sh # PyTorchのインストーラー起動コマンド cd jetson-inference/build ./install-pytorch.sh # 自前マシンへコピー scp jetson@jetson-desktop.local:/home/jetson/jetson-inference/build/aarch64/bin/images/peds_0.jpg $HOME/work/peds_0.jpg scp jetson@jetson-desktop.local:/home/jetson/jetson-inference/build/aarch64/bin/output_0.jpg $HOME/work/output_0.jpg scp jetson@jetson-desktop.local:/home/jetson/jetson-inference/build/aarch64/bin/images/peds_1.jpg $HOME/work/peds_1.jpg scp jetson@jetson-desktop.local:/home/jetson/jetson-inference/build/aarch64/bin/output_1.jpg $HOME/work/output_1.jpg
jetson nanoにusbのwifiを接続1
今回使用したもの
TP-Link WiFi 無線LAN 子機 AC600 433Mbps + 200Mbps Windows/Mac OS 対応 ナノ設計 デュアルバンド 3年保証 Archer T2U Nano
- 発売日: 2019/02/14
- メディア: Personal Computers
接続しても動かない
なんかドライバが認識されてないっぽい
ドライバとかインストール方法を調査
かんたんにいうと以下で対応できた。
sudo apt-get install dkms git clone -b v5.6.4.2 https://github.com/aircrack-ng/rtl8812au.git cd rtl8812au/ sudo ./dkms-install.sh
※ただ、usbを接続していた場合は一度抜き差ししないと認識してくれないので注意
OK
参考情報
GitHub - aircrack-ng/rtl8812au: RTL8812AU/21AU and RTL8814AU driver with monitor mode and frame injection tp-link Archer T2U Nano AC600をLinuxで使う方法 - Shizuka's Style (Tre)
jetson nanoにvncインストール
vncサーバインストール
$ sudo apt install tigervnc-common tigervnc-standalone-server tigervnc-scraping-server
vncサーバのパスワード設定
$ vncpasswd Password: Verify: Would you like to enter a view-only password (y/n)? n $
環境変数DISPLAY確認
$ env | grep DISPLAY DIPLAY=:1
※実際にjetsonの端末より実行、SSH接続の場合はうまく動作しない可能性あり
起動確認
$ x0vncserver -display :0 -passwordfile ~/.vnc/passwd Sun Jun 14 09:53:11 2020 Geometry: Desktop geometry is set to 1920x1080+0+0 Main: XTest extension present - version 2.2 Main: Listening on port 5900
接続
・finderより接続
・vncで設定したパスワードでログイン
・かくにん
自動起動
$ vi /etc/systemd/system/x0vncserver.service --- [Unit] Description=Remote desktop service (VNC) After=syslog.target After=network.target remote-fs.target nss-lookup.target After=x11-common.service [Service] Type=forking User=jetson Group=jetson WorkingDirectory=/home/jetson ExecStart=/bin/sh -c 'sleep 10 && /usr/bin/x0vncserver -display :1 -rfbport 5900 -passwordfile /home/jetson/.vnc/passwd &' [Install] WantedBy=multi-user.target ---
systemctlで起動
sudo systemctl enable x0vncserver.service sudo systemctl start x0vncserver.service
再起動
sudo reboot
所感
GUI画面でログインしておかないと
VNCサーバが起動しないよー( ;∀;)
あまり時間を当てられないのでここまでとする
2020/06/19追記 自動ログインを設定することで対応できました。(^o^)
jetson nanoセットアップ
jetson nanoセットアップ
・ jetson nano www.amazon.co.jp ・SDCard www.amazon.co.jp
ダウンロード&SDカード書き込み
ダウンロード
https://developer.nvidia.com/jetson-nano-sd-card-image
書き込みツールを使用してSDカード(micro)へ書き込み
balenaEtcher - Flash OS images to SD cards & USB drives
起動
配線
起動
※「A start job is running for End-user configuration after initial OEM installation・・・・・」と表示された場合は一度、電源を切って再起動する
セットアップ
利用規約
言語
キーボード設定
ロケール設定
ユーザー設定
パーティション
なんかいろいろあって完了
apt update
$ sudo apt-get update $ sudo apt-get upgrade
swap領域確認
$ free -h total used free shared buff/cache available Mem: 3.9G 1.6G 798M 46M 1.5G 2.1G Swap: 1.9G 0B 1.9G $
swap領域作成
$ git clone https://github.com/JetsonHacksNano/installSwapfile $ cd installSwapfile $ vi ./installSwapfile.sh ---- SWAPSIZE=4 ---- $ ./installSwapfile.sh
参考 * https://qiita.com/karaage0703/items/b14c249aa33112669ee4
メモリ確認
$ free -h total used free shared buff/cache available Mem: 3.9G 1.6G 399M 46M 1.8G 2.0G Swap: 7.9G 1.7M 7.9G $
日本語入力対応
sudo apt-get install fonts-ipafont fonts-ipaexfon sudo apt-get install fcitx-mozc sudo reboot
再起動
$ sudo reboot
日本語入力がうまく動かない( ;∀;) とりあえずここまで 次はデモやってみる