SqueezeSegV3 icon indicating copy to clipboard operation
SqueezeSegV3 copied to clipboard

How can I get Data distribution?

Open slayerlpj opened this issue 3 years ago • 2 comments

Hi! How can I get data distribution on my dataset? Just like SSGV321.yaml img_means: #range_x,y,z,signal - 12.12 - 10.88 - 0.23 - -1.04 - 0.21 img_stds: #range, x,y,z,signal - 12.32 - 11.47 - 6.91 - 0.86 - 0.16

slayerlpj avatar Aug 12 '21 03:08 slayerlpj

I briefly write the pseudo code you may refer to.

with torch.no_grad(): end = time.time() meanr = 0. stdr = 0. meanx = 0. meany = 0. meanz = 0. stdx = 0. stdy = 0. stdz = 0. meane = 0. stde = 0.

  for i, (proj_in, proj_mask, _, _, path_seq, path_name, p_x, p_y, proj_range, unproj_range, proj_xyz, unproj_xyz, proj_remission, unproj_remission, npoints) in enumerate(loader):

    print("Number of Points: " , npoints)

    meanr += unproj_range[:,:npoints].mean()
    stdr += unproj_range[:,:npoints].std()
    meanx += unproj_xyz[:,:npoints,0].mean()
    stdx += unproj_xyz[:,:npoints,0].std()
    meany += unproj_xyz[:,:npoints,1].mean()
    stdy += unproj_xyz[:,:npoints,1].std()
    meanz += unproj_xyz[:,:npoints,2].mean()
    stdz += unproj_xyz[:,:npoints,2].std()
    meane += unproj_remission[:,:npoints].mean()
    stde += unproj_remission[:,:npoints].std()

  meanr /= len(loader.dataset)
  stdr /= len(loader.dataset)     
  meanx /= len(loader.dataset)
  stdx /= len(loader.dataset)
  meany /= len(loader.dataset)
  stdy /= len(loader.dataset)
  meanz /= len(loader.dataset)
  stdz /= len(loader.dataset)
  meane /= len(loader.dataset)
  stde /= len(loader.dataset)

  print("meanr: " + str(meanr))
  print("meanx: " + str(meanx))
  print("meany: " + str(meany))
  print("meanz: " + str(meanz))
  print("meane: " + str(meane))
  
  print("stdr: " + str(stdr))
  print("stdx: " + str(stdx))
  print("stdy: " + str(stdy))
  print("stdz: " + str(stdz))            
  print("stde: " + str(stde))

  print()

chenfengxu714 avatar Aug 12 '21 14:08 chenfengxu714

Thank you!!!!!!

slayerlpj avatar Aug 13 '21 01:08 slayerlpj