mirror of
https://github.com/MoreTore/openpilot.git
synced 2026-09-30 03:13:53 +08:00
008f37c749
* 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
87 lines
2.4 KiB
C++
87 lines
2.4 KiB
C++
#ifndef MODEL_H
|
|
#define MODEL_H
|
|
|
|
// gate this here
|
|
#define TEMPORAL
|
|
#define DESIRE
|
|
#define TRAFFIC_CONVENTION
|
|
|
|
|
|
#include "common/mat.h"
|
|
#include "common/util.h"
|
|
#include "common/modeldata.h"
|
|
|
|
#include "commonmodel.h"
|
|
#include "runners/run.h"
|
|
|
|
#include <memory>
|
|
#include "messaging.hpp"
|
|
|
|
#define MODEL_NAME "supercombo_dlc"
|
|
|
|
#define MODEL_WIDTH 512
|
|
#define MODEL_HEIGHT 256
|
|
#define MODEL_FRAME_SIZE MODEL_WIDTH * MODEL_HEIGHT * 3 / 2
|
|
#define DESIRE_LEN 8
|
|
#define TRAFFIC_CONVENTION_LEN 2
|
|
|
|
#define PLAN_MHP_N 5
|
|
#define PLAN_MHP_COLUMNS 30
|
|
#define PLAN_MHP_VALS 30*33
|
|
#define PLAN_MHP_SELECTION 1
|
|
#define PLAN_MHP_GROUP_SIZE (2*PLAN_MHP_VALS + PLAN_MHP_SELECTION)
|
|
|
|
#define LEAD_MHP_N 5
|
|
#define LEAD_MHP_VALS 4
|
|
#define LEAD_MHP_SELECTION 3
|
|
#define LEAD_MHP_GROUP_SIZE (2*LEAD_MHP_VALS + LEAD_MHP_SELECTION)
|
|
|
|
#define POSE_SIZE 12
|
|
|
|
#define MODEL_FREQ 20
|
|
#define MAX_FRAME_DROP 0.05
|
|
|
|
struct ModelDataRaw {
|
|
float *plan;
|
|
float *lane_lines;
|
|
float *lane_lines_prob;
|
|
float *road_edges;
|
|
float *lead;
|
|
float *lead_prob;
|
|
float *desire_state;
|
|
float *meta;
|
|
float *desire_pred;
|
|
float *pose;
|
|
};
|
|
|
|
|
|
typedef struct ModelState {
|
|
ModelFrame frame;
|
|
float *output;
|
|
float *input_frames;
|
|
RunModel *m;
|
|
#ifdef DESIRE
|
|
std::unique_ptr<float[]> prev_desire;
|
|
std::unique_ptr<float[]> pulse_desire;
|
|
#endif
|
|
#ifdef TRAFFIC_CONVENTION
|
|
std::unique_ptr<float[]> traffic_convention;
|
|
#endif
|
|
} ModelState;
|
|
|
|
void model_init(ModelState* s, cl_device_id device_id,
|
|
cl_context context, int temporal);
|
|
ModelDataRaw model_eval_frame(ModelState* s, cl_command_queue q,
|
|
cl_mem yuv_cl, int width, int height,
|
|
mat3 transform, void* sock, float *desire_in);
|
|
void model_free(ModelState* s);
|
|
void poly_fit(float *in_pts, float *in_stds, float *out);
|
|
|
|
void model_publish(PubMaster &pm, uint32_t vipc_frame_id, uint32_t frame_id,
|
|
uint32_t vipc_dropped_frames, float frame_drop, const ModelDataRaw &data, uint64_t timestamp_eof);
|
|
void model_publish_v2(PubMaster &pm, uint32_t vipc_frame_id, uint32_t frame_id,
|
|
uint32_t vipc_dropped_frames, float frame_drop, const ModelDataRaw &data, uint64_t timestamp_eof);
|
|
void posenet_publish(PubMaster &pm, uint32_t vipc_frame_id, uint32_t frame_id,
|
|
uint32_t vipc_dropped_frames, float frame_drop, const ModelDataRaw &data, uint64_t timestamp_eof);
|
|
#endif
|