File size: 1,761 Bytes
f15a1cd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
56
from collections.abc import Sequence
from abc import ABC, abstractmethod
import torch
from PIL.Image import Image

class FeatureExtractor(ABC):
    @abstractmethod
    def encode_image(self, img_list: Sequence[Image]) -> torch.Tensor:
        """
        Encode the input images and return the corresponding embeddings.

        Args:
            img_list: A list of PIL.Image.Image objects.

        Returns:
            The embeddings of the input images. The shape should be (len(img_list), embedding_dim).
        """
        raise NotImplementedError

    @abstractmethod
    def encode_text(self, text_list: Sequence[str]) -> torch.Tensor:
        """
        Encode the input text data and return the corresponding embeddings.

        Args:
            text_list: A list of strings.

        Returns:
            The embeddings of the input text data. The shape should be (len(text_list), embedding_dim).
        """
        raise NotImplementedError

    @abstractmethod
    def encode_3D(self, pc_tensor: torch.Tensor) -> torch.Tensor:
        """
        Encode the input 3D point cloud and return the corresponding embeddings.

        Args:
            pc_tensor: A tensor of shape (B, N, 3 + 3).
        
        Returns:
            The embeddings of the input 3D point cloud. The shape should be (B, embedding_dim).
        """
        raise NotImplementedError

    @abstractmethod
    def encode_query(self, queries: Sequence[str]) -> torch.Tensor:
        """Encode the queries and return the corresponding embeddings.

        Args:
            queries: A list of strings.

        Returns:
            The embeddings of the input text data. The shape should be (len(input_text), embedding_dim).
        """
        raise NotImplementedError