I have used Convolution Nueral Network (CNN) in this project which is a type of artificial neural network used in image recognition and processing that is specifically designed to process pixel data.
Upload image sample from Andesite / Basalt / Diorite / Obsidian to see the Result below. As it is trained on CNN without using any threshold values, it will show wrong result with untrained class samples.