A visual inspection device comprising: illumination part (112, 113, 114, 115) configured to irradiate illumination light to an inspection object; an imaging part configured to capture an image of the inspection object; a defect detecting part configured to analyze the image of the inspection object captured by the imaging part and configured to detect a defect of the inspection object; an illumination condition setting part configured to set a plurality of different illumination conditions of the illumination light irradiated to the inspection object, wherein the illumination conditions are defined by illumination elements, wherein the illumination elements are color, intensity and direction of the illumination light, wherein the intensity is adjustable to a first number of gradations; and an optimum illumination condition deriving part configured to derive an optimum illumination condition by performing with the optimum illumination condition deriving part, a scoring on each of the illumination conditions that are set by the illumination condition setting part based on the images captured under the illumination conditions that are different, wherein the optimum illumination condition is the most suitable illumination condition for detecting the defect of the inspection object by the defect detecting part, characterized in that: the optimum illumination condition deriving part is configured to derive the optimum illumination condition by performing a first search and a second search, wherein in the first search, a plurality of first search illumination conditions, in which the color is fixed, but intensity is varied by a limited number of gradations among the first number of gradations and direction are varied from all the combinations of the illumination elements is selected and the scoring is performed to acquire a first optimum illumination condition with a best score from the plurality of first search illumination conditions, wherein in the second search a range which actually includes the optimum illumination condition using the first optimum illumination condition obtained in the first search is estimated and the scoring is performed under the illumination condition by varying the intensity in the range to acquire an actual optimum illumination condition. illumination part (112, 113, 114, 115) configured to irradiate illumination light to an inspection object; an imaging part configured to capture an image of the inspection object; a defect detecting part configured to analyze the image of the inspection object captured by the imaging part and configured to detect a defect of the inspection object; an illumination condition setting part configured to set a plurality of different illumination conditions of the illumination light irradiated to the inspection object, wherein the illumination conditions are defined by illumination elements, wherein the illumination elements are color, intensity and direction of the illumination light, wherein the intensity is adjustable to a first number of gradations; and an optimum illumination condition deriving part configured to derive an optimum illumination condition by performing with the optimum illumination condition deriving part, a scoring on each of the illumination conditions that are set by the illumination condition setting part based on the images captured under the illumination conditions that are different, wherein the optimum illumination condition is the most suitable illumination condition for detecting the defect of the inspection object by the defect detecting part, characterized in that: the optimum illumination condition deriving part is configured to derive the optimum illumination condition by performing a first search and a second search, wherein in the first search, a plurality of first search illumination conditions, in which the color is fixed, but intensity is varied by a limited number of gradations among the first number of gradations and direction are varied from all the combinations of the illumination elements is selected and the scoring is performed to acquire a first optimum illumination condition with a best score from the plurality of first search illumination conditions, wherein in the second search a range which actually includes the optimum illumination condition using the first optimum illumination condition obtained in the first search is estimated and the scoring is performed under the illumination condition by varying the intensity in the range to acquire an actual optimum illumination condition. the optimum illumination condition deriving part is configured to derive the optimum illumination condition by performing a first search and a second search, wherein in the first search, a plurality of first search illumination conditions, in which the color is fixed, but intensity is varied by a limited number of gradations among the first number of gradations and direction are varied from all the combinations of the illumination elements is selected and the scoring is performed to acquire a first optimum illumination condition with a best score from the plurality of first search illumination conditions, wherein in the second search a range which actually includes the optimum illumination condition using the first optimum illumination condition obtained in the first search is estimated and the scoring is performed under the illumination condition by varying the intensity in the range to acquire an actual optimum illumination condition.