The invention discloses a method and a
system for detecting the liquid level of liquid
medicine in a complex scene. The method comprises the following steps of: A, setting a
light source, a
light source illumination direction and an illumination mode; b, setting a camera, a
camera lens and camera internal parameters; c, collecting images of the
medicine bottle based on the steps A and B; d, labeling the liquid level of the liquid
medicine in the collected image of the medicine
bottle through an
image labeling tool, and taking the
labeled data as a
data set; e, performing model training on the
data set through the yolov5 to obtain a detection model; and F, detecting the liquid level of the liquid medicine in the to-be-detected image by using the detection model to obtain a liquid level detection frame of the liquid level of the liquid medicine, and judging whether the liquid medicine in the medicine
bottle in the to-be-detected image is excessive or insufficient and whether the medicine bottle is insufficient according to the liquid level detection frame and the liquid level upper and
lower limit values. The invention provides a method for detecting the liquid level of liquid medicine in a complex scene to solve the problem that a traditional
image processing method cannot adapt to liquid level detection of the liquid medicine in the complex scene.