<?xml version="1.0" encoding="utf-8" ?><rss version="2.0"><channel><title><![CDATA[GeneralJing的专栏]]></title><description><![CDATA[]]></description><link>https://blog.youkuaiyun.com/GeneralJing</link><language>zh-cn</language><generator>https://blog.youkuaiyun.com/</generator><copyright><![CDATA[Copyright &copy; GeneralJing]]></copyright><item><title><![CDATA[opencv.framework使用时报错：Expected identifier]]></title><link>https://blog.youkuaiyun.com/GeneralJing/article/details/118153864</link><guid>https://blog.youkuaiyun.com/GeneralJing/article/details/118153864</guid><author>GeneralJing</author><pubDate>Wed, 23 Jun 2021 15:14:11 +0800</pubDate><description><![CDATA[最近想在iOSdemo中测试OpenCV中的目标跟踪模块，由于之前工程中使用的opencv.framework不包含tracking部分，所以需要使用包含opencv_contrib模块的opencv.framework。开始在网上找的时候，没有找到现成的，就按照官方文档下载编译，操作说明在这个连接：
https://docs.opencv.org/master/d5/da3/tutorial_ios_install.html
下载的速度还行，就是编译的时间非常长，我编译了一个小时还没编译完。
在等待的过程]]></description><category></category></item><item><title><![CDATA[TypeError: __init__() got an unexpected keyword argument ‘is_valid_file‘]]></title><link>https://blog.youkuaiyun.com/GeneralJing/article/details/117919799</link><guid>https://blog.youkuaiyun.com/GeneralJing/article/details/117919799</guid><author>GeneralJing</author><pubDate>Tue, 15 Jun 2021 10:34:05 +0800</pubDate><description><![CDATA[应该是torchvision的版本较低，换了一个高版本的虚拟环境，就可以了。
]]></description><category></category></item><item><title><![CDATA[OSError: image file is truncated (71 bytes not processed)]]></title><link>https://blog.youkuaiyun.com/GeneralJing/article/details/117792731</link><guid>https://blog.youkuaiyun.com/GeneralJing/article/details/117792731</guid><author>GeneralJing</author><pubDate>Thu, 10 Jun 2021 22:36:03 +0800</pubDate><description><![CDATA[在加载训练图像数据，准备训练模型的时候，报错如下：


OSError: image file is truncated (71 bytes not processed) 


]]></description><category></category></item><item><title><![CDATA[unsigned char*格式的bgr转rgb]]></title><link>https://blog.youkuaiyun.com/GeneralJing/article/details/117535306</link><guid>https://blog.youkuaiyun.com/GeneralJing/article/details/117535306</guid><author>GeneralJing</author><pubDate>Thu, 03 Jun 2021 21:45:13 +0800</pubDate><description><![CDATA[// @param:
// input: {bgr_image:"读取图像为BGR格式的uchar字符数组"， image_width:"图像的宽度", image_height:"图像的高度"}
// output: {rgb_image:"转化为RGB格式图像的uchar字符数组"}
// return: {0:"成功", 1:"输入或输出uchar数组错误"}
int BGR2RGB(const unsigned char* bgr_image , const int image_width , c.]]></description><category></category></item><item><title><![CDATA[Python 计算欧氏距离]]></title><link>https://blog.youkuaiyun.com/GeneralJing/article/details/117424474</link><guid>https://blog.youkuaiyun.com/GeneralJing/article/details/117424474</guid><author>GeneralJing</author><pubDate>Mon, 31 May 2021 18:21:54 +0800</pubDate><description><![CDATA[mport math len = math.hypot(x1-x2, y1-y2) #（x1, y1）与（x2, y2）间的欧氏距离


]]></description><category></category></item><item><title><![CDATA[request.post()]]></title><link>https://blog.youkuaiyun.com/GeneralJing/article/details/117408952</link><guid>https://blog.youkuaiyun.com/GeneralJing/article/details/117408952</guid><author>GeneralJing</author><pubDate>Mon, 31 May 2021 06:49:56 +0800</pubDate><description><![CDATA[在通过requests.post()进行POST请求时，传入报文的参数有两个，一个是data，一个是json。
常见的form表单可以直接使用data参数进行报文提交，而data的对象则是python中的字典类型；
而在最新爬虫的过程中遇到了一种payload报文，是一种json格式的报文，因此传入的报文对象也应该是格式的；这里有两种方法进行报文提交

...]]></description><category></category></item><item><title><![CDATA[Python中json格式的数据与dict格式的数据相互转化方式]]></title><link>https://blog.youkuaiyun.com/GeneralJing/article/details/117408948</link><guid>https://blog.youkuaiyun.com/GeneralJing/article/details/117408948</guid><author>GeneralJing</author><pubDate>Mon, 31 May 2021 06:46:57 +0800</pubDate><description><![CDATA[import json
&lt;json&gt; = json.dumps(&lt;dict&gt;)
&lt;dict&gt; = json.loads(&lt;json&gt;)


]]></description><category></category></item><item><title><![CDATA[统计图像mask占比]]></title><link>https://blog.youkuaiyun.com/GeneralJing/article/details/117354709</link><guid>https://blog.youkuaiyun.com/GeneralJing/article/details/117354709</guid><author>GeneralJing</author><pubDate>Fri, 28 May 2021 10:35:21 +0800</pubDate><description><![CDATA[##统计占比
output[output&lt;128]=0
output[output&gt;=128]=1
area_ratio = np.sum(output)/(im_h*im_w)


]]></description><category></category></item><item><title><![CDATA[Python OpenCV获取图像矩阵mask对应的矩形区域]]></title><link>https://blog.youkuaiyun.com/GeneralJing/article/details/117354142</link><guid>https://blog.youkuaiyun.com/GeneralJing/article/details/117354142</guid><author>GeneralJing</author><pubDate>Fri, 28 May 2021 10:21:49 +0800</pubDate><description><![CDATA[最近在项目中需要对分割模型得到的mask区域进行矩形裁切，就是截取包含mask的矩形区域。中间需要获取最左最右的x，最上最下的y，然后根据这个进行裁切。


index = np.nonzero(output)
if len(index[0])!=0 and len(index[1])!=0:
    minx = np.min(index[1])
    maxx = np.max(index[1])
    miny = np.min(index[0])
    maxy = np.max(index[]]></description><category></category></item><item><title><![CDATA[C++结构体与IOS NSArray之间转换使用]]></title><link>https://blog.youkuaiyun.com/GeneralJing/article/details/117332018</link><guid>https://blog.youkuaiyun.com/GeneralJing/article/details/117332018</guid><author>GeneralJing</author><pubDate>Thu, 27 May 2021 16:32:28 +0800</pubDate><description><![CDATA[#define GetNSValueFromCType(cValue) ([NSValue value:&amp;cValue withObjCType:@encode(typeof(cValue))])

#define SetCValueFromNSValue(ocValue, cValue) [ocValue getValue:&amp;cValue]



使用方法如下：

int count = 10;

NSValue *value = GetNSValueFromCType(count);
.]]></description><category></category></item><item><title><![CDATA[将字典结构数据写入json文件]]></title><link>https://blog.youkuaiyun.com/GeneralJing/article/details/116221147</link><guid>https://blog.youkuaiyun.com/GeneralJing/article/details/116221147</guid><author>GeneralJing</author><pubDate>Wed, 28 Apr 2021 06:46:48 +0800</pubDate><description><![CDATA[import json

data ={
	'name': liangliang,
	'age': 30,
	'gender': male,
	'address:', beijing
}

json_str = json.dumps(data, ensure_ascii=False, indent=4) #字符缩进4
json_path = './xxx.json'
with open(json_path, 'w') as json_file:
	json_file.write(json_str)


..]]></description><category></category></item><item><title><![CDATA[python3 UnicodeEncodeError: ‘ascii‘ codec can‘t encode characters in ordinal not in range(128)]]></title><link>https://blog.youkuaiyun.com/GeneralJing/article/details/115867759</link><guid>https://blog.youkuaiyun.com/GeneralJing/article/details/115867759</guid><author>GeneralJing</author><pubDate>Mon, 19 Apr 2021 16:26:52 +0800</pubDate><description><![CDATA[1.设置环境变量

在linux或Mac上设置环境变量，编辑~/.bash_profile文件（’~’指的是用户登录后的默认目录），添加一行：


export LANG="en_US.UTF-8"

然后执行source .bash_profile，让上面的设置生效。

2.使用PYTHONIOENCODING

在运行python命令前添加参数 PYTHONIOENCODING=utf-8 python xxx_xxx.py
...]]></description><category></category></item><item><title><![CDATA[YOLO中letterbox_image相关解释]]></title><link>https://blog.youkuaiyun.com/GeneralJing/article/details/115603512</link><guid>https://blog.youkuaiyun.com/GeneralJing/article/details/115603512</guid><author>GeneralJing</author><pubDate>Sun, 11 Apr 2021 18:20:28 +0800</pubDate><description><![CDATA[pytorch实现YOLO中对输入图像尺寸进行调整，满足输入的尺寸要求，比如412*412或者320*320


def letterbox_image(img, inp_dim):
    """
    lteerbox_image()将图片按照纵横比进行缩放，将空白部分用(128,128,128)填充,使图像尺寸满足输入要求
    具体操作就是,某个边正好可以等于目标长度,另一边小于等于目标长度
    将缩放后的数据拷贝到画布中心，即可完成输入变换
    """
    img_w, img_h]]></description><category></category></item><item><title><![CDATA[非极大值抑制-NMS]]></title><link>https://blog.youkuaiyun.com/GeneralJing/article/details/115500802</link><guid>https://blog.youkuaiyun.com/GeneralJing/article/details/115500802</guid><author>GeneralJing</author><pubDate>Thu, 08 Apr 2021 06:53:46 +0800</pubDate><description><![CDATA[在目标检测任务中，滑动窗口经过特征提取和分类器识别后，每个窗口会得到一个分数，但滑动窗口胡导致很多窗口之间存在较大交叉重叠的情况，使用NMS可以选取在相邻区域相互交叉但得分最高的候选框，剔除那些得分低的候选框。

检测之后的候选框集合用B表示，每个候选框的置信度用S表示，IOU阈值设置为T，NMS的实现步骤可以总结为：

1.在候选框集合B中选择具有最大置信度S的候选框M

2.将M从候选框集合B中移除，并加入到最终的检测结果D中

3.将B中剩余候选框和M进行IOU计算，从B中剔除IOU值大于阈值T的候选]]></description><category></category></item><item><title><![CDATA[yolo fastest中get_actual_detections函数作用及thresh的意义]]></title><link>https://blog.youkuaiyun.com/GeneralJing/article/details/115460424</link><guid>https://blog.youkuaiyun.com/GeneralJing/article/details/115460424</guid><author>GeneralJing</author><pubDate>Tue, 06 Apr 2021 14:40:42 +0800</pubDate><description><![CDATA[测试YOLO fastest训练模型命令的时候，有个参数是-thresh，所以需要查看适用这个参数的地方


// Creates array of detections with prob &gt; thresh and fills best_class for them
detection_with_class* get_actual_detections(detection *dets, int dets_num, float thresh, int* selected_detections_num,]]></description><category></category></item><item><title><![CDATA[FPN相关理解]]></title><link>https://blog.youkuaiyun.com/GeneralJing/article/details/115258947</link><guid>https://blog.youkuaiyun.com/GeneralJing/article/details/115258947</guid><author>GeneralJing</author><pubDate>Sat, 27 Mar 2021 07:48:46 +0800</pubDate><description><![CDATA[不同尺寸的特征图对应的感受野不同，进而特征图所能表达的信息抽象程度也有所区别。浅层的特征图(对应大尺寸的特征图)感受野小，比较适合检测小目标(要检测大目标，则其只“看”到了大目标的一部分，有效信息不够)；深层的特征图(对应小尺寸的特征图)感受野大，适合检测大目标(要检测小目标，则其”看“到了太多的背景噪音，冗余噪音太多，学不到小目标的有效信息)。所以，有文章就提出了将不同尺寸的特征图，融合之后进行预测，来提升目标检测的性能，特征金字塔网络[FPN]的主要思想就是这个。


...]]></description><category></category></item><item><title><![CDATA[yolo fastest模型网络结构魔改]]></title><link>https://blog.youkuaiyun.com/GeneralJing/article/details/115132558</link><guid>https://blog.youkuaiyun.com/GeneralJing/article/details/115132558</guid><author>GeneralJing</author><pubDate>Tue, 23 Mar 2021 17:31:10 +0800</pubDate><description><![CDATA[在将训练的yolo fastest模型部署移动端测试的时候，发现其中一个分支基本没有起作用，在训练的时候从日志也看出来了，打印的指标都是0，所以打算将网络的这个分支剥离掉。修改的方式就是将cfg文件中对应的分支去掉，只保留有用的那个分支。





虽然减少了一个分支，但是计算量并没有减少太多，在移动端提升大概1ms+。
...]]></description><category></category></item><item><title><![CDATA[darknet提取主干网络权重或者指定层数的权重]]></title><link>https://blog.youkuaiyun.com/GeneralJing/article/details/115087492</link><guid>https://blog.youkuaiyun.com/GeneralJing/article/details/115087492</guid><author>GeneralJing</author><pubDate>Mon, 22 Mar 2021 17:25:22 +0800</pubDate><description><![CDATA[在YOLO fastest的readme里面，有下面一个这样的命令，开始运行这个：


./darknet partial yolo-fastest.cfg yolo-fastest.weights yolo-fastest.conv.109 109

开始没太在意，就照着流程做，后面在看代码的时候对这个地方有了更多认识。这个地方是提取yolo-fastest.weights中0-108层的权重，并保存为文件。


void partial(char *cfgfile, char *weightfile, ]]></description><category></category></item><item><title><![CDATA[YOLO fastest cfg文件理解及注释]]></title><link>https://blog.youkuaiyun.com/GeneralJing/article/details/115084599</link><guid>https://blog.youkuaiyun.com/GeneralJing/article/details/115084599</guid><author>GeneralJing</author><pubDate>Mon, 22 Mar 2021 16:41:58 +0800</pubDate><description><![CDATA[YOLO fastest cfg文件注释分析，大体上跟其他版本的YOLO配置文件一致，此处主要是记录一下，针对自己不熟悉的地方额外添加一点说明。

1.[net]层


[net]
batch=64
subdivisions=1
width=320
height=320
channels=3
momentum=0.949 #动量参数影响着梯度下降到最优值的速度。
decay=0.0005 #权重衰减正则项，防止过拟合。
angle=0 #数据增强，设置旋转角度。
saturation=1.5 #饱和度
ex]]></description><category></category></item><item><title><![CDATA[C实现去除字符串中的指定字符]]></title><link>https://blog.youkuaiyun.com/GeneralJing/article/details/115012537</link><guid>https://blog.youkuaiyun.com/GeneralJing/article/details/115012537</guid><author>GeneralJing</author><pubDate>Fri, 19 Mar 2021 17:56:26 +0800</pubDate><description><![CDATA[//将非法字符去除，重新链接字符串，并以'\0'作为结尾
void strip(char *s)
{
    size_t i;
    size_t len = strlen(s);
    size_t offset = 0;
    for(i = 0; i &lt; len; ++i){
        char c = s[i];
        if(c==' '||c=='\t'||c=='\n') ++offset;
        else s[i-offset] = c;
    }
.]]></description><category></category></item></channel></rss>