
Python
知识在于分享
即便是蜗牛,一步一步不停歇的爬也会有看见太阳的一天
展开
-
ubuntu20.04 编译open3d-v0.13.0
ubuntu20.04系统git clone --recursive https://github.com/intel-isl/Open3Dgit checkout v0.13.0HEAD 目前位于 c3f9de224 0.13.0 version bump (#3529)git submodule update --init --recursiveutil/install_deps_ubuntu.sh -ymkdir buildmkdir installcd build升级cma.原创 2021-10-21 14:43:22 · 863 阅读 · 0 评论 -
pdf分割每一页为png图片
https://blog.youkuaiyun.com/yibing1996/article/details/107841410pip install PyMuPDF -i https://pypi.tuna.tsinghua.edu.cn/simplepip install fitz -i https://pypi.tuna.tsinghua.edu.cn/simplepip#import PyPDF4#import pikepdfimport fitzimport os#https://...转载 2021-10-21 11:06:30 · 538 阅读 · 0 评论 -
numpy torch索引问题 vstack自带深拷贝 temp=img[:,:]是浅拷贝
import cv2import numpy as npmatches = np.ones((1000), dtype=np.int64) * -1matches[20] = 120#matches[40] = 60#matches = matches.astype(np.int64)valid = matches > -1kpts0= np.random.randint(low=0, high=200, size=(1000, 2), dtype=np.int64)kpts1= .原创 2021-09-28 11:46:16 · 176 阅读 · 0 评论 -
python模拟实现cpp的二进制
from collections import Sequenceimport mathclass Bitset(Sequence): """ A very simple bitset implementation for Python. Author: Geremy Condra Licensed under GPLv3 Released 3 May 2009 Usage: >.转载 2021-09-22 16:15:01 · 182 阅读 · 0 评论 -
tensorflow-v1.12的保存模型方式学习
tensorflow保存模型的几种方法tensorflow保存模型的几种方法_zmlovelx(帅得不敢出门 程序员群31843264)-优快云博客tensorflow中的检查点checkpoint详解(二)——以tensorflow1.x 的模型保存与恢复为主tensorflow中的检查点checkpoint详解(二)——以tensorflow1.x 的模型保存与恢复为主_MIss-Y的博客-优快云博客tensorflow模型保存(三)——tensorflow1.x版本的savedmode原创 2021-09-15 02:05:23 · 518 阅读 · 0 评论 -
python3读取由python2建立的pickle_file文件(utf-8问题)
Python 3 pickle load from Python 2 - Stack Overflowpickle — Python object serialization — Python 3.9.7 documentationpickle — Python object serialization — Python 3.9.7 documentationpython3from six.moves import cPickle as picklepickle_file = 'notM原创 2021-09-15 02:00:05 · 443 阅读 · 0 评论 -
numpy进行复现时候高维矩阵是否对齐api
numpy.testing.assert_allclose — NumPy v1.21 Manualx = [1e-5, 1e-3, 1e-1]y = np.arccos(np.cos(x))np.testing.assert_allclose(x, y, rtol=1e-5, atol=0)原创 2021-09-14 18:47:07 · 203 阅读 · 0 评论 -
双线性插值问题
import numpy as npimport cv2import mathImage = range(1, 17, 1)Image = np.reshape(Image, (4,4))Image = Image.astype("uint8")print(Image)'''[[ 1 2 3 4] [ 5 6 7 8] [ 9 10 11 12] [13 14 15 16]]'''output1 = cv2.resize(Image, (11,11), None, .原创 2021-09-08 15:29:45 · 195 阅读 · 0 评论 -
Gale-Shapley 算法 寻找稳定婚配
14-6: Gale-Shapley 算法 寻找稳定婚配https://www.bilibili.com/video/BV1uq4y177Hc?spm_id_from=333.999.0.0from collections import dequedef find_free_partner(boys, girls, sort_boy_to_girl, sort_girl_to_boy): # 当前选择的舞伴 current_boys = dict(zip(boys.原创 2021-09-08 15:26:13 · 605 阅读 · 0 评论 -
opencv-python图像预处理后处理记录
1. image_array = cv2.imread(img_name, -1) if image_array.ndim == 2: image_array = cv2.cvtColor(image_array, cv2.COLOR_GRAY2BGR) image = Image.fromarray(image_array.astype('uint8')).convert('RGB')2.import osimport原创 2020-12-08 17:17:04 · 1055 阅读 · 0 评论 -
python-opencv-Rng随机数问题(解决方案python-cpp扩展复现)
我尝试用python复现,发现python没有uint,网上的ctypes也试了import cv2import numpy as npfrom enum import Enumfrom ctypes import c_uint64, c_uint32, c_ulong, c_uintclass RNG(object): #https://www.jb51.cc/python/533198.html #考虑到C溢出,如何在Python中使用64位无符号整数数学? #8原创 2020-12-07 15:33:11 · 954 阅读 · 0 评论 -
python合并bbox(heatmap定位)
参考:https://stackoverflow.com/questions/55593506/merge-the-bounding-boxes-near-by-into-one#Generate two text boxes a larger one that covers themdef merge_boxes(box1, box2): return [min(box1[0], box2[0]), min(box1[1], box2[1]), ma原创 2020-12-02 17:59:00 · 1213 阅读 · 0 评论 -
python-ndarray2cv::Mat以及cv::Mat2python-ndarray(python-cpp扩展)
1.opencv2https://github.com/yati-sagade/opencv-ndarray-conversionconversion.cppconversion.h#include <iostream>#include <opencv2/imgproc/imgproc.hpp>#include <boost/python.hpp>#include "conversion.h"namespace py = boost::pyt原创 2020-11-23 15:34:41 · 910 阅读 · 0 评论 -
MatchNet-Unifying Feature and Metric Learning for Patch-Based Matching的复现尝试
文件:common.py #和model_alexnet.py一起用,实现了一些基本网络模块的pytorch模块包model_alexnet.py #因为MatchNet网络改自alexnet,直接使用pytorch的改一下main_matchnet.py #主文件,含有指标评估函数--这个代码修改自官方的minist示例phototour.py #pytorch-dataset的文件,已经剥离出来utils.py#pytorch-dataset的文件,已经剥离出来使用pytor..原创 2020-11-03 19:41:16 · 886 阅读 · 1 评论 -
mmdetection的inference结果转换为labelme的json
mmdetection_inference_result2labelme-json.py# -*- coding:utf-8 -*-import ioimport osimport cv2import mmcvimport jsonimport argparseimport numpy as npimport pycocotools.mask as maskUtilsfrom mmdet.apis import init_detector, inference_detector, .原创 2020-10-27 14:48:42 · 2273 阅读 · 5 评论 -
python代码简写学习
res, nums, centers, points, max_dists, cluster_inds = dbscan(np.array(depcropmasked_cloud), eps=2, min_samples=10) if len(points) < 1: return 0.00 max_item = max([(len(key), idx) for idx, key in enumerate(points)], key=lambda x: x...原创 2020-10-29 15:09:51 · 178 阅读 · 0 评论 -
python 矩阵化求点和点集每个元素的欧式距离
参考matlab:%............................................function [D]=dist(i,x)% function: [D]=dist(i,x)%% Aim: % Calculates the Euclidean distances between i and all objects in x % % Input: % i - an object (1,n)% x - data matrix (m,n原创 2020-10-23 11:20:39 · 645 阅读 · 0 评论 -
Python-offer
https://github.com/leeguandong/Interview-code-practice-python/tree/master/%E5%89%91%E6%8C%87offerhttps://github.com/Dengshunge/Target-Offer66# -*- coding:utf-8 -*-'''剪绳子题目描述给你一根长度为n的绳子,请...原创 2019-10-22 19:34:58 · 351 阅读 · 0 评论 -
python2.7-matplotlib柱状图-中文label
参考文档:http://c.biancheng.net/view/2716.htmlhttps://blog.youkuaiyun.com/skldecsdn/article/details/79655569https://www.jianshu.com/p/01ed72b2aeeehttps://www.cnblogs.com/yunxiaofei/p/11116941.htmlhttp...原创 2019-07-05 13:02:17 · 2237 阅读 · 0 评论 -
python计算最小外接矩阵
python库能算MBR最小外接矩形GDAL库或者shapely的minimum_rotated_rectangle原创 2019-01-05 10:00:25 · 3606 阅读 · 0 评论 -
Eclipse+pydev环境搭建
eclipse运行慢经常卡死内存不足所以会卡死,配置一下eclipse.ini修改这几个值就好了-XX:MaxPermSize=768m-Xms1024m-Xmx3072m我电脑8G,修改成这样以后,从来都不卡,运行灰常流畅 ...原创 2018-11-04 21:13:56 · 180 阅读 · 0 评论 -
pycharm自动规范化代码配置
代码应该向规范化进行,但是偶尔我们换一个语言或者编译器,不知道规范是什么,可以通过插件来自动规范格式化代码 参考博客:autopep8-pycharm自动规范化代码配置https://blog.youkuaiyun.com/qq_27527961/article/details/80037853观察都有哪些版本,这里我们安装最新版的试一试pycharm添加工具条...原创 2018-07-27 15:48:19 · 10569 阅读 · 0 评论 -
python3+pyqt5详细介绍-附opencv
转载自博客:https://blog.youkuaiyun.com/qq_37541097/article/details/79143898关于python3下搭建pyqt5(pycharm)参考自简书:https://www.jianshu.com/p/344bdf61e69epyqt官方下载地址:https://sourceforge.net/projects/pyqt/files/PyQt5...转载 2018-07-24 10:04:37 · 4366 阅读 · 0 评论 -
Python调用C/C++模块
参考自博客:Python SIP使用总结(Win&Linux通用)https://blog.youkuaiyun.com/sunny2038/article/details/7237630PyQt5系列教程http://www.cnblogs.com/tkinter/p/5632188.html利用Swig在python中调用C/C++代码https://blog.csdn.n...原创 2018-07-27 14:47:07 · 749 阅读 · 0 评论