The computer plays a significant role in computer vision to help with everyday tasks. Defense, biometrics, visual surveillance, robotics, and driver assistance are just a few of the many uses for object recognition. Lane/railroad track detection, the detection of obstacles before the vehicle/train, is part of the driver assistance system. Driver assistance systems for various modes of transportation can be improved by employing an efficient object-recognition approach (road, rail, etc.). One of the major problems with the driver assistance system is its inability to detect railroad obstacles. There has been an increase in the amount of research and development in obstacle detection for road transportation in the last few years. Despite the fact that railroads are the other primary land transportation mode, much less effort has been put into developing technologies for detecting obstacles on the rails than on the roads. Efforts to improve the recognition performance of safety inferences are ongoing. Real-time object recognition in driving situations despite the rapid development in the field of object recognition on datasets with a tremendous number of different types of objects remains extremely challenging. Autonomous driving systems (ADAS) and advanced driver assistance systems (ADAS) face a number of key difficulties in visual object recognition. Object recognition is complicated by a variety of factors, including changes in lighting conditions, the presence of shadows, and partial occlusion, for example. Changing light conditions are the most common triggers for variation. These critical realities are taken into account in this study, which aims to offer a solution to these problems.