English 中文(简体)
如何摘取NYOLOv8中某些层的特征图?
原标题:How to extract the feature map of certain layer in YOLOv8?

我正在对多任务学习进行研究,我想从纽约联络处负责人那里提取专题地图以供比较。 我正在从,与YOLOv8n而不是ReNet18模型。

model = YOLO( models/yolov8n.pt )
transform = transforms.Compose([
    transforms.Resize((224, 224)),
    transforms.ToTensor(),
    transforms.Normalize(mean=0., std=1.)
])
image = Image.open(str( images/puppies.jpg ))
image = transform(image)
image = image.unsqueeze(0)
feature_map = model.model.model[15](image)
feature_map.shape

Error: Error RuntimeError: Given groups=1, weight of size [128, 64, 3, 3], expected input[1, 3, 224, 224] to have 64 channels, but got 3 channels instead

I read the YOLOv8 architecture and suspect that image passed into the model is constant and does not change which is expected from the layers (Correct me if I m wrong). The reason is because the code works when I want to extract feature from layer before any concatenation occurs. I pretty sure that my code is wrong but not sure how to implement it correctly.

Remarks: I am referring to the YOLOv8 architecture from RangeKing. YOLOv8 Architecture

问题回答

你们是否解决这一问题? 我还需要在约洛夫8处提取一个轨道层。





相关问题
contour extraction

Example: I as a user I have a database with 20 images but only 3 images obtain scene with sun. I would like to retrieve images from this database only with sun scene. I am using Fourier descriptor for ...

Image and audio feature extraction in Java

I am looking for Java libraries that can be used to create feature vectors for a given image or audio file. For example, if the input was 322.bmp the output would be something like 322.bmp 93.444 22....

Multidimensional indexing of images

I would like to know if there is a good way for indexing multidimensional objects (i.e. images). More precisely, I have a large collection of images on which I calculate n-dimensional feature vectors. ...

Matlab implementation of Haar feature extraction

Does anyone know of a (purely) matlab implementation of Haar feature extraction (the kind used in Viola&Jones object detection algorithm)? (I ran across a matlab binding to Opencv s implementation ...

热门标签