Optimizing Deep Convolutional Neural Network with Ternarized Weights and High Accuracy