Facial emotion recognition (FER) is a dominant research area that captures the biological facial features and matches the facial data with existing databases to analyze the individual’s emotional state. Numerous techniques have been formulated for attaining effective FER. However, the occlusions, different head positions, deformed faces, motion blur under unrestricted settings, and complicated backgrounds make it complex to analyze the facial images. In this paper, the formicary swarm optimization-based deep convolutional neural network (FSO-opt DCNN) model is utilized for facial emotion detection for which JAFFE and the RAVDESS facial expression datasets are used. DCNNs are proficient with built-in feature extraction strategies from images to map the various facial expressions to the corresponding emotional states adopted for effective FER. In addition, the intensity, directional, and edge patterns as well as the correlation features extracted utilizing the hybrid textual pattern, RESNET 101 and VGG 16-based correlation modules assist the DCNN to attain the informative feature from the high-resolution images. Further, the formicary swarm optimization (FSO) is incorporated that effectively tunes the DCNN to capture the complex relationships between the learned features that excel the FER capability. Evaluating the metrics, the face recognition model using the RAVDESS dataset achieves notable efficiencies during a training percentage (TP) of 90%, with values of 97.51%, 95.48%, 99.55%, 95.48%, 97.48%, 96.47%, and a minimum loss of 2.49%. Simultaneously, the emotion detection model demonstrates robust efficiencies with metric values of 96.75%, 98.49%, 95.01%, 98.49%, 96.72%, 97.59%, and a minimum loss of 3.25%. Finally, the obtained results reveal the efficacy of the FSO-opt DCNN, particularly in face recognition tasks, as it outperforms the existing models across various datasets, showcasing its versatility and potential in facial analysis applications.