Increase speed and accuracy of line following robot

I have a line scan camera and using 2 servo with very high torque. But the problem is, the camera data is not consistence it will give error input and causing the whole programme to be wrong. so, how to increase the accuracy of it? And, the map consist of a ramp, in order to go up the ramp, i need to let the speed to be maximum. And, with that I used a 6-axis gyro sensor to sense weather it is up the hill, but then the data is inconsistence. So, how to overcome those problem? Thanks.

Please post your full sketch. If possible you should always post code directly in the forum thread as text using code tags (</> button on the toolbar). This will make it easy for anyone to look at it, which will increase the likelihood of you getting help. If the sketch is longer than the forum will allow then it’s ok to add it as an attachment.

When your code requires a library that’s not included with the Arduino IDE please always post a link(using the chain link icon on the toolbar to make it clickable) to where you downloaded that library from or if you installed it using Library Manger(Sketch > Include Library > Manage Libraries) then say so and state the full name of the library.