# A Cascaded Ensemble of Sparse-and-Dense Dictionaries for Vehicle Detection
## 3 Training of CESDD  
The essence of CESDD training is to learn the ensemble of descriptive sparse-and-dense dictionaries, upon which downstream AdaBoost classifier is learned for reinforced vehicle/background classification, from a set of training samples which should be properly processed into features fit for detection. A workflow of training of CESDD is illustrated in Figure 1a, and a complete algorithm description is summarized in Algorithm 1. \begin{table}
\begin{tabular}{l l l} \hline
**Methodology** & **Strengths** & **Weaknesses** \\ \hline deep-learning-based & powerful feature learning and & training data intensive; train- \\  & end-to-end training & \\ \hline non-deep-learning & require less training time and & limited learning ability \\  & training data & \\ \hline our CESDD & require less training time and & computation intensive at inference \\  & learning ability & \\ \hline \end{tabular}
\end{table} 
Table 1: Comparison of deep-learning-based, non-deep-learning vehicle detection approaches and our CESDD approach. ```
input : Training samples \(\mathcal{VEH}\cup\mathcal{BKG}\) (vehicle and background image samples) of unified size, vehicle subcategory number \(N_{\text{VEH}}\) and background subcategory number \(N_{\text{BKG}}\) output : Trained vehicle detector (learned SDD ensemble and learned downstream Adaboost classifier) // Sample grouping
1 Group all vehicle samples into \(N_{\text{VEH}}\) subcategories as \(\mathcal{VEH}=\cup_{i=1}^{N_{\text{VEH}}}\mathcal{VEH}_{i}\) according to their orientations and occlusion levels;
2 Group all background samples into \(N_{\text{BKG}}\) subcategories as \(\mathcal{BKG}=\cup_{i=1}^{N_{\text{BKG}}}\mathcal{BKG}_{i}\) using K-means clustering; // Feature extraction Extract concatenated F-HOG, CS-LBP, Color Names features for each training sample; // SDD ensemble learning
3 Obtain subcategory-specific dictionary pairs \(\{(\mathbf{A}_{i}^{\text{veh}},\mathbf{B}_{i}^{\text{veh}})\}_{i=1}^{N_{\text{ VEH}}},\{(\mathbf{A}_{i}^{\text{bigg}},\mathbf{B}_{i}^{\text{bigg}})\}_{i=1}^{N_{ \text{VEH}}}\) by solving (2) using Algorithm A1;
4 Code over SDD ensemble for all training samples to obtain reconstruction residues from all SDDs as \(\{\mathbf{R}_{i}^{\text{veh}}\}_{i=1}^{N_{\text{VEH}}}\) and \(\{\mathbf{R}_{i}^{\text{bigg}}\}_{i=1}^{N_{\text{BKG}}}\); // Learning downstream Adaboost classifier (ensemble of weak classifiers \(W\text{C}\text{s}_{1},W\text{C}\text{s}_{2},W\text{C}\text{s}_{3}\))
5 Organize SDD ensemble into two levels: Level 1 (vehicle: FV and PO / background: GB), and Level 2 (vehicle: LO / background: VP);
6 Combine reconstruction residues produced by SDDs of FV and PO vehicle with the ones from GB background into \(N_{\text{FV \& PO}}\times N_{\text{GB}}\) combinations as weak classifiers' training samples, and perform AdaBoost learning to learn corresponding \(N_{\text{FV \& PO}}\times N_{\text{GB}}\) weak classifiers as \(W\text{C}\text{s}_{1}\);
7 For training samples predicted by Level 1 as positives, combine reconstruction residues produced by SDDs of FV and PO vehicle with the ones from VP background into \(N_{\text{FV \& PO}}\times N_{\text{VP}}\) combinations as weak classifiers' training samples, and perform AdaBoost learning to learn corresponding \(N_{\text{CB}}\times N_{\text{LO}}\) weak classifiers as \(W\text{C}\text{s}_{3}\) for Level 2;
8 For training samples predicted by Level 1 as negatives, combine reconstruction residues produced by SDDs of GB background with the ones from LO vehicle into \(N_{\text{CB}}\times N_{\text{LO}}\) combinations as weak classifiers' training samples, and perform AdaBoost learning to learn corresponding \(N_{\text{CB}}\times N_{\text{LO}}\) weak classifiers as \(W\text{C}\text{s}_{3}\) for Level 2;
```  
**Algorithm 1**Algorithm for training CESDD  
Specifically, CESDD training learns a two-level cascade of dictionary ensembles.