Visualisation
build_feature_model(model_str)
Build a feature extraction model.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model_str |
str
|
Model name. |
required |
Returns:
Name | Type | Description |
---|---|---|
tuple |
Tuple of (model, extractor). |
Source code in video_sampler/visualisation/clustering.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
|
cluster_features(features, max_clusters=50)
Cluster features using t-SNE and KMeans
Parameters:
Name | Type | Description | Default |
---|---|---|---|
features |
ndarray
|
dict with keys "embeds" and "paths" |
required |
max_clusters |
int
|
maximum number of clusters |
50
|
Retruns
tuple: of (X, cluster_labels)
Source code in video_sampler/visualisation/clustering.py
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
|
extract_features(model_str, image_folder, mkey='pixel_values', batch_size=8)
Extract features from a folder of images.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model_str |
str
|
Model name. |
required |
image_folder |
Path
|
Folder with images. |
required |
mkey |
str
|
Key for the pixel values. Defaults to "pixel_values". |
'pixel_values'
|
batch_size |
int
|
Batch size. Defaults to 8. |
8
|
Returns:
Name | Type | Description |
---|---|---|
dict |
Dictionary with keys "embeds" and "paths". |
Source code in video_sampler/visualisation/clustering.py
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
|