- 博客(111)
- 资源 (12)
- 收藏
- 关注
原创 pip is configured with locations that require TLS/SSL, however the ssl module in Python is not avail
sudo apt-get install opensslsudo apt-get install libssl-dev查阅资料发现,在./configure过程中,如果没有加上–with-ssl参数时,默认安装的软件涉及到ssl的功能不可用,刚好pip3过程需要ssl模块,而由于没有指定,所以该功能不可用。解决办法是重新对python3.6进行编译安装,用一下过程来实现编译安装:cd Python-3.6.5./configure --with-sslmakesudo make instal
2021-11-08 11:50:40
1894
原创 Mac M1 安装TensorFlow. python=3.8
Miniforge3-MacOSX-arm64.sh创建环境conda create -—name python38 python=3.8激活环境conda activate python38下载Apple提供的tensorflow支持下载地址:https://github.com/apple/tensorflow_macos/releases,选择tar.gz的包下载。安装pip install --force pip==20.2.4 wheel setuptools cached-pr
2021-10-09 17:27:59
654
2
原创 python 图像修复
import numpy as npimport matplotlib.pyplot as pltimport pylabfrom skimage.io import imread, imsavefrom skimage.color import rgb2gray# from skimage.util import img_as_floatfrom skimage import img_as_floatfrom skimage.restoration import inpaintimage
2021-08-31 16:12:49
2065
原创 python无缝克隆和泊松图像编辑
import cv2import numpy as npsrc = cv2.imread('9781789343731_Code/images/plane.png')dst = cv2.imread('9781789343731_Code/images/sea.jpg')cv2.imshow('s', src)cv2.waitKey(0)print(src.shape, dst.shape)src_mask = cv2.imread('9781789343731_Code/images/bl
2021-08-31 15:47:50
575
2
原创 python 使用接缝雕刻移除目标(dog)
import pylabfrom skimage.io import imreadfrom skimage.color import rgb2grayfrom skimage import transform, util, filters, colorimport cv2from PIL import Imageimage = cv2.imread('./9781789343731_Code/images/man2.png')[:,:,::-1]mask_image = rgb2gray(i
2021-08-31 14:42:50
299
1
原创 python opencv实现神经风格迁移
import cv2import matplotlib.pylab as pltimport imutilsimport timeimport numpy as npimport pylabmodel = 'starry_night.t7'print('loading style transfer model...')net = cv2.dnn.readNetFromTorch(model)image = cv2.imread('./monalisa.jpg')image = i
2021-08-31 10:59:48
423
原创 python迁移学习 图像分类
import numpy as npfrom keras.applications import VGG16, ResNet50from keras.preprocessing.image import ImageDataGeneratorfrom keras import models, layers, optimizersfrom keras.layers.normalization import BatchNormalizationfrom keras.preprocessing.image
2021-08-30 21:11:48
341
原创 KNN模型MNIST数据集分类
import gzip, os, sysimport numpy as npimport pylabfrom scipy.stats import multivariate_normalfrom urllib.request import urlretrieveimport matplotlib.pyplot as pltdef download(filename, source='http://yann.lecun.com/exdb/mnist/'): print('Download
2021-08-26 11:42:34
205
原创 PCA与特征脸
import matplotlib.pyplot as pltfrom sklearn.datasets import fetch_olivetti_facesimport numpy as npfaces = fetch_olivetti_faces().dataprint(faces.shape)fig = plt.figure(figsize=(5,5))plt.subplots_adjust(left=0, right=1, bottom=0, top=1, hspace=0.05,
2021-08-26 09:57:04
204
原创 图像分割谱聚类算法
import numpy as npfrom sklearn import clusterfrom skimage.io import imreadfrom skimage.color import rgb2grayfrom scipy.misc import imresizeimport matplotlib.pyplot as pltim = imresize(imread('./9781789343731_Code/images/banana.png'), (100, 100, 3))
2021-08-25 15:19:07
728
原创 基于图像分割与颜色量化的K均值聚类
import numpy as npimport matplotlib.pylab as pltfrom sklearn.cluster import KMeansfrom sklearn.metrics import pairwise_distances_argminfrom skimage.io import imreadfrom sklearn.utils import shufflefrom skimage import img_as_floatfrom time import tim
2021-08-25 14:50:27
221
原创 python opencv基于HOG-SVM行人检测
import numpy as npimport cv2import matplotlib.pylab as pltimg = cv2.imread('./9781789343731_Code/images/66.jpg')hog = cv2.HOGDescriptor()hog.setSVMDetector(cv2.HOGDescriptor_getDefaultPeopleDetector())(foundBoundingBoxes, weights) = \ hog.detec
2021-08-23 10:39:05
389
原创 opencv haar人脸 眼睛检测
import cv2opencv_haar_path = './haarcascades/'face_cascade = cv2.CascadeClassifier(opencv_haar_path + 'haarcascade_frontalface_alt.xml')eye_cascade = cv2.CascadeClassifier(opencv_haar_path +
2021-08-20 14:55:40
156
原创 python利用开闭运算实现指纹清洗
from skimage.color import rgb2grayfrom skimage.io import imreadimport numpy as npfrom skimage.morphology import binary_opening,\ binary_closing, disk, binary_erosion, binary_dilation, squareimport matplotlib.pyplot as pltim = rgb2gray(imread('./
2021-08-19 19:02:07
305
原创 python 填充二值对象孔洞
import pylabfrom scipy.ndimage.morphology import binary_fill_holesfrom skimage.io import imreadfrom skimage.color import rgb2grayimport matplotlib.pylab as pltimport numpy as npim = rgb2gray(imread('./9781789343731_Code/images/text.png'))im[im <
2021-08-19 15:59:36
1390
1
原创 python 凸包
from skimage.morphology import convex_hull_imagefrom skimage.color import rgb2grayfrom skimage.io import imreadimport pylabimport numpy as npdef plot_image(image, title=''): pylab.title(title, size=20), pylab.imshow(image) pylab.axis('off')#
2021-08-19 15:35:22
218
原创 python 开闭运算、腐蚀膨胀
from skimage.morphology import binary_opening, binary_closing, disk, binary_erosion, binary_dilationfrom skimage.util import invertfrom skimage.color import rgb2grayfrom skimage.io import imreadimport numpy as npimport matplotlib.pyplot as pltim = r
2021-08-19 14:59:10
378
原创 python 基于金字塔的图像融合
图像A(苹果)图像B(橙子)拉普拉斯金字塔的两幅图像融合from skimage import img_as_floatfrom skimage.io import imreadimport numpy as npfrom skimage.transform import pyramid_reduce, pyramid_laplacian, pyramid_expand, resizeimport matplotlib.pylab as pltdef get_gaussian_pyramid
2021-08-18 15:34:10
994
1
原创 PIL的point()函数进行二值化处理
import pylabfrom PIL import Image, ImageEnhancefrom skimage import img_as_ubyte, img_as_floatimport numpy as npdef plot_image(image, title=""): # pylab.gray() pylab.title(title, size=20) pylab.imshow(image, cmap='gray') # image.show()
2021-08-17 14:20:50
1336
原创 python opencv 车道线检测图片---and---视频
import cv2import numpy as np# 步骤1:边缘检测def canyEdgeDetector(image): edged = cv2.Canny(image, 50, 150) return edged# 步骤2:定义ROI(感兴趣区域)def getROI(image): height = image.shape[0] width = image.shape[1] # Defining Triangular ROI: The.
2021-08-16 18:03:10
589
原创 python opencv 将lena图像嵌入空白画布处
import cv2import matplotlib.pyplot as pltimport numpy as nppath = "./temp(1)/temp/src.jpg"threshold = 80读取图像img = cv2.imread(path)img = img[:,:,::-1]img.shapeplt.imshow(img)plt.axis('off')plt.show()# 转化灰度img_gray = cv2.cvtColor(img, cv2.C
2021-08-13 19:25:54
1882
1
原创 使用Python进行图像读取、保存、显示
1.使用PIL进行读取、保存、显示from PIL import Imageim = Image.open('9781789343731_Code/images/parrot.png')print(im.width, im.height, im.mode, im.format, type(im))# 486 362 RGB PNG <class 'PIL.PngImagePlugin.PngImageFile'>im.show()# 彩色图像转化为灰度图像img_g = im.
2021-08-12 13:55:33
834
原创 c++指针
# 指针数组函数实现冒泡排序案例#include<iostream>using namespace std;void bubblesort(int *arr, int len) { for (int i = 0; i < len-1 ; i++) { for (int j = 0; j < len - i - 1; j++) { if (arr[j] > arr[j + 1]) { int temp = arr[j]; ar...
2021-08-10 11:31:34
74
原创 python 二叉树
class Node: def __init__(self, val=None, left=None, right=None): self.val = val self.left = left self.right = rightclass Tree: def __init__(self, node=None): self.root = node def add(self, item=None):
2021-07-28 10:41:21
64
原创 python 栈
class Stack: def __init__(self): self.data = [] def __len__(self): return len(self.data) def is_empty(self): return len(self.data) == 0 def push(self, d): self.data.append(d) def gettop(self):
2021-07-28 10:39:52
48
原创 python队列
class Queue: def __init__(self): self.list = [] def enqueue(self, item): # 入队列 self.list.append(item) def dequeue(self): # 出队列 self.list.pop(0) # 先进先出 def is_empty(self): return self.list == [] de
2021-07-28 10:39:05
61
原创 python 链表
# 节点类class Node: def __init__(self, data): self.data = data self.next = None return def has_value(self, value): if self.data == value: return True else: return False# 单链表类# 1.初始化
2021-07-27 11:43:17
61
原创 python 数组的基本结构
# 增加 appendA = [1, 2, 3, 4]A.append(5) # 在数组末尾追加元素print(A)# 删除 remove pop delA = [1, 2, 3, 4, 5, 1]A.remove(1) # 用于移除列表中某个值的第一个匹配项# print(A.remove(1)) Noneprint(A)# popA = [1, 2, 3, 4, 5]A.pop()print(A.pop()) # 4print(A) # [1, 2, 3]pr
2021-07-27 11:04:22
213
原创 resnet18 图像可视化分析
import torch.nn as nnimport numpy as npimport matplotlib.pyplot as pltimport torch.nn.functional as Fimport torchfrom PIL import Imagefrom torchvision import transformsfrom torchvision.models import resnet18class ResBlock(nn.Module): def __..
2021-07-22 15:49:27
1469
1
原创 手动实现convolution
import matplotlib.pyplot as pltimport numpy as npdef convolution(image, op): h = image.shape[0] - op.shape[0] + 1 w = image.shape[1] - op.shape[1] + 1 res = np.zeros(shape=(h, w)) for hh in range(h): for ww in range(w):
2021-07-21 18:47:27
140
1
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人