结构体 faiss::ITQMatrix
-
struct ITQMatrix : public faiss::LinearTransform
ITQ 实现来自
迭代量化:一种用于学习大规模图像检索的二元码的 Procrustean 方法,
Yunchao Gong, Svetlana Lazebnik, Albert Gordo, Florent Perronnin, PAMI’12。
公共函数
-
explicit ITQMatrix(int d = 0)
-
virtual void train(idx_t n, const float *x) override
对一组有代表性的向量执行训练。 默认情况下不执行任何操作。
- 参数:
n – 训练向量的数量
x – 训练向量,大小为 n * d
-
virtual void apply_noalloc(idx_t n, const float *x, float *xt) const override
与 apply 相同,但结果是预先分配的
-
void transform_transpose(idx_t n, const float *y, float *x) const
计算 x = A^T * (x - b) 如果 A 有正交线,则为逆变换
-
virtual void reverse_transform(idx_t n, const float *xt, float *x) const override
仅当 is_orthonormal 时才有效
-
void set_is_orthonormal()
计算 A^T * A 以设置 is_orthonormal 标志
-
void print_if_verbose(const char *name, const std::vector<double> &mat, int n, int d) const
-
virtual void check_identical(const VectorTransform &other) const override
-
float *apply(idx_t n, const float *x) const
应用转换并在分配的指针中返回结果
- 参数:
n – 要转换的向量数
x – 输入向量,大小为 n * d_in
- 返回:
输出向量,大小为 n * d_out
公共成员
-
int max_iter
-
int seed
-
std::vector<double> init_rotation
-
bool have_bias
-
bool is_orthonormal
! 是否使用偏置项
检查矩阵 A 是否为正交矩阵(启用 reverse_transform)
-
std::vector<float> A
变换矩阵,大小为 d_out * d_in。
-
std::vector<float> b
偏置向量,大小为 d_out
-
bool verbose
-
int d_in
-
int d_out
输入维度
-
bool is_trained
如果 VectorTransform 不需要训练,或者已经完成训练,则设置此项
-
explicit ITQMatrix(int d = 0)