Files
sunnypilot/selfdrive/modeld/visiontest.mk
HaraldSchafer 008f37c749 Torch model (#2452)
* refactor draw model

* rebase master

* correct valid_len

* rename function

* rename variables

* white space

* rebase to master

* e16c13ac-927d-455e-ae0a-81b482a2c787

* start rewriting

* save proress

* compiles!

* oops

* many fixes

* seems to work

* fix desires

* finally cleaned

* wrong std for ll

* dont pulse none

* compiles!

* ready to test

* WIP does not compile

* compiles

* various fixes

* does something!

* full 3d

* not needed

* draw up to 100m

* fix segfault

* wrong sign

* fix flicker

* add road edges

* finish v2 packet

* Added pytorch supercombo

* fix rebase

* no more keras

* Hacky solution to the NCHW/NHWC incompatibility between SNPE and our frame data

* dont break dmonitoringd, final model 229e3ce1-7259-412b-85e6-cc646d70f1d8/430

* fix hack

* Revert "fix hack"

This reverts commit 5550fc01a7881d065a5eddbbb42dac55ef7ec36c.

* Removed axis permutation hack

* Folded padding layers into conv layers

* Removed the last pad layer from the dlc

* Revert "Removed the last pad layer from the dlc"

This reverts commit b85f24b9e1d04abf64e85901a7ff49e00d82020a.

* Revert "Folded padding layers into conv layers"

This reverts commit b8d1773e4e76dea481acebbfad6a6235fbb58463.

* vision model: 5034ac8b-5703-4a49-948b-11c064d10880/780  temporal model: 229e3ce1-7259-412b-85e6-cc646d70f1d8/430  with permute + pool opt

* fix ui drawing with clips

* ./compile_torch.py 5034ac8b-5703-4a49-948b-11c064d10880/780 dfcd2375-81d8-49df-95bf-1d2d6ad86010/450 with variable history length

* std::clamp

* not sure how this compiled before

* 2895ace6-a296-47ac-86e6-17ea800a74e5/550

* db090195-8810-42de-ab38-bb835d775d87/601

* 5m is very little

* onnx runner

* add onnxruntime to pipfile

* run in real time without using the whole CPU

* bump cereal;

* add stds

* set road edge opacity based on stddev

* don't access the model packet in paint

* convert mat.h to a c++ header file (#2499)

* update tests

* safety first

Co-authored-by: deanlee <deanlee3@gmail.com>
Co-authored-by: mitchell <mitchell@comma.ai>
Co-authored-by: Comma Device <device@comma.ai>
Co-authored-by: George Hotz <george@comma.ai>
Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
old-commit-hash: 08846b5c0e
2020-11-11 20:31:46 -08:00

105 lines
2.6 KiB
Makefile

CC:=clang
CXX:=clang++
OPT_FLAGS:=-O2 -g -ggdb3
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Linux)
SHARED_FLAGS=-Wl,--whole-archive $^ -Wl,--no-whole-archive
endif
ifeq ($(UNAME_S),Darwin)
SHARED_FLAGS=-Wl,-force_load $^
endif
PHONELIBS := ../../phonelibs
BASEDIR := ../..
WARN_FLAGS = -Werror=implicit-function-declaration \
-Werror=incompatible-pointer-types \
-Werror=int-conversion \
-Werror=return-type \
-Werror=format-extra-args
CFLAGS = -std=gnu11 -g -fPIC $(OPT_FLAGS) $(WARN_FLAGS)
CXXFLAGS = -std=c++1z -fPIC $(OPT_FLAGS) $(WARN_FLAGS)
EIGEN_FLAGS = -I$(PHONELIBS)/eigen
CEREAL_LIBS = $(BASEDIR)/cereal/libmessaging.a
OPENCV_LIBS = -lopencv_video -lopencv_core -lopencv_imgproc
ifeq ($(UNAME_S),Darwin)
VT_LDFLAGS += $(PHONELIBS)/capnp-c/mac/lib/libcapnp_c.a \
$(PHONELIBS)/zmq/mac/lib/libzmq.a \
-framework OpenCL
OPENCV_LIBS += -L/usr/local/opt/opencv@2/lib
OPENCV_FLAGS += -I/usr/local/opt/opencv@2/include
else
VT_LDFLAGS += $(CEREAL_LIBS) \
-L/system/vendor/lib64 \
-L$(BASEDIR)/external/zmq/lib/ \
-l:libzmq.a \
-lOpenCL
endif
.PHONY: all visiontest clean test
all: visiontest
libvisiontest_inputs := visiontest.c \
transforms/transform.cc \
transforms/loadyuv.c \
../common/clutil.c \
$(BASEDIR)/selfdrive/common/util.c \
$(CEREAL_OBJS)
visiontest: libvisiontest.so
all-tests := $(addsuffix .test, $(basename $(wildcard test_*)))
%.o: %.cc
@echo "[ CXX ] $@"
$(CXX) $(CXXFLAGS) -MMD \
-I. -I.. -I../.. \
-Wall \
-I$(BASEDIR)/ -I$(BASEDIR)/selfdrive -I$(BASEDIR)/selfdrive/common \
$(EIGEN_FLAGS) \
$(OPENCV_FLAGS) \
$(CEREAL_CXXFLAGS) \
-c -o '$@' '$<'
%.o: %.c
@echo "[ CXX ] $@"
$(CC) $(CFLAGS) -MMD \
-I. -I.. -I../.. \
-Wall \
-I$(BASEDIR)/ -I$(BASEDIR)/selfdrive -I$(BASEDIR)/selfdrive/common \
$(CEREAL_CFLAGS) \
-c -o '$@' '$<'
libvisiontest.so: $(libvisiontest_inputs)
$(eval $@_TMP := $(shell mktemp))
$(CC) -std=gnu11 -shared -fPIC -O2 -g \
-Werror=implicit-function-declaration -Werror=incompatible-pointer-types \
-Werror=int-conversion -Wno-pointer-to-int-cast \
-I. -DCLU_NO_CACHE \
$^ -o $($@_TMP) \
-I$(PHONELIBS)/opencl/include \
-I$(BASEDIR)/selfdrive/common \
$(CEREAL_CXXFLAGS) \
$(CEREAL_CFLAGS) \
-I$(BASEDIR)/external/zmq/include \
-I$(BASEDIR)/ -I$(BASEDIR)/selfdrive \
-lstdc++ \
$(VT_LDFLAGS) \
-lm -lpthread
mv $($@_TMP) $@
test : $(all-tests)
test_%.test : test_%
@./'$<' || echo FAIL
clean:
rm -rf *.o *.so *.a