code: import h5py
  import numpy as np
  
  def loading_data(path):
  	print('******************************************************')
  	print('dataset:{0}'.format(path))
  	print('******************************************************')
  
  	file = h5py.File(path,'r')
  	images = file['images'][:].transpose(0,3,2,1)
  	labels = file['LAll'][:].transpose(1,0)
  	tags = file['YAll'][:].transpose(1,0)
  	file.close()
  
  	return images, tags, labels
  
  
  def split_data(images, tags, labels, QUERY_SIZE, TRAINING_SIZE, DATABASE_SIZE):
  
  	X = {}
  	index_all = np.random.permutation(QUERY_SIZE+DATABASE_SIZE)
  	ind_Q = index_all[0:QUERY_SIZE]
  	ind_T = index_all[QUERY_SIZE:TRAINING_SIZE + QUERY_SIZE]
  	ind_R = index_all[QUERY_SIZE:DATABASE_SIZE + QUERY_SIZE]
  
  	X['query'] = images[ind_Q, :, :, :]
  	X['train'] = images[ind_T, :, :, :]
  	X['retrieval'] = images[ind_R, :, :, :]
  
  	Y = {}
  	Y['query'] = tags[ind_Q, :]
  	Y['train'] = tags[ind_T, :]
  	Y['retrieval'] = tags[ind_R, :]
  
  	L = {}
  	L['query'] = labels[ind_Q, :]
  	L['train'] = labels[ind_T, :]
  	L['retrieval'] = labels[ind_R, :]
  	return X, Y, L
  
apis: numpy.random.permutation