The invention discloses a garbage can capable of automatic classifying based on visual identification and a classifying method. The garbage can comprises a garbage throwing opening, a first photoelectric switch sensor, an identifying and classifying tray, second photoelectric switch sensors, sub garbage cans, an image identification component, an STM32 controller, a double-path stepping motor driver and a garbage can shell, wherein the garbage throwing opening is formed in the side wall of the garbage can shell; the first photoelectric switch sensor is arranged in the garbage throwing opening;a plurality of sub garbage cans are arranged in the garbage can shell; a second photoelectric switch sensor is mounted in a can opening position of each sub garbage can; the identifying and classifying tray is arranged in the garbage can shell and is located above the sub garbage cans; the identifying and classifying tray comprises a garbage tray, a V-shaped baffle stepping motor, a camera, a V-shaped baffle, a support frame, a rotary baffle stepping motor and a rotary baffle. According to the garbage can, the camera is used for collecting garbage images; a TensorFlow deep learning frameworkis adopted; through transfer training of a model, the accuracy rate of garbage identification is increased.