In the signal processing domain, there has been growing interest in sparse coding with a trained overcomplete dictionary instead of a predefined one. Sparse coding is advocated as an effective mathematical description for the underlying principle of human sensory systems. Proposed is a framework for online fault detection with applications to oil pipeline leakage detection. The method first performs supervised offline overcomplete dictionary training using the labelled samples. During the online stage, the dictionary is continuously updated in an incremental fashion to adapt to the varied upcoming samples. © 2011 The Institution of Engineering and Technology.