Crossref DOIMemberCiteFactoropen accessissn
SJIF Impact Factor 8.659 | ISSN: 2582-3930
IJSREM Logo

International Journal of Scientific Research in Engineering and Management

(Gateway to Global Scholars - An International, Scholarly, Multi-Disciplinary, Open Access Journal)

Peer-Reviewed Journal Designed to Meet UGC's Quality Parameters

HomeCurrent IssuePast IssuesPay OnlineConferencesEditorial BoardAbout UsContact Us
IJSREM

Loading article...

Follow Us

  • Google Scholar
  • ResearchGate
  • Academia.edu
  • Mendeley
  • LinkedIn
  • Facebook
  • Instagram

Journal Policies

  • Peer Review Policy
  • Publication Ethics
  • Copyright Infringement
  • Refund & Cancellation Policy
  • Terms and Conditions
  • Privacy Policy

Journal Identifiers & Licenses

  • ISSN Verified: 2582-3930ISSN Verified: 2582-3930
  • Crossref DOI: 10.55041Crossref DOI: 10.55041
  • SJIF Ranking: 08.659SJIF Ranking: 08.659
  • Licensed under CC BY 4.0Licensed under CC BY 4.0
  • ISO Certification: 9001:2015ISO Certification: 9001:2015
  • Indexed & Cited In: Google ScholarIndexed & Cited In: Google Scholar

Contact Us

International Journal of Scientific Research in Engineering and Management (IJSREM)

#62/1, New No 7, 1st Cross, 2nd Main, Ganganagar, R T Nagar, Bangalore North, Bangalore, Karnataka, India – 560032
[email protected]+91 93911 67991
logos
logos
Working Hours

Mon – Sat: 9:00 AM – 6:00 PM

Sunday: 10:00 AM – 4:00 PM

+91 93911 67991

© 2026 IJSREM – International Journal of Scientific Research in Engineering and Management. This is an open-access journal. Articles are published under the Creative Commons Attribution (CC BY 4.0) License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.

DisclaimerPrivacy PolicyTerms and Conditions
ArticlePeer ReviewedOpen AccessPlagiarism Passed
Paper ID:IJSREM62973

Real-Time Facial Emotion Detection System Using OpenCV and PyTorch for Intelligent Music Recommendation

Stream/Area:

-

Subject:

-

Paper ID:

IJSREM62973

Volume:

10 |

5 |

May 2026

Pages:

1-21

Publication Frequency:

Monthly (12 issues per year)

DOI
Digital Object Identifier
Not assigned

License:International Journal of Scientific Research in Engineering and Management follows the Creative Commons Attribution 4.0 (CC BY 4.0) License, allowing free use and distribution with proper attribution.

Share this article:

Authors

RS

ROHAN SINGH

Information Technology

Noida Institute of Engineering and Technology,Greater Noida

Download Author Certificate
DPN

Dr. Prabha Nair

Information Technology

Noida Institute of Engineering and Technology,Greater Noida

Download Co-Author Certificate

Author Services & Downloads

Full ArticlesAcceptance Certificate

Abstract

This manuscript presents the design, implementation, and evaluation of a real-time facial emotion detection system that provides dynamically personalized music recommendations based on the continuously detected emotional state of the user. The system addresses a practical gap in the affective computing literature: the limited availability of simple, privacy-conscious, CPU-deployable pipelines that integrate emotion recognition with emotionally informed recommendation without reliance on cloud services or GPU acceleration. The technical approach combines OpenCV-based live video acquisition and Haar Cascade face detection with a custom Convolutional Neural Network (CNN) implemented in PyTorch, trained on the FER-2013 benchmark dataset to classify facial expressions into seven discrete emotion categories: happiness, sadness, anger, fear, disgust, surprise, and neutral. The training regimen incorporates five data augmentation strategies — horizontal flipping, random rotation, affine transformations, random erasing, and Gaussian noise injection — alongside batch normalization, global average pooling, class-weighted cross-entropy loss, and dropout regularization to address dataset imbalance, label noise, and overfitting. The proposed 1.2-million-parameter architecture achieves 68.4% accuracy on the FER-2013 PrivateTest partition while sustaining approximately 23–24 frames per second on a standard Intel Core i5 CPU, demonstrating that real-time emotion recognition can be explored on commodity hardware. Music recommendation is implemented through a psychologically grounded mapping from detected emotions to the valence-arousal space of the Russell Circumplex Model of Affect, with temporal smoothing ensuring perceptually stable recommendation behavior. The paper provides a thorough ablation study, per-class metric analysis, confusion matrix decomposition, latency profiling, and comparative evaluation against ten recently reported methods including recent 2023–2025 approaches. Ethical dimensions including demographic bias, informed consent, and privacy are discussed explicitly. The system's complete local processing ensures user data privacy with no transmission of biometric information to external servers.

KEYWORDS

Index Terms — affective computing convolutional neural network data augmentation FER-2013 facial expression recognition human-computer interaction music recommendation OpenCV PyTorch real-time inference Russell circumplex model transfer learning.

Cite This Article

ROHAN SINGH, Dr. Prabha Nair, "Real-Time Facial Emotion Detection System Using OpenCV and PyTorch for Intelligent Music Recommendation," International Journal of Scientific Research in Engineering and Management, vol. 10, no. 5, pp. 1-21, May 2026.

Full Article/Conclusion

This paper has presented the design, implementation, and comprehensive evaluation of a real-time facial emotion detection system integrated with an emotion-driven music recommendation engine. The work makes a concrete and reproducible contribution to the affective computing literature by demonstrating that accurate, real-time, privacy-preserving emotion recognition is achievable on standard consumer-grade CPU hardware — a practically significant result given the gap between the high computational requirements of recently reported benchmarks and the hardware accessible to most end users. The proposed CNN architecture was observed to achieve 68.4% accuracy on the FER-2013 PrivateTest benchmark with approximately 1.2 million parameters and 42 millisecond end-to-end pipeline latency, corresponding to 23.8 frames per second throughput on an Intel Core i5 CPU without GPU acceleration. These results place the proposed model at the most favorable position in the accuracy-efficiency Pareto frontier among CPU-deployable approaches, showing competitive performance relative to Mini-Xception by 2.4 percentage points while maintaining comparable real-time performance. The ablation study provides rigorous quantitative evidence that data augmentation (5.1% contribution), batch normalization (4.5%), class weighting (3.7%), dropout regularization (2.8%), global average pooling (2.1%), and four-block depth (2.6%) are each independently and meaningfully beneficial, guiding future practitioners in constructing efficient emotion recognition architectures. The mathematical formulations provided throughout the paper — for convolution, batch normalization, global average pooling, weighted cross-entropy loss, Adam optimization, softmax activation, and Russell circumplex distance — offer a complete and self-contained technical specification of the system that can be directly implemented and reproduced. The detailed confusion matrix analysis reveals the specific emotion pair confusions (Fear/Surprise, Sad/Neutral, Angry/Sad) that represent the primary remaining accuracy challenges, with direct implications for the music recommendation experience and for future model improvement strategies. The emotion-driven music recommendation module indicates that the Russell Circumplex Model of Affect provides a psychologically principled, computationally efficient, and interpretable basis for mapping discrete emotion categories to music mood regions in the valence-arousal space. The temporal smoothing mechanism ensures perceptually stable recommendation behavior without sacrificing responsiveness to genuine emotional transitions, and the fully local processing architecture supports user data privacy without requiring modification of the underlying computational approach. Looking ahead, the most impactful improvements to the system would be achieved through replacement of the Haar Cascade face detector with a lightweight neural detector such as BlazeFace, incorporation of temporal modeling to exploit expression dynamics, and introduction of reinforcement learning-based personalization for the music recommendation component. Demographic fairness evaluation and mitigation represent an ethical imperative for any future deployment beyond single-user personal entertainment contexts. In aggregate, this work indicates that the goals of emotional responsiveness, computational efficiency, and user privacy in interactive systems are not mutually exclusive. With careful architectural design and training methodology, real-time affective computing can be brought out of the GPU-equipped laboratory and into everyday devices accessible to all users.

References

[1] R. W. Picard, Affective Computing. Cambridge, MA, USA: MIT Press, 1997. [2] P. Ekman, "Facial expression and emotion," American Psychologist, vol. 48, no. 4, pp. 384–392, 1993. [3] P. Ekman and W. V. Friesen, "Constants across cultures in the face and emotion," J. Personality Social Psychol., vol. 17, no. 2, pp. 124–129, 1971. [4] Y. LeCun, Y. Bengio, and G. Hinton, "Deep learning," Nature, vol. 521, no. 7553, pp. 436–444, 2015. [5] P. N. Juslin and J. A. Sloboda, Eds., Music and Emotion: Theory and Research. Oxford, UK: Oxford University Press, 2001. [6] Y.-H. Yang and H. H. Chen, "Prediction of the distribution of perceived music emotions using discrete samples," IEEE Trans. Audio, Speech, Lang. Process., vol. 19, no. 7, pp. 2184–2196, 2011. [7] Z. Zhang, "Facial expression analysis under partial occlusion: A survey," ACM Comput. Surv., vol. 54, no. 9, pp. 1–36, 2021. [8] F. Ricci, L. Rokach, and B. Shapira, Eds., Recommender Systems Handbook, 2nd ed. New York, NY, USA: Springer, 2015. [9] T. Ojala, M. Pietikainen, and T. Maenpaa, "Multiresolution gray-scale and rotation invariant texture classification with local binary patterns," IEEE Trans. Pattern Anal. Mach. Intell., vol. 24, no. 7, pp. 971–987, 2002. [10] N. Dalal and B. Triggs, "Histograms of oriented gradients for human detection," in Proc. IEEE CVPR, 2005, pp. 886–893.

Editorial & Review Transparency

Publication Date

5/9/2026

Peer Review Type

Double-Blind Peer Review

Review Rounds: 2

Documents

Review Report (Confidential)
Copyright Form (Office)

Article Metrics & Impact

Article Views

1

Total views since publication

PDF Downloads

4

Total downloads since publication

Geographic Reach

5

Indexing, Archiving & Preservation

Google Scholar
Academia
ResearchGate
Crossref
SSRN
Semantic Scholar
Thomson Reuters
WorldCat
Mendeley
OpenAlex
EBSCO
Zenodo

Digital Preservation: This article is permanently archived on Zenodo and complies with all data preservation standards across major indexing platforms.

Ethics, Compliance & Transparency

Plagiarism Screening

This manuscript has been checked for plagiarism using TurnitinPlagiarismChecker software.

Conflict of Interest

The authors declare no conflict of interest related to this research work.

Funding Information

No funding information available for this research.

Similar & Recommended Articles

Similar Articles by Topic

Related research in the same subject area

Loading similar articles...