Skip to content

Commit

Permalink
add face detector support
Browse files Browse the repository at this point in the history
  • Loading branch information
Neutree committed May 16, 2024
1 parent f138216 commit deffea3
Show file tree
Hide file tree
Showing 15 changed files with 1,732 additions and 14 deletions.
11 changes: 11 additions & 0 deletions components/basic/include/maix_tensor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include <algorithm>
#include <tuple>
#include <map>
#include <valarray>
#include "maix_log.hpp"
#include "maix_err.hpp"

Expand Down Expand Up @@ -247,6 +248,16 @@ namespace maix

void *data() { return _data; }

/**
* get tensor data and return a list
* @return list type data
* @maixpy maix.tensor.Tensor.to_float_list
*/
std::valarray<float>* to_float_list()
{
return new std::valarray<float>((float*)_data, size_int());
}

void operator=(Tensor &t)
{
printf("copy tensor %d, %d\n", _is_alloc, size_int());
Expand Down
Binary file modified components/maixcam_lib/lib/libmaixcam_lib.so
Binary file not shown.
45 changes: 45 additions & 0 deletions components/nn/include/libmaix_nn_decoder_retinaface.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
retinaface decoder
@author neucrack@sipeed
@date 2021-5-15 create for libmaix by neucrack
2021-8-18 update for libmaix by neucrack
2024-5-15 copy and edit for MaixCDK by neucrack
@license MIT
*/

#ifndef __DECODER_RETINAFACE_H
#define __DECODER_RETINAFACE_H

#include "maix_nn_object.hpp"
#include <stdint.h>
#include <stdbool.h>

using namespace maix;

#define ANCHOR_SIZE_NUM 3
#define MIN_SIZE_LEN 6

typedef struct
{
float variance[2];
int steps[ANCHOR_SIZE_NUM];
int min_sizes[ANCHOR_SIZE_NUM * 2];

float nms;
float score_thresh;
int input_w;
int input_h;

// set by init func
int channel_num;
}libmaix_nn_decoder_retinaface_config_t;


/************ direct API ***********/
extern nn::ObjectFloat* retinaface_get_priorboxes(libmaix_nn_decoder_retinaface_config_t* config, int* boxes_num);
extern int retinaface_decode(float* net_out_loc, float* net_out_conf, float* net_out_landmark, nn::ObjectFloat* prior_boxes, std::vector<nn::Object> *faces, int* boxes_num, bool chw, libmaix_nn_decoder_retinaface_config_t* config);
extern int retinaface_get_channel_num(libmaix_nn_decoder_retinaface_config_t* config);


#endif

Loading

0 comments on commit deffea3

Please sign in to comment.