2024-07-08
한어Русский языкEnglishFrançaisIndonesianSanskrit日本語DeutschPortuguêsΕλληνικάespañolItalianoSuomalainenLatina
Image classification is the simplest and most basic type of computer vision tasks based on deep learning. The CNN feature extraction technology used in it is also the basis of visual tasks such as target detection and target segmentation.
Specifically for the image classification task, the specific process is as follows:
1. Input RGB image of specified size, 1/3 channel, width and height are generally equal
2. Use convolutional neural networks to extract multi-scale features and generate high-dimensional feature values
3. Use a fully connected network or other structure to classify high-dimensional features and output the probability value of each target classification (the sum of the probabilities is 1)
4. Select the one with the highest probability value as the image classification result
opencv.dnn模块可以直接加载深度学习模型,并进行推理输出运行结果。下面是opencv.dnn模块加载googlenet caffe模型进行图片分类的代码。
import cv2
import numpy as np
from labels import LABEL_MAP # 1000 labels in imagenet dataset
if __name__=='__main__':