mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-02-22 19:23:57 +08:00
* 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
86 lines
1.6 KiB
C
86 lines
1.6 KiB
C
#pragma once
|
|
|
|
typedef struct vec3 {
|
|
float v[3];
|
|
} vec3;
|
|
|
|
typedef struct vec4 {
|
|
float v[4];
|
|
} vec4;
|
|
|
|
typedef struct mat3 {
|
|
float v[3*3];
|
|
} mat3;
|
|
|
|
typedef struct mat4 {
|
|
float v[4*4];
|
|
} mat4;
|
|
|
|
static inline mat3 matmul3(const mat3 &a, const mat3 &b) {
|
|
mat3 ret = {{0.0}};
|
|
for (int r=0; r<3; r++) {
|
|
for (int c=0; c<3; c++) {
|
|
float v = 0.0;
|
|
for (int k=0; k<3; k++) {
|
|
v += a.v[r*3+k] * b.v[k*3+c];
|
|
}
|
|
ret.v[r*3+c] = v;
|
|
}
|
|
}
|
|
return ret;
|
|
}
|
|
|
|
static inline vec3 matvecmul3(const mat3 &a, const vec3 &b) {
|
|
vec3 ret = {{0.0}};
|
|
for (int r=0; r<3; r++) {
|
|
for (int c=0; c<3; c++) {
|
|
ret.v[r] += a.v[r*3+c] * b.v[c];
|
|
}
|
|
}
|
|
return ret;
|
|
}
|
|
|
|
static inline mat4 matmul(const mat4 &a, const mat4 &b) {
|
|
mat4 ret = {{0.0}};
|
|
for (int r=0; r<4; r++) {
|
|
for (int c=0; c<4; c++) {
|
|
float v = 0.0;
|
|
for (int k=0; k<4; k++) {
|
|
v += a.v[r*4+k] * b.v[k*4+c];
|
|
}
|
|
ret.v[r*4+c] = v;
|
|
}
|
|
}
|
|
return ret;
|
|
}
|
|
|
|
static inline vec4 matvecmul(const mat4 &a, const vec4 &b) {
|
|
vec4 ret = {{0.0}};
|
|
for (int r=0; r<4; r++) {
|
|
for (int c=0; c<4; c++) {
|
|
ret.v[r] += a.v[r*4+c] * b.v[c];
|
|
}
|
|
}
|
|
return ret;
|
|
}
|
|
|
|
// scales the input and output space of a transformation matrix
|
|
// that assumes pixel-center origin.
|
|
static inline mat3 transform_scale_buffer(const mat3 &in, float s) {
|
|
// in_pt = ( transform(out_pt/s + 0.5) - 0.5) * s
|
|
|
|
mat3 transform_out = {{
|
|
1.0f/s, 0.0f, 0.5f,
|
|
0.0f, 1.0f/s, 0.5f,
|
|
0.0f, 0.0f, 1.0f,
|
|
}};
|
|
|
|
mat3 transform_in = {{
|
|
s, 0.0f, -0.5f*s,
|
|
0.0f, s, -0.5f*s,
|
|
0.0f, 0.0f, 1.0f,
|
|
}};
|
|
|
|
return matmul3(transform_in, matmul3(in, transform_out));
|
|
}
|