Skip to content

Instantly share code, notes, and snippets.

View hewumars's full-sized avatar

Mars hewumars

View GitHub Profile
@hewumars
hewumars / demo1.c
Created January 22, 2019 02:22
For DeepStream
#include <gst/gst.h>
int main(int argc, char *argv[])
{
gst_init(&argc,&argv);//命令行输入的参数传递给GStreamer函数库
GstElement *pipeline, *filesrc, *decoder, *audiosink;//创建三个远见
pipeline = gst_pipeline_new("pipeline");//创建用于容纳元件的新管道
/*创建数据源元件*/
@hewumars
hewumars / assert.c
Last active February 27, 2019 00:51
#include <stdio.h>
#define HW_PAUSE() do {\
printf("---------------press Enter key to exit!---------------\n");\
getchar();\
} while (0)
#define HW_PRT(fmt...) \
do {\
printf("[%s]-%d: ", __FUNCTION__, __LINE__);\
@hewumars
hewumars / readme.txt
Last active February 28, 2019 06:25
1.readme.txt随笔记录
DeNet在COCO上实现mAP:33.6%@79Hz,41.8%@5Hz
//加载模型流程 //涉及的变量
HI_**_Param_S copParam[1];//自定义层参数结构体
static HI_RUNTIME_GROUP_INFO_S s_stGroupInfo;//模型组信息结构体,Load时用到
HI_RUNTIME_GROUP_HANDLE hGroupHandle;//句柄
HI_RUNTIME_WK_INFO_S astWkInfo[2];//wk模型信息,有几个模型就有多少元素
HI_RUNTIME_COP_ATTR_S stProposalAttr = {}; //custom operator自定义操作的属性
HI_RUNTIME_CONNECTOR_ATTR_S stConnectorAttr = {0};//连接器的属性
HI_CHAR acConfig[1024] = {0};//modelgroup文件读入的数组
memset(&stProposalAttr, 0, sizeof(HI_RUNTIME_COP_ATTR_S));
//permute
u32Offset = 0;
ps32InputBlob = pps32InputData[i];
u32ChnOffset = au32GridNumHeight[i]*au32Stride[i]/sizeof(HI_S32);
u32HeightOffset = au32Stride[i]/sizeof(HI_S32);
for (h = 0; h < au32GridNumHeight[i]; h++)
{
for (w = 0; w < au32GridNumWidth[i]; w++)
{
for (c = 0; c < SAMPLE_SVP_NNIE_YOLOV3_EACH_BBOX_INFER_RESULT_NUM*u32EachGridBbox; c++)
HI_U64 u64PhyAddrTmpBuf;
HI_S32 * pu32VirAddrTmpBuf;
HI_S32 *ps32TmpBuf=NULL;
//mmz名称,内存控制,物理地址,虚拟地址,size
s32Ret= SAMPLE_COMM_SVP_MallocMem("HIRTTmpBufSize",NULL,(HI_U64 *)&u64PhyAddrTmpBuf,(void**)&pu32VirAddrTmpBuf,u32TmpBufSize);
SAMPLE_CHECK_EXPR_RET(HI_SUCCESS!=s32Ret,s32Ret,"1SAMPLE_COMM_SVP_MallocMem:%x\n",pu32VirAddrTmpBuf);
ps32TmpBuf = pu32VirAddrTmpBuf;
@hewumars
hewumars / h5_to_pb.py
Last active March 1, 2019 10:19
1.Keras H5转TF pb文件
from keras.models import load_model
import tensorflow as tf
import os
from keras import backend as K
#路径设置
input_path = 'weights/'
weight_file = '****.h5'
weight_file_path = os.path.join(input_path,weight_file)
output_graph_name = weight_file[:-3]+'.pb'
  • 高质量数据优于花哨的算法
  1. 准确性
  2. 完整性
  3. 一致性
  4. 分布均匀性
  • 数据清洗的工作流程
void savebmp(char *name,HI_U8 *buffer,int w,int h) {
FILE *f=fopen(name,"wb");
if(!f) {
printf("Error writing image to disk.\n");
return;
}
unsigned int size=w*h*3+54;
HI_U8 header[54]={'B','M',size&255,(size>>8)&255,(size>>16)&255,size>>24,0,
0,0,0,54,0,0,0,40,0,0,0,w&255,w>>8,0,0,h&255,h>>8,0,0,1,0,24,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
@hewumars
hewumars / NV21_TO_BGR.c
Last active March 5, 2019 07:00
YUV TO RGB
void NV21_T_RGB( unsigned char *yuyv , unsigned char *rgb,unsigned int width , unsigned int height )
{
const int nv_start = width * height ;
HI_U32 i, j, index = 0, rgb_index = 0;
HI_U8 y, u, v;
int r, g, b, nv_index = 0;
for(i = 0; i < height ; i++)
{