Python script to run k-means clustering on any yolov3 format dataset to find appropriate anchors
import glob
import numpy as np
from sklearn.cluster import KMeans
import matplotlib.pyplot as plt
import numpy as np
-
Keep the .data file and the folder containing all .txt annotations in the path
-
Run anchor.py
(python anchor.py)
-
The cluster will be stored in cluster.png
- The output will be-
anchors are : [[14 34]
[81 36]
[12 26]
[14 40]]