Aiming at the problems of low mechanization and low accuracy of fresh mushroom classification,this paper proposed a machine vision image recognition method of fresh mushroom based on Bayesian hyperparametric optimization technology.The camera is used to shoot fresh mushroom images,and the sampled images were marked and classified according to the manual classification standard.Five levels of fresh mushroom images were obtained and marked.The obtained data set was expanded by affine transformation and contrast transformation,after which the fresh mushroom image data set of each level was established;Based on the deep convolution neural network,three pre training network models(AlexNet、GoogLeNet、ResNet-18)were transferred and learned respectively,and the three models were recorded as XGu_Ale,XGu_Goo and XGu_Res-18;Bayesian optimization algorithm was used to optimize the super parameters of mushroom data sets of three models,and the test results of each network model were analyzed.The analysis showed that the front image level model of fresh Lentinus edodes was based on Z-XGu_Res-18 model had the highest recognition accuracy for reverse image hierarchy model of fresh Lentinus edodes is based on F-XGu_Res-18 model had the highest recognition accuracy,which was 98.73% and 99.15% ,respectively.The above two models can meet the classification requirements of fresh mushrooms.The weighted combination of the positive and negative recognition results can obtain the final classification of fresh mushrooms.