#!/usr/bin/python import time import sys import os from os import walk import random import numpy as np if len(sys.argv) != 2: print( "This script will make img_path --- > person_id with random " "For example, for folder 1, then run: " " ./xxx.py 1 ") exit() folder_number = sys.argv[1] aa = {} bb = [] person = {} count = 0 oripath = "./identities_"+folder_number+"/" for (dirpath, dirnames, filenames) in walk(oripath): for dir in dirnames: person[dir] = count for (dirpath1, dirnames1, filenames1) in walk(oripath+dir): for i in filenames1: aa.update({dirpath1+"/"+i : count}) count = count + 1 bb = aa.items() random.shuffle(bb) for k,v in bb: print k," ",v aa.clear() person.clear()