This repo is to extract features from images and create embeddings by YOLOv8. YOLO stands for "You Only Look Once" and is known for its efficiency and accuracy in detecting objects in real-time.
- python3.8
- ultralytics
- cv2
- numpy
- torch
python yolo_extractor.py
- I use the global average pooling to encode the image features from 3 dims to 2 dims, you can unuse it as you want.
- You can choose which YOLOv8 block you want to output by the attribute layer_index. (recommend 15~21)
- The image resize mechanism is the same as ultralytics.
- The detection block position is xywh, you can transform it by the function xywh2xyxy(x).
- the max_det constrains the max detection amount.