def h5_deconv_data(filename):
 ret = list()
 with h5py.File(filename, 'r') as f:
  if ('deconv' not in list(f.keys())):
   return None
  act_data = f['deconv/max_act']
  img_data = f['deconv/img']
  for layer in list(act_data.keys()):
   layer_data = list()
   for fm in range(act_data[layer]['vis'].shape[0]):
    (batch_ind, img_ind) = act_data[layer]['batch_img'][fm]
    img_store = img_data['batch_{}'.format(batch_ind)]
    img_cache_ofs = img_store.attrs[str(img_ind)]
    plot_img = convert_rgb_to_bokehrgba(img_store['HWC_uint8'][:, :, :, img_cache_ofs])
    plot_deconv = convert_rgb_to_bokehrgba(act_data[layer]['vis'][fm])
    layer_data.append((fm, plot_deconv, plot_img))
   ret.append((layer, layer_data))
 return ret

def h5_deconv_data ( filename ) : ret = list ( ) with h5py . File ( filename , 'r' ) as f : if ( 'deconv' not in list ( f . keys ( ) ) ) : return None act_data = f [ 'deconv/max_act' ] img_data = f [ 'deconv/img' ] for layer in list ( act_data . keys ( ) ) : layer_data = list ( ) for fm in range ( act_data [ layer ] [ 'vis' ] . shape [ 0 ] ) : ( batch_ind , img_ind ) = act_data [ layer ] [ 'batch_img' ] [ fm ] img_store = img_data [ 'batch_{}' . format ( batch_ind ) ] img_cache_ofs = img_store . attrs [ str ( img_ind ) ] plot_img = convert_rgb_to_bokehrgba ( img_store [ 'HWC_uint8' ] [ : , : , : , img_cache_ofs ] ) plot_deconv = convert_rgb_to_bokehrgba ( act_data [ layer ] [ 'vis' ] [ fm ] ) layer_data . append ( ( fm , plot_deconv , plot_img ) ) ret . append ( ( layer , layer_data ) ) return ret
read deconv visualization data from hdf5 file .