Ensemble: disable redundant heavy features in classical pipeline
Browse filesThe previous ensemble commit (9cbefb9) timed out because the classical
sklearn pipeline calls predict_wireframe_tracks via USE_TRACK_ENSEMBLE
and USE_TRACKS_AS_VERTICES — which is the same heavy DLT triangulation
already called by script.py's hybrid_merge. Doubling that step blows
the time budget.
Before calling predict_wireframe_sklearn, monkey-patch its module-level
flags to disable:
- USE_TRACK_ENSEMBLE (duplicate of hybrid_merge)
- USE_TRACKS_AS_VERTICES (duplicate of hybrid_merge)
- USE_WINNER_CANDIDATES (expensive iterative dilation)
- USE_LINE_EDGES (3D line clustering)
What we keep: per-view 2D semantic vertex detection, RANSAC affine
depth fit, 3D unprojection, multi-view merge, sklearn edge classifier.
This is the cheap-but-distinct signal — independent from anything the
learned pipeline produces. Flags are restored after the call.
467 unmodified lines468469470471472473474475476477478479467 unmodified linesprint(f" Track ensemble failed for {order_id}: {track_e_err}")# Pipeline ensemble: also run the classical sklearn pipeline# and union with the learned-pipeline output. Independent# error modes (semantic 2D detection + line cloud + sklearn# edge classifier) complement the learned 3D segment regression.try:from sklearn_submission import predict_wireframe_sklearnskl_v, skl_e = predict_wireframe_sklearn(sample)if isinstance(pred_v, np.ndarray) and len(pred_v) >= 1 and \skl_v is not None and len(skl_v) >= 1:pred_v, pred_e = ensemble_merge(467 unmodified lines468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501467 unmodified linesprint(f" Track ensemble failed for {order_id}: {track_e_err}")# Pipeline ensemble: also run the classical sklearn pipeline# but disable its heaviest features. predict_wireframe_tracks# is already called above by hybrid_merge — calling it again# via USE_TRACK_ENSEMBLE/USE_TRACKS_AS_VERTICES doubles the# slowest step and causes timeout. Winner candidates and line# cloud are also expensive. We keep just the core classical# signal: 2D semantic vertex detection + RANSAC depth fit +# 3D unprojection + sklearn edge classifier.try:import sklearn_submission as _skl_saved_flags = (_skl.USE_TRACK_ENSEMBLE,_skl.USE_TRACKS_AS_VERTICES,_skl.USE_WINNER_CANDIDATES,_skl.USE_LINE_EDGES,)_skl.USE_TRACK_ENSEMBLE = False_skl.USE_TRACKS_AS_VERTICES = False_skl.USE_WINNER_CANDIDATES = False_skl.USE_LINE_EDGES = Falsetry:skl_v, skl_e = _skl.predict_wireframe_sklearn(sample)finally:(_skl.USE_TRACK_ENSEMBLE,_skl.USE_TRACKS_AS_VERTICES,_skl.USE_WINNER_CANDIDATES,_skl.USE_LINE_EDGES,) = _saved_flagsif isinstance(pred_v, np.ndarray) and len(pred_v) >= 1 and \skl_v is not None and len(skl_v) >= 1:pred_v, pred_e = ensemble_merge(