Manual diagnosis of corn leaf diseases from digital images is time-consuming and prone to misinterpretation, creating the need for reliable automated classification. Although deep neural networks (DNNs) have shown promising performance, previous studies have mainly compared model architectures without comprehensively evaluating the combined effects of architecture, optimizer, learning rate, train-test split, and data augmentation on model generalization. This study addresses this gap by evaluating ResNet50 and DenseNet169 using five optimizers, five learning rates, two train-test split schemes (80:20 and 90:10), and data augmentation across 200 experimental scenarios. The dataset consists of 5,000 corn leaf images equally distributed into four classes and complemented with field images for external validation. ResNet50 with the RMSprop optimizer, a learning rate of 0.001, a 90:10 split, and data augmentation achieved the best performance, reaching 99.21% accuracy, 98.39% validation accuracy, and 0.0845 validation loss. This configuration performed better because ResNet50's residual connections improved feature learning, while RMSprop provided stable adaptive optimization during training. However, field testing produced substantially lower accuracy than laboratory experiments, indicating limited generalization due to variations in illumination, background, and image quality. These findings demonstrate that hyperparameter optimization and data augmentation improve laboratory performance, but enhancing robustness under real-world conditions remains a major challenge. The best model was implemented in a Flask-based web application for early corn leaf disease detection.