Hierarchical classification approaches have been shown to be effective for protein function prediction problem. Traditionally, a set of simple classifiers are used for each hierarchical level separately. In this paper, we introduce a deep neural network (DNN) model with multiple heads and multiple ends to realize the whole set of classifiers. The DNN model consists of three parts: the body part, the multi-end part and the multi-head part. The body part is a deep multilayer perceptron (MLP) shared by different classifiers for feature mapping. The multi-end part performs feature fusion transforming the input vectors of different classifiers to feature vectors with the same length so as to share the feature mapping part. The multi-head part is a set of linear multi-label classifiers. By sharing a deep MLP with multiple classifiers, we are able to construct more powerful classifiers for each level with limited training samples, and expecting to have better classification performance. Experiment results on benchmark datasets show that the proposed method significantly outperforms these traditional methods.