# Jetson AGX Xavier
## 1. Installing Ubuntu 18.04 on Jetson AGX
Refs:
[youtube](https://www.youtube.com/watch?v=drBKVbOmPEk)
[jetson hack github](https://github.com/jetsonhacks/bootFromExternalStorage)
## 2. Installation Notes
- 32gb internal emmc disk is accidentally formatted without any backup, sorry for this huge blunder,
but Ubuntu 18.04 can be booted up directly via ssd 500gb
- Jetpack is installed via apt
- opencv4 has been installed, even contrib is installed
- ros version is melodic, cv_bridge with 20.04 might hard to work with I guess
- git is set up to ical account, which is tested that can push project on ical gitlab
- user.name: ical
- user.email:nukical@gmail.com
- ssh-key comment: ical_xavier_agx_sylvex (i have no idea how to name this so...)
## 3. Tasks
1. yolo testing
- dataset
http://140.127.205.183:5000/sharing/OE4Umn0kv
cuda cudnn, gpu is configured true in darknet config
.bashrc is configured for cuda and cudnn
- training

With Default Desktop Power Settings
Pic_num=8, max_batch=1500, classes=3
start from: 22:38 to the next day 00:14
time_elapsed: 1hr36mins
- recognising
one of prediction -1.397 secs

```./darknet detector test ../yolo_mark/train.data ../yolo_mark/yolov3-tiny-train.cfg ../yolo_mark/shape/model/yolov3-tiny-train_last.weights ../yolo_mark/shape/img/4.JPG ```
LOG:
```
CUDA-version: 10020 (10020), cuDNN: 8.2.1, CUDNN_HALF=1, GPU count: 1
CUDNN_HALF=1
OpenCV version: 4.1.1
0 : compute_capability = 720, cudnn_half = 1, GPU: Xavier
net.optimized_memory = 0
mini_batch = 1, batch = 32, time_steps = 1, train = 0
layer filters size/strd(dil) input output
0 Create CUDA-stream - 0
Create cudnn-handle 0
conv 16 3 x 3/ 1 640 x 480 x 3 -> 640 x 480 x 16 0.265 BF
1 max 2x 2/ 2 640 x 480 x 16 -> 320 x 240 x 16 0.005 BF
2 conv 32 3 x 3/ 1 320 x 240 x 16 -> 320 x 240 x 32 0.708 BF
3 max 2x 2/ 2 320 x 240 x 32 -> 160 x 120 x 32 0.002 BF
4 conv 64 3 x 3/ 1 160 x 120 x 32 -> 160 x 120 x 64 0.708 BF
5 max 2x 2/ 2 160 x 120 x 64 -> 80 x 60 x 64 0.001 BF
6 conv 128 3 x 3/ 1 80 x 60 x 64 -> 80 x 60 x 128 0.708 BF
7 max 2x 2/ 2 80 x 60 x 128 -> 40 x 30 x 128 0.001 BF
8 conv 256 3 x 3/ 1 40 x 30 x 128 -> 40 x 30 x 256 0.708 BF
9 max 2x 2/ 2 40 x 30 x 256 -> 20 x 15 x 256 0.000 BF
10 conv 512 3 x 3/ 1 20 x 15 x 256 -> 20 x 15 x 512 0.708 BF
11 max 2x 2/ 1 20 x 15 x 512 -> 20 x 15 x 512 0.001 BF
12 conv 1024 3 x 3/ 1 20 x 15 x 512 -> 20 x 15 x1024 2.831 BF
13 conv 256 1 x 1/ 1 20 x 15 x1024 -> 20 x 15 x 256 0.157 BF
14 conv 512 3 x 3/ 1 20 x 15 x 256 -> 20 x 15 x 512 0.708 BF
15 conv 24 1 x 1/ 1 20 x 15 x 512 -> 20 x 15 x 24 0.007 BF
16 yolo
[yolo] params: iou loss: mse (2), iou_norm: 0.75, obj_norm: 1.00, cls_norm: 1.00, delta_norm: 1.00, scale_x_y: 1.00
17 route 13 -> 20 x 15 x 256
18 conv 128 1 x 1/ 1 20 x 15 x 256 -> 20 x 15 x 128 0.020 BF
19 upsample 2x 20 x 15 x 128 -> 40 x 30 x 128
20 route 19 8 -> 40 x 30 x 384
21 conv 256 3 x 3/ 1 40 x 30 x 384 -> 40 x 30 x 256 2.123 BF
22 conv 24 1 x 1/ 1 40 x 30 x 256 -> 40 x 30 x 24 0.015 BF
23 yolo
[yolo] params: iou loss: mse (2), iou_norm: 0.75, obj_norm: 1.00, cls_norm: 1.00, delta_norm: 1.00, scale_x_y: 1.00
Total BFLOPS 9.676
avg_outputs = 577400
Allocate additional workspace_size = 52.44 MB
Loading weights from ../yolo_mark/shape/model/yolov3-tiny-train_last.weights...
seen 64, trained: 48 K-images (0 Kilo-batches_64)
Done! Loaded 24 layers from weights-file
Detection layer: 16 - type = 28
Detection layer: 23 - type = 28
../yolo_mark/shape/img/4.JPG: Predicted in 1397.593000 milli-seconds.
```
benchmark
video:
```./darknet detector demo cfg/coco.data yolov4-tiny.cfg yolov4-tiny.weights test.mp4 -ext_output -c 0 -mjpeg_port 8090 -dont_show```
- using yolov4-tiny model
- Video stream: 1280 x 720
- FPS:128.1 AVG_FPS:123.7