Skip to content

Instantly share code, notes, and snippets.

View tikurahul's full-sized avatar
:shipit:
Tinkering

Rahul Ravikumar tikurahul

:shipit:
Tinkering
View GitHub Profile
@tikurahul
tikurahul / custom_ops_ml.py
Created January 17, 2021 02:58
Depth AI Custom Layer
from pathlib import Path
import cv2
import numpy as np
import depthai as dai
if __name__ == "__main__":
model_path = Path(__file__).parent / 'custom_ops/out'
pipeline = dai.Pipeline()
import numpy as np
from fastai2.vision.all import *
from fastai2.distributed import *
def train():
path = untar_data(URLs.CAMVID_TINY)
def label_func(fn):
return path/"labels"/f"{fn.stem}_P{fn.suffix}"
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@tikurahul
tikurahul / train.py
Created March 7, 2020 02:14
Multi-tub training
#!/usr/bin/env python3
'''
Scripts to train a keras model using tensorflow.
Basic usage should feel familiar: python train_v2.py --model models/mypilot
Usage:
train.py [--tubs=tub1,tub2] (--model=<model>) [--type=(linear|inferred|tensorrt_linear|tflite_linear)]
Options:
-h --help Show this screen.
@tikurahul
tikurahul / standard-config.py
Last active March 7, 2020 08:43
Standard Donkeycar Config
#VEHICLE
DRIVE_LOOP_HZ = 50 # the vehicle loop will pause if faster than this speed.
MAX_LOOPS = None # the vehicle loop can abort after this many iterations, when given a positive integer.
# #CAMERA
CAMERA_TYPE = "LEOPARD" # (PICAM|WEBCAM|CVCAM|CSIC|V4L|MOCK|LEOPARD)
IMAGE_W = 224
IMAGE_H = 224
IMAGE_DEPTH = 3 # default RGB=3, make 1 for mono
CAMERA_FRAMERATE = DRIVE_LOOP_HZ
@tikurahul
tikurahul / jetracer-config.py
Last active December 26, 2019 23:58
Jetracer Calibrated Values
#VEHICLE
DRIVE_LOOP_HZ = 50
#CAMERA
CAMERA_TYPE = "LEOPARD"
IMAGE_W = 224
IMAGE_H = 224
IMAGE_DEPTH = 3
CAMERA_FRAMERATE = DRIVE_LOOP_HZ
CAMERA_VFLIP = False
@tikurahul
tikurahul / Matplotlib.md
Created September 21, 2019 05:43
Install the right Matplotlib backend

Install the Backend

sudo apt-get install tk-dev python-tk python3-tk

Install Matplotlib

pip install matplotlib
@tikurahul
tikurahul / Notes.md
Created August 8, 2019 20:02
OpenCV 4.1 with CUDA

Installation Notes

Make sure you set -D BUILD_opencv_cudacodec=OFF.

cmake -D CMAKE_BUILD_TYPE=RELEASE \
	-D WITH_CUDA=ON \
	-D CUDA_ARCH_PTX="" \
        -D BUILD_opencv_cudacodec=OFF \ # 
	-D CMAKE_INSTALL_PREFIX=/usr/local \
@tikurahul
tikurahul / OpenCV.md
Last active July 22, 2021 03:04
OpenCV 4.1 + Tensorflow on Jetson Nano

Step 1: Setup CUDA on Jetson Nano

  • Setup some environment variables so nvcc is on $PATH. Add the following lines to your ~/.bashrc file.
# Add this to your .bashrc file
export CUDA_HOME=/usr/local/cuda
# Adds the CUDA compiler to the PATH
export PATH=$CUDA_HOME/bin:$PATH
# Adds the libraries
@tikurahul
tikurahul / bashrc
Last active June 4, 2021 08:26
Jetson Nano .bashrc
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac
# don't put duplicate lines or lines starting with space in the history.
# See bash(1) for more options
HISTCONTROL=ignoreboth