Spaces:
Sleeping
Sleeping
File size: 1,460 Bytes
6e9c433 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
from typing import List
import numpy as np
from torch import Tensor, nn
class BaseRGBDModel(nn.Module):
def __init__(self):
super(BaseRGBDModel, self).__init__()
"""
Requirements:
1. Construct a model
2. Load pretrained weights
3. Load model into device
4. Construct preprocessing
"""
def inference(
self,
image: Tensor,
depth: Tensor,
origin_shape: np.array,
) -> List[np.ndarray]:
"""
Given:
- An image (Tensor) with original shape [c, h, w]
- A depth image (Tensor) with a shape of [c, h, w], do not need to be the same shape as image
Requirements:
1. Preprocessing
2. Inference
3. Return saliency maps np.float32 between 0.0 and 1.0,
with the same size as original size
"""
raise NotImplementedError()
def batch_inference(
self,
images: Tensor,
depths: Tensor,
) -> List[np.ndarray]:
"""
Given:
- A batch of images (Tensor) with original shape [b, c, h, w]
- A batch of depths (Tensor) with a shape of [b, c, h, w], do not need to be the same shape as image
Requirements:
1. Preprocessing
2. Inference
3. Return saliency maps np.float32 between 0.0 and 1.0,
with the same size as original size
"""
raise NotImplementedError()
|