Skip to content

Instantly share code, notes, and snippets.

Avatar

Rahul Ravikumar tikurahul

View GitHub Profile
@tikurahul
tikurahul / custom_ops_ml.py
Created Jan 17, 2021
Depth AI Custom Layer
View custom_ops_ml.py
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()
View multigpu_segmentation.py
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}"
View flower_classification.ipynb
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 Mar 7, 2020
Multi-tub training
View train.py
#!/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 Mar 7, 2020
Standard Donkeycar Config
View standard-config.py
#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 Dec 26, 2019
Jetracer Calibrated Values
View jetracer-config.py
#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 Sep 21, 2019
Install the right Matplotlib backend
View Matplotlib.md

Install the Backend

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

Install Matplotlib

pip install matplotlib
@tikurahul
tikurahul / Notes.md
Created Aug 8, 2019
OpenCV 4.1 with CUDA
View Notes.md

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 Jul 22, 2021
OpenCV 4.1 + Tensorflow on Jetson Nano
View OpenCV.md

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 Jun 4, 2021
Jetson Nano .bashrc
View 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