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(clusters, 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], 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