Skip to content

Commit

Permalink
Revert "Joint Model (commaai#24213)"
Browse files Browse the repository at this point in the history
This reverts commit eff08cb.
  • Loading branch information
adeebshihadeh committed May 13, 2022
1 parent c643d74 commit ef81afc
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 43 deletions.
4 changes: 2 additions & 2 deletions models/supercombo.dlc
Git LFS file not shown
4 changes: 2 additions & 2 deletions models/supercombo.onnx
Git LFS file not shown
29 changes: 12 additions & 17 deletions selfdrive/modeld/models/driving.cc
Original file line number Diff line number Diff line change
Expand Up @@ -228,24 +228,19 @@ void fill_plan(cereal::ModelDataV2::Builder &framed, const ModelOutputPlanPredic

void fill_lane_lines(cereal::ModelDataV2::Builder &framed, const std::array<float, TRAJECTORY_SIZE> &plan_t,
const ModelOutputLaneLines &lanes) {

const auto &left_far = lanes.get_lane_idx(0);
const auto &left_near = lanes.get_lane_idx(1);
const auto &right_near = lanes.get_lane_idx(2);
const auto &right_far = lanes.get_lane_idx(3);
std::array<float, TRAJECTORY_SIZE> left_far_y, left_far_z;
std::array<float, TRAJECTORY_SIZE> left_near_y, left_near_z;
std::array<float, TRAJECTORY_SIZE> right_near_y, right_near_z;
std::array<float, TRAJECTORY_SIZE> right_far_y, right_far_z;
for (int j=0; j<TRAJECTORY_SIZE; j++) {
left_far_y[j] = left_far.mean[j].y;
left_far_z[j] = left_far.mean[j].z;
left_near_y[j] = left_near.mean[j].y;
left_near_z[j] = left_near.mean[j].z;
right_near_y[j] = right_near.mean[j].y;
right_near_z[j] = right_near.mean[j].z;
right_far_y[j] = right_far.mean[j].y;
right_far_z[j] = right_far.mean[j].z;
left_far_y[j] = lanes.mean.left_far[j].y;
left_far_z[j] = lanes.mean.left_far[j].z;
left_near_y[j] = lanes.mean.left_near[j].y;
left_near_z[j] = lanes.mean.left_near[j].z;
right_near_y[j] = lanes.mean.right_near[j].y;
right_near_z[j] = lanes.mean.right_near[j].z;
right_far_y[j] = lanes.mean.right_far[j].y;
right_far_z[j] = lanes.mean.right_far[j].z;
}

auto lane_lines = framed.initLaneLines(4);
Expand All @@ -255,10 +250,10 @@ void fill_lane_lines(cereal::ModelDataV2::Builder &framed, const std::array<floa
fill_xyzt(lane_lines[3], plan_t, X_IDXS_FLOAT, right_far_y, right_far_z);

framed.setLaneLineStds({
exp(left_far.std[0].y),
exp(left_near.std[0].y),
exp(right_near.std[0].y),
exp(right_far.std[0].y),
exp(lanes.std.left_far[0].y),
exp(lanes.std.left_near[0].y),
exp(lanes.std.right_near[0].y),
exp(lanes.std.right_far[0].y),
});

framed.setLaneLineProbs({
Expand Down
32 changes: 11 additions & 21 deletions selfdrive/modeld/models/driving.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ constexpr int META_STRIDE = 7;
constexpr int PLAN_MHP_N = 5;
constexpr int STOP_LINE_MHP_N = 3;

constexpr int LANELINES_MHP_N = 4;

constexpr int LEAD_MHP_N = 2;
constexpr int LEAD_TRAJ_LEN = 6;
constexpr int LEAD_PRED_DIM = 4;
Expand Down Expand Up @@ -79,6 +77,14 @@ struct ModelOutputPlans {
};
static_assert(sizeof(ModelOutputPlans) == sizeof(ModelOutputPlanPrediction)*PLAN_MHP_N);

struct ModelOutputLinesXY {
std::array<ModelOutputYZ, TRAJECTORY_SIZE> left_far;
std::array<ModelOutputYZ, TRAJECTORY_SIZE> left_near;
std::array<ModelOutputYZ, TRAJECTORY_SIZE> right_near;
std::array<ModelOutputYZ, TRAJECTORY_SIZE> right_far;
};
static_assert(sizeof(ModelOutputLinesXY) == sizeof(ModelOutputYZ)*TRAJECTORY_SIZE*4);

struct ModelOutputLineProbVal {
float val_deprecated;
float val;
Expand All @@ -93,28 +99,12 @@ struct ModelOutputLinesProb {
};
static_assert(sizeof(ModelOutputLinesProb) == sizeof(ModelOutputLineProbVal)*4);

struct ModelOutputLaneLinesElement {
std::array<ModelOutputYZ, TRAJECTORY_SIZE> mean;
std::array<ModelOutputYZ, TRAJECTORY_SIZE> std;
std::array<float, LANELINES_MHP_N> prob;
};
static_assert(sizeof(ModelOutputLaneLinesElement) == (sizeof(ModelOutputYZ)*TRAJECTORY_SIZE*2) + sizeof(float)*LANELINES_MHP_N);

struct ModelOutputLaneLines {
std::array<ModelOutputLaneLinesElement, LANELINES_MHP_N> prediction;
ModelOutputLinesXY mean;
ModelOutputLinesXY std;
ModelOutputLinesProb prob;

constexpr const ModelOutputLaneLinesElement &get_lane_idx(int lane_idx) const {
int max_idx = 0;
for (int i = 1; i < prediction.size(); i++) {
if (prediction[i].prob[lane_idx] > prediction[max_idx].prob[lane_idx]) {
max_idx = i;
}
}
return prediction[max_idx];
}
};
static_assert(sizeof(ModelOutputLaneLines) == (sizeof(ModelOutputLaneLinesElement)*LANELINES_MHP_N) + (sizeof(ModelOutputLinesProb)));
static_assert(sizeof(ModelOutputLaneLines) == (sizeof(ModelOutputLinesXY)*2) + sizeof(ModelOutputLinesProb));

struct ModelOutputEdgessXY {
std::array<ModelOutputYZ, TRAJECTORY_SIZE> left;
Expand Down
2 changes: 1 addition & 1 deletion selfdrive/test/process_replay/model_replay_ref_commit
Original file line number Diff line number Diff line change
@@ -1 +1 @@
885bbd4bc01d474795ae81da734be78b75fa4658
5fb5cd71a6e878cf45593ecea22c93e932f70c31

0 comments on commit ef81afc

Please sign in to comment.