Internet-of-medical-things is the new means of monitoring patient health remotely. However, the real-time detection of anomalies in the patient data is a challenging task, especially on ECG-data. To ease the same, a novel method, NSGA-II based convolution neural network, is presented in this paper for efficient anomaly detection. In the proposed method, non-dominated sorting genetic algorithm-II is emto obtain optimal hyper-parameters of CNN by evaluating three objective functions namely, accuracy, precision, and recall. Further, the performance validation of the proposed method is conducted on two public datasets and compared against seven state-of-the-art methods. Experimental results affirm that the proposed method outperforms the considered methods with an accuracy of 94.83% and 94.96% on MIT-BIH arrhythmia dataset and INCART dataset, respectively. Therefore, it can be claimed that the proposed method is an efficient alternative for anomaly detection.