sudo apt-get install tk-dev python-tk python3-tkpip install matplotlib| 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}" |
| #!/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. |
| #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 |
| #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 |
| # 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 |