随笔分类 -  python

摘要:python 文件太多打不开文件夹,取样少量的文件, 建立同样的文件目录结构 1. 在文件夹旁边新建文件夹 import os import shutil import random root_file = "/media/algo/data_1/everyday/20230203-有大文件/sno 阅读全文
posted @ 2023-02-05 23:54 无左无右 阅读(32) 评论(0) 推荐(0) 编辑
摘要:import os dir_txt = "data/demo/" txt_path_List = [] cnt_2 = 0 g = os.walk(dir_txt) for path, d, filelist in g: for filename in filelist: if filename.e 阅读全文
posted @ 2023-02-02 16:06 无左无右 阅读(71) 评论(0) 推荐(0) 编辑
摘要:import numpy as np predict = np.random.rand(7, 3) gt = np.random.randint(0, 3, (7, 1)) # [[0.86111937 0.17885014 0.15346783] # [0.18914942 0.55776159 阅读全文
posted @ 2023-01-16 16:34 无左无右 阅读(49) 评论(0) 推荐(0) 编辑
摘要:#python 读取文本: ##方法1: with open(txt_path, "r") as fr: lines = fr.readlines() for line in lines: line = line.strip() #去除换行符 \n ##方法2: f = open("tmp2.txt 阅读全文
posted @ 2023-01-10 10:23 无左无右 阅读(105) 评论(0) 推荐(0) 编辑
摘要:import time str_time_now = time.strftime("%Y-%m-%d_%H:%M:%S", time.localtime()) ##2023-01-10_09:58:33 2023-01-10_09:58:33 用str_time_now可以很方便的嵌入到文件名中,方 阅读全文
posted @ 2023-01-10 10:00 无左无右 阅读(104) 评论(0) 推荐(0) 编辑
摘要:根据caffe训练打印的 I1102 20:42:49.268401 188 solver.cpp:352] Iteration 135020 (0.108123 iter/s, 92.4871s/10 iter), 114.5/13668.5ep, loss = 0.0899582 提取itera 阅读全文
posted @ 2022-11-04 14:39 无左无右 阅读(21) 评论(0) 推荐(0) 编辑
摘要:不打印如下信息 I1028 09:21:03.110215 5174 net.cpp:338] pool1 does not need backward computation. I1028 09:21:03.110217 5174 net.cpp:338] conv1_2/relu does no 阅读全文
posted @ 2022-10-28 09:21 无左无右 阅读(24) 评论(0) 推荐(0) 编辑
摘要:import cv2 import os import numpy as np path_dir = "/data_1/everyday/20221014/pic/18-19-20/" list_img = os.listdir(path_dir) cnt = 0 contrast = 0 brig 阅读全文
posted @ 2022-10-25 10:44 无左无右 阅读(60) 评论(0) 推荐(0) 编辑
摘要:import os from PIL import Image def image_Splicing(img_1, img_2, img_3, flag='x'): img1 = Image.open(img_1) img2 = Image.open(img_2) img3 = Image.open 阅读全文
posted @ 2022-10-17 14:47 无左无右 阅读(48) 评论(0) 推荐(0) 编辑
摘要:##简单demo,速度提升100倍。 跑kdtree的网上的demo,速度提升100倍,被这个惊艳到! import time import numpy import scipy.spatial def find_index_of_nearest_xy(y_array, x_array, y_poi 阅读全文
posted @ 2022-06-13 11:41 无左无右 阅读(95) 评论(0) 推荐(0) 编辑
摘要:本代码python opencv运行,用鼠标在原图上面依次左击点三个点,左上,左下,右下。然后设定固定窗口大小,比如384128大小。 就是把在原图上面点击的三个点映射到384128大小图像上来。不管你原图选中多大面积的图像都会映射到我们设定的大小上面来。 这里就是仿射变换的原理映射。通过三对点映射 阅读全文
posted @ 2022-05-01 17:35 无左无右 阅读(115) 评论(0) 推荐(0) 编辑
摘要:本文官方链接https://www.cnblogs.com/yanghailin/p/15603194.html,未经授权勿转载 理解 LSTM 网络 https://www.jianshu.com/p/9dc9f41f0b29 Understanding LSTM Networks https:/ 阅读全文
posted @ 2021-11-25 16:12 无左无右 阅读(145) 评论(0) 推荐(0) 编辑
摘要:0.两个txt对比精度 import numpy as np name = "fc1x_a" path_pytorch_txt = "/data_1/everyday/1123/img_acc/libtorch_img.txt" path_caffe_txt = "/data_1/everyday/ 阅读全文
posted @ 2021-11-23 15:58 无左无右 阅读(51) 评论(0) 推荐(0) 编辑
摘要:python最开始这行加了 -*- coding: utf-8 并且print("你好"),是可以打印出来的。 chn_tab = ["啊","阿"] rec = "" for predict_label in pos: if predict_label != blank_label and pre 阅读全文
posted @ 2021-11-22 18:11 无左无右 阅读(375) 评论(0) 推荐(0) 编辑
摘要:测试的目录结构如下: . ├── 1.txt ├── 2.txt ├── a │ ├── 3.txt │ ├── d │ └── e ├── b │ ├── 4.txt │ ├── 7.txt │ ├── f │ │ └── 5.txt │ └── h └── c └── 5.txt 7 direc 阅读全文
posted @ 2021-07-23 11:50 无左无右 阅读(63) 评论(0) 推荐(0) 编辑
摘要:定义的网络,有三个模块组成: class RecModel(nn.Module): def __init__(self, config): super().__init__() assert 'in_channels' in config, 'in_channels must in model co 阅读全文
posted @ 2021-05-26 19:27 无左无右 阅读(365) 评论(0) 推荐(0) 编辑
摘要:就是我有一批标注好的color图,那个类别用不同像素来表示。现在我只需要这批数据的4类。其他类别都不需要了。 任务就是把color图上所需要的类别转为灰度标签图。 其实也简单,知道每个类别对应的颜色了,那么就构造同等大小的灰度图,相应颜色就置为相应类别。举例如下: 比如猫😺的颜色是[255,0,1 阅读全文
posted @ 2021-05-22 19:00 无左无右 阅读(253) 评论(0) 推荐(0) 编辑
摘要:example_1 import numpy as np import cv2 import os color_segmentation=np.asarray([ [0,0,0], #[0]背景 [180,120,120], [6,230,230], [80,50,50], [4,200,3], [ 阅读全文
posted @ 2021-05-13 11:05 无左无右 阅读(95) 评论(0) 推荐(0) 编辑
摘要:以下是为了训练识别,轻微的数据增强方法 import os import cv2 import numpy as np import random def colorjitter(img): ''' ### Different Color Jitter ### img: image cj_type: 阅读全文
posted @ 2021-05-07 20:11 无左无右 阅读(64) 评论(0) 推荐(0) 编辑
摘要:from PIL import Image,ImageDraw,ImageFont image = Image.open("/data_2/dog1.jpg") text = "仅供授权证明用,他用无效 \n有效期:20210401-20210430" font=ImageFont.truetype 阅读全文
posted @ 2021-04-01 10:52 无左无右 阅读(101) 评论(0) 推荐(0) 编辑