Giter VIP home page Giter VIP logo

estimating-depth-from-rgb-and-sparse-sensing's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

greendream182

estimating-depth-from-rgb-and-sparse-sensing's Issues

License file

Hi lakshjaisinghani,
I was wondering if you will be able to attach a license file to the project.
Thanks!

Weights

hey @lakshjaisinghani , I was wondering if you had the weights available from training on nyuv2, and if so, could you post them? Thanks!

Found what appears to be a typo in train.py

Looking through the code, I found a problem again.

In, train.py 153~156 lines.

model = D3().float()
model = model.to(device)
Loss_fun  = nn.MSELoss()
optimizer = optim.Adam(net.parameters(), lr = learning_rate)

optim.Adam receives net.parameters as a argument, and I think we should change that part to model.parameters or change the name of the model declared above to net.

How I changed it.

optimizer = optim.Adam(model.parameters(), lr = learning_rate)

or

net = D3().float()
net = net.to(device)

The NYU_V2 dataloader in train.py seems strange.

Looking through the code, I found a problem.

When you train, you need to get the image and raw depth as sparse_input, and get the depth completed by depth completion as output.

However, if you look at the data loader code, it just calls ["depths"] instead of ["rawDepths"]. This doesn't make sense because there is actually a ground truth in the input. Does it make sense to compare the output of a model with a GT as an input to the GT again?

In your code,

class NYU_V2(Dataset):
  def __init__(self, trn_tst=0, transform=None):
    data = h5py.File('./nyu_depth_v2_labeled.mat')
    
    if trn_tst == 0:
      #trainloader
      self.images = data["images"][0:1400]
      self.depths  = data["depths"][0:1400]
    else:
      #testloader
      self.images = data["images"][1401:]
      self.depths = data["depths"][1401:]
    
    self.transform = transform
    
  def __len__(self):
    return len(self.images)
 
  def __getitem__(self, idx):
    if torch.is_tensor(idx):
      idx = idx.tolist()
      
    sample = self.images[idx, :]
    s_depth = self.depths[idx, :]
    sample = torch.from_numpy(np.transpose(sample, (2, 1, 0)))
    s_depth=  torch.from_numpy(np.transpose(s_depth, (1, 0)))
    
    return sample.float(), s_depth.float()

In code I modified

class NYU_V2(Dataset):
    def __init__(self, mode="train", transform=None, path="./nyu_depth_v2_labeled.mat"):
        f = h5py.File(path)
        
        self.images = f["images"]
        self.raw_depths = f["rawDepths"]
        self.gt_depths = f["depths"]
        self.transform = transform
        
    def __len__(self):
        return len(self.images)

    def __getitem__(self, idx):
        if torch.is_tensor(idx):
            idx = idx.tolist()
        
        # Data
        img = self.images[idx, :]
        img = torch.from_numpy(np.transpose(img, (2, 1, 0)))
        raw_depth = self.raw_depths[idx, :]
        raw_depth = torch.from_numpy(np.transpose(raw_depth, (1,0)))
        
        # Label
        depth = self.gt_depths[idx, :]
        depth = torch.from_numpy(np.transpose(depth, (1,0)))
        
        return (img.float(), raw_depth.float()), depth.float()

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.