A component mounting machine that is configured to hold a component and mount the component on a board, the machine comprising: a head having a holding member configured to hold the component from an upper surface side; a moving device configured to move the head; an imaging device configured to image the component held by the holding member from a direction perpendicular to a bottom surface; and a control device configured to control the head and the moving device so that the component held by the holding member is mounted on the board after performing image processing for processing a captured image of the component imaged by the imaging device, wherein when mounting a component having a main body and multiple leads protruding laterally from a side surface of the main body, the control device measures each of lengths of images of the multiple leads extracted from the captured image, and performs a first determination of abnormality in which it is determined as abnormal in a case where at least one of the measured lengths of the images of the leads is not within an allowable range, wherein the component mounting machine further comprises: an optical sensor having a light projecting section and a light receiving section disposed so as to face each other with a predetermined space there between, wherein the control device is configured to control the moving device so that the component held by the holding member moves to a detection position where light is projected from the light projecting section toward tip end portions of the multiple leads with an optical axis parallel to an arrangement direction of the multiple leads, measures a thickness of the multiple leads in a side view based on a state where the light is received by the light receiving section, and performs a second determination of abnormality in which it is determined as abnormal in a case where the measured thickness is not within an allowable range,, wherein the control device is configured to perform the second determination of abnormality in a case where it is not determined as abnormal in the first determination of abnormality. a head having a holding member configured to hold the component from an upper surface side; a moving device configured to move the head; an imaging device configured to image the component held by the holding member from a direction perpendicular to a bottom surface; and a control device configured to control the head and the moving device so that the component held by the holding member is mounted on the board after performing image processing for processing a captured image of the component imaged by the imaging device, wherein when mounting a component having a main body and multiple leads protruding laterally from a side surface of the main body, the control device measures each of lengths of images of the multiple leads extracted from the captured image, and performs a first determination of abnormality in which it is determined as abnormal in a case where at least one of the measured lengths of the images of the leads is not within an allowable range, wherein the component mounting machine further comprises: an optical sensor having a light projecting section and a light receiving section disposed so as to face each other with a predetermined space there between, wherein the control device is configured to control the moving device so that the component held by the holding member moves to a detection position where light is projected from the light projecting section toward tip end portions of the multiple leads with an optical axis parallel to an arrangement direction of the multiple leads, measures a thickness of the multiple leads in a side view based on a state where the light is received by the light receiving section, and performs a second determination of abnormality in which it is determined as abnormal in a case where the measured thickness is not within an allowable range,, wherein the control device is configured to perform the second determination of abnormality in a case where it is not determined as abnormal in the first determination of abnormality. an optical sensor having a light projecting section and a light receiving section disposed so as to face each other with a predetermined space there between, wherein the control device is configured to control the moving device so that the component held by the holding member moves to a detection position where light is projected from the light projecting section toward tip end portions of the multiple leads with an optical axis parallel to an arrangement direction of the multiple leads, measures a thickness of the multiple leads in a side view based on a state where the light is received by the light receiving section, and performs a second determination of abnormality in which it is determined as abnormal in a case where the measured thickness is not within an allowable range,, wherein the control device is configured to perform the second determination of abnormality in a case where it is not determined as abnormal in the first determination of abnormality.