Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _get_cluster_images(clusters, no_crop, n, c):
cluster_images = [None] * len(clusters)
for cluster_id, face_ids in clusters.items():
im = faces_to_tiled_img(
Face.objects.filter(id__in=face_ids).order_by('?')[:n],
no_crop,
cols=c
)
cluster_images[cluster_id] = im
return cluster_images
def _get_cluster_images_fxn(clusters, n):
cluster_images = {} #defining the cluster_images dict
for cluster_id, face_ids in clusters.items():
cluster_images[cluster_id] = {}
for i in range(0, n):
im = faces_to_tiled_img(
Face.objects.filter(id__in=face_ids).order_by('?')[:1],
False,
cols=1)
cluster_images[cluster_id][i] = im
return cluster_images
def _get_random_image(face_ids): #new cluster_images
im = faces_to_tiled_img(
Face.objects.filter(id__in=face_ids).order_by('?')[:1],
False,
cols=1
)
return im
def _get_cluster_images_fxn(clusters, n):