In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
How to use python to identify the fruit in the picture, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain in detail, people with this need can come to learn, I hope you can gain something.
Machine learning is that computer vision has become a craze, but it is very difficult to enter this field, because it requires a very solid mathematical background and the professional knowledge it requires, even if you graduate from a university, it is almost difficult to meet. But in the world of python, there are always people who try to reduce the difficulty of extremely professional things to the extent that ordinary people can try. Detecto is such an open source library that we can write an object detection program to identify fruit from a picture with just a few lines of code. The following picture is the one to be identified in this article.
Install detecto
Pip3 install detecto
Save the above picture as fruit.jpg, and then use a few simple lines of code to identify the fruit in the picture.
Import ssl
Ssl._create_default_https_context = ssl._create_unverified_context
From detecto import core, utils, visualize
Image = utils.read_image ('/ Users/kwsy/Desktop/fruit.jpg')
Model = core.Model ()
Labels, boxes, scores = model.predict_top (image)
Visualize.show_labeled_image (image, boxes, labels)
When the program is executed, it downloads a model file whose address is the connection of https, so you need to introduce the ssl module and make the necessary settings to avoid download failure. The subsequent code reads the picture file, loads the model and predicts the fruit in the picture. The predicted results are as follows
The prediction results are accurate. In addition to identifying fruits, animals, cars and kitchen utensils can also be detected. After experiments, if the objects in the picture are crowded, the recognition effect will be worse. In the following picture, the tusks of elephants are recognized as bananas.
The loaded model can recognize limited objects, detecto allows you to train the model on custom data sets, but this requires your computer to support GPU, otherwise deep learning training on CPU will be very slow, our ordinary home or office computers can not afford such performance requirements. Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.