Update inspireface to 1.2.0

This commit is contained in:
Jingyu
2025-03-25 00:51:26 +08:00
parent 977ea6795b
commit ca64996b84
388 changed files with 28584 additions and 13036 deletions

View File

@@ -1,19 +1,19 @@
//
// Created by Tunm-Air13 on 2023/9/11.
//
/**
* Created by Jingyu Yan
* @date 2024-10-01
*/
#include <iostream>
#include "opencv2/opencv.hpp"
#include "log.h"
#include "inspireface/feature_hub/simd.h"
//#include <Eigen/Dense>
// #include <Eigen/Dense>
using namespace inspire;
int main() {
int N = 512;
int vectorSize = 512; // Vector length
int vectorSize = 512; // Vector length
{
// Create an Nx512 matrix of type CV_32F and fill it with random numbers
cv::Mat mat(N, vectorSize, CV_32F);
@@ -26,14 +26,13 @@ int main() {
std::cout << mat.size << std::endl;
std::cout << one.size << std::endl;
auto timeStart = (double) cv::getTickCount();
auto timeStart = (double)cv::getTickCount();
cv::Mat cosineSimilarities;
cv::gemm(mat, one, 1, cv::Mat(), 0, cosineSimilarities);
double cost = ((double) cv::getTickCount() - timeStart) / cv::getTickFrequency() * 1000;
double cost = ((double)cv::getTickCount() - timeStart) / cv::getTickFrequency() * 1000;
INSPIRE_LOGD("Matrix COST: %f", cost);
}
{
@@ -51,33 +50,33 @@ int main() {
vectorOne[i] = static_cast<float>(std::rand()) / RAND_MAX;
}
auto timeStart = (double) cv::getTickCount();
auto timeStart = (double)cv::getTickCount();
// dot
for (const auto &v: matrix) {
for (const auto &v : matrix) {
simd_dot(v.data(), vectorOne.data(), vectorSize);
}
double cost = ((double) cv::getTickCount() - timeStart) / cv::getTickFrequency() * 1000;
double cost = ((double)cv::getTickCount() - timeStart) / cv::getTickFrequency() * 1000;
INSPIRE_LOGD("Vector COST: %f", cost);
}
// {
// Eigen::initParallel();
// Eigen::MatrixXf mat(N, vectorSize);
// mat = Eigen::MatrixXf::Random(N, vectorSize);
//
// std::cout << mat.rows() << " x " << mat.cols() << std::endl;
//
//
// Eigen::VectorXf one(vectorSize);
// one = Eigen::VectorXf::Random(vectorSize);
//
// auto timeStart = (double) cv::getTickCount();
// Eigen::VectorXf result = mat * one;
//
// double cost = ((double) cv::getTickCount() - timeStart) / cv::getTickFrequency() * 1000;
// LOGD("Eigen COST: %f", cost);
// }
// {
// Eigen::initParallel();
// Eigen::MatrixXf mat(N, vectorSize);
// mat = Eigen::MatrixXf::Random(N, vectorSize);
//
// std::cout << mat.rows() << " x " << mat.cols() << std::endl;
//
//
// Eigen::VectorXf one(vectorSize);
// one = Eigen::VectorXf::Random(vectorSize);
//
// auto timeStart = (double) cv::getTickCount();
// Eigen::VectorXf result = mat * one;
//
// double cost = ((double) cv::getTickCount() - timeStart) / cv::getTickFrequency() * 1000;
// LOGD("Eigen COST: %f", cost);
// }
return 0;
}