- 博客(75)
- 资源 (6)
- 收藏
- 关注
原创 在Ubuntu 18.04.6 LTS安装OpenFace流程
2报错:BLAS : Program is Terminated. Because you tried to allocate too many memory regions. Segmentation fault。1报错:CMake Error at lib/local/LandmarkDetector/CMakeLists.txt:40 (add_library)...3.修改命令行参数:./bin/FeatureExtraction -解决方法:vim ~/.bashrc。
2025-01-02 15:06:41
396
原创 模型特征蒸馏:Contrastive Learning Rivals Masked Image Modeling in Fine-tuning via Feature Distillation
模型特征蒸馏
2023-02-22 11:35:16
360
原创 VIT pytorch 实现Imagenet
import torchfrom einops import rearrange, repeatfrom torch import nnimport torch.nn.functional as FMIN_NUM_PATCHES = 16class FeedForward(nn.Module): def __init__(self, dim, hidden_dim, dropout=0.): super().__init__() self.net =.
2023-02-17 21:04:16
823
原创 PIL Image resize methods
NEAREST从输入图像中选择一个最近的像素。忽略所有其他输入像素。BILINEAR (推荐)若要调整大小,请对所有可能影响输出值的像素使用线性插值计算输出像素值。对于其他变换,使用输入图像中2x2环境上的线性插值。BICUBIC若要调整大小,请对所有可能影响输出值的像素使用三次插值计算输出像素值。对于其他变换,在输入图像中使用4x4环境上的三次插值。...
2021-07-16 09:43:32
278
原创 shapely 多边形缩放
from shapely.geometry import Polygon, Point, LinearRingimport cv2import numpy as npxx = [(10, 10), (12,100), (100, 100), (20,20), (20,10)]poly = Polygon(xx)a = poly.buffer(-31)print(len(list(a.exterior.coords)))img = np.zeros((200,200,3), dtype=np..
2020-09-02 10:18:33
1407
原创 pytorch model flops and parameters count
1. flops caculate:import redef get_num_gen(gen): return sum(1 for x in gen)def flops_layer(layer): """ Calculate the number of flops for given a string information of laye...
2019-03-06 16:29:00
854
原创 keras GPU 配置灵活使用
1、指定GPUimport osos.environ["CUDA_VISIBLE_DEVICES"] = "2"2、按需分配import tensorflow as tfimport keras.backend.tensorflow_backend as KTFconfig = tf.ConfigProto() config.gpu_options.allow_growth=True #不全...
2018-06-08 08:44:05
2214
1
原创 python 多模式匹配自动机
# 结点类class node: def __init__(self, ch): self.ch = ch # 结点值 self.fail = None # Fail指针 self.tail = 0 # 尾标志:标志为 i 表示第 i 个模式串串尾 self.child = [] # 子结点 self...
2018-05-29 15:50:44
1253
原创 keras循环多输入模型的处理
def create_model(): def sum_add(x): x = K.sum(x, axis=1, keepdims=False) return x #############model1######################################################### input_1 = Inp...
2018-05-24 08:46:42
1970
原创 python基于dlib的人脸定位与人脸比对实现
import dlibcurrent_path = os.getcwd() # 获取当前路径# 模型路径predictor_path = current_path + "\\model\\shape_predictor_68_face_landmarks.dat"face_rec_model_path = current_path + "\\model\\dlib_face_recognitio...
2018-05-05 09:39:35
5524
原创 python mutiprocessing使用
帮助文档:点击打开链接mutiprocessing.Process=单进程,多进程 mutiprocessing.Lock=进程锁 mutiprocessing.Semaphore=N锁 Pool.apply_async=得到返回结果 Pool.map=批量进程import multiprocessingimport cv2def f(x): return x*2 # img ...
2018-05-04 11:24:24
471
原创 keras attention code
#lstm+attentioninputs = Input(shape=(TIME_STEPS, INPUT_DIM,))lstm_units = 32lstm_out = LSTM(lstm_units, return_sequences=True)(inputs)a = Permute((2, 1))(lstm_out)a = Reshape((input_dim, TIME_ST...
2018-04-17 09:33:09
1344
1
原创 python使用cv2进行face detect
import cv2import sys# Get user supplied valuesimagePath = 'data/0.jpg' #sys.argv[1]cascPath = 'haarcascades/haarcascade_frontalcatface.xml' #sys.argv[2]cascPath = 'haarcascades/haarcascade_front...
2018-03-22 10:38:24
1635
原创 VGG 识别结果关注区域分析代码
#coding=utf-8#keras=2.0.2#tensorflow=1.1.0from keras.applications.vgg16 import VGG16, preprocess_input, decode_predictionsfrom keras.preprocessing import imageimport keras.backend as Kimport nu
2018-03-16 09:05:21
666
原创 use sklean.model_select.GridSearchCV to find keras best parameters
#coding=utf-8import numpy as npimport kerasfrom keras.wrappers.scikit_learn import KerasClassifierfrom keras.activations import *from keras.models import *from keras.layers import *from keras.
2018-02-04 15:53:38
425
原创 vc+FTP vc+SQLServer
vc+FTP:1.stdafx.h添加//FTP#include void DisplayMsg(LPCTSTR xi_cszFormat, ...);2.dlg.h添加//FTPCInternetSession *m_pInetSession;CFtpConnection *m_pFtpConnection;3.连接// 连接 ftpCString
2018-01-30 10:52:26
249
1
原创 python实现viterbi算法
states = ('Healthy', 'Fever')observations = ('normal', 'cold', 'dizzy')start_probability = {'Healthy': 0.6, 'Fever': 0.4}transition_probability = { 'Healthy': {'Healthy': 0.7, 'Fever': 0.3},
2018-01-10 15:17:22
1048
原创 python正则re使用
1、import re# 将正则表达式编译成Pattern对象pattern = re.compile(r'hello',re.I)# 使用Pattern匹配文本,获得匹配结果,无法匹配时将返回Nonematch = pattern.match('hello world!')if match:# 使用Match获得分组信息print match.group(
2018-01-05 08:11:16
654
原创 keras实现aspect level中文文本情感分类-源自EMNLP2016
原论文:http://link.zhihu.com/?target=https%3A//arxiv.org/pdf/1605.08900v2.pdf代码实现:#coding=utf-8import csv,codecsimport jieba# jieba.load_userdict('wordDict.txt')import pandas as pdfrom keras.pr
2018-01-02 08:36:09
2078
7
原创 python 朴素贝叶斯简单实现
import reimport maths=['this is yes','this is no']r=[0,1]def tokenize(message): message=message.lower() all_words = re.findall('[a-z0-9]+', message) print(all_words) return set(a
2017-12-25 17:47:03
351
原创 keras模型可视化,层可视化及kernel可视化
keras模型可视化:model:model = Sequential()# input: 100x100 images with 3 channels -> (100, 100, 3) tensors.# this applies 32 convolution filters of size 3x3 each.model.add(ZeroPadding2D((1,1), inp
2017-12-02 18:39:38
13183
3
原创 keras实现Unet进行字符定位与识别分类
#coding=utf-8import cv2import numpy as npfrom keras.utils import to_categoricalfrom model.augmentations import randomHueSaturationValue, randomShiftScaleRotate, randomHorizontalFlipfrom keras.ca
2017-11-09 09:46:34
3007
1
原创 keras实现BiLSTM+CNN+CRF文字标记NER
import kerasfrom sklearn.model_selection import train_test_splitimport tensorflow as tffrom keras.callbacks import ModelCheckpoint,Callback# import keras.backend as Kfrom keras.layers import *fr
2017-11-09 09:41:17
15814
5
原创 利用keras框架cnn+ctc_loss识别不定长字符图片
# -*- coding: utf-8 -*-#keras==2.0.5#tensorflow==1.1.0import os,sys,stringimport sysimport loggingimport multiprocessingimport timeimport jsonimport cv2import numpy as npfrom sklearn.model
2017-10-18 22:35:20
16191
7
原创 acrobat javascript
1.展开/折叠PDF书签在acrobat 添加批处理序列,javascript脚本:function collapsBM1(bm,nLevel){ if (bm.children!=null) { bm.style=1; bm.open =false; for (var i=0; i {
2017-09-26 17:28:13
2572
原创 py-faster-rcnn配置CPU下运行demo.py
1.git数据git clone --recursive https://github.com/rbgirshick/py-faster-rcnn.git2.下载model文件,bash ./data/scripts/fetch_faster_rcnn_models.sh下载并解压:py-faster-rcnn/data/faster_rcnn_models/VGG16_f
2017-08-25 16:32:44
2943
原创 caffe-windows cpu下编译python接口/matlab接口
1.下载caffe-windwos:https://github.com/BVLC/caffe/tree/windows2.修改scripts/build_win.cmd:64行以后::: Change the settings here to match your setup :: Change MSVC_VERSION to 12 to use VS 2013 if
2017-07-20 09:51:17
401
原创 CRNN add digits
# for reproducibilitynp.random.seed(2016)K.set_image_dim_ordering('tf')# define some run parametersbatch_size = 32nb_epochs = 100examplesPer = 60000maxToAdd = 8hidden_units = 200size = 28# c
2017-07-18 09:43:59
866
原创 fld to xml and xml to fld
#coding=utf-8#将fld框文件生成xml'''VOC20122007_000027.jpgThe VOC2007 DatabasePASCAL VOC2007flickr48650030personUnspecified00174101349351'''i
2017-06-27 13:49:53
402
原创 Keras 训练时不用将数据全部加入内存
How can I use Keras with datasets that don't fit in memory?You can do batch training using model.train_on_batch(X, y) and model.test_on_batch(X, y). See the models documentation.Alternativ
2017-05-11 09:45:12
10743
原创 win7 远程配置ubuntu14 python keras tensorflow 深度学习
1.远程工具XShell5(远程命令行)+XFTP5(文件传输)2.命令行安装python3.5sudo add-apt-repository ppa:fkrull/deadsnakes sudo apt-get update sudo apt-get install python3.5
2017-05-10 16:41:22
414
原创 利用kmeans聚类进行颜色量化压缩图像
#coding=utf-8#########################################压缩from skimage import iofrom sklearn.cluster import KMeansimport numpy as npimage = io.imread('test.png')rows = image.shape[0]cols = im
2017-04-25 13:59:17
3956
2
原创 (superpixel)超像素分割
https://github.com/cxf2015/slic-python-implementation/commit/59b98988027dfa384310a0f7bf203ce0fa81fd10
2017-04-17 14:56:22
2518
2
原创 numpy 傅里叶变换与反变换高低通滤波与带通滤波
#coding=utf-8import cv2import numpy as npimport matplotlib.pyplot as pltimg=cv2.imread('test1-angle.jpg',cv2.IMREAD_GRAYSCALE)# f = np.fft.fft2(img)# fshift = np.fft.fftshift(f)# #取绝对值:将复数变化成
2017-04-17 14:53:06
7583
原创 使用keras预训练VGG16模型参数分类图像并提取特征
#coding=utf-8#keras==0.3.0 theano==0.8.0 python==2.7.13from keras.models import Sequentialfrom keras.layers.core import Flatten, Dense, Dropoutfrom keras.layers.convolutional import Convolution2D,
2017-04-16 16:51:38
19565
5
原创 机器学习 SVM sklearn
SVM回归代码:import numpy as npfrom sklearn import svmimport matplotlib.pyplot as pltN = 50np.random.seed(0)x = np.sort(np.random.uniform(0, 6, N), axis=0)y = 2*np.sin(x) + 0.1*np.random
2017-04-16 10:36:13
967
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人