Files
reconstruction/models/depth_estim.py
T

27 lines
592 B
Python

import os
import sys
import torch
import torch.nn as nn
from torch.nn import functional as F
sys.path.append(os.path.dirname(os.path.abspath(__file__)) + '/..')
from models.convnext import ConvNeXt
class DepthEstimation(nn.Module):
def __init__(self, device='cuda'):
super().__init__()
self.convnext = ConvNeXt()
self.flatten = nn.Flatten()
self.decoder = ConvNeXt(reversed=True)
def forward(self, x: torch.Tensor) -> torch.Tensor:
x = self.convnext(x)
# x = self.flatten(x)
x = self.decoder(x)
return x