文章分类 -  python

上一页 1 2 3 4 5 下一页

draw a bbox on an image
摘要:$ cat draw_bbox.py import os import cv2 label_dir = "./resize_label/" image_dir = "./resize_img/" for image in os.listdir(image_dir): #print(image) im 阅读全文

posted @ 2020-06-05 19:15 cdekelon 阅读(98) 评论(0) 推荐(0)

resize to 640x480 for labels
摘要:# cat resize_label_640_480_PIL.py import os import cv2 #import pandas as pd w = 640 h = 480 images = "./images/" for next_image in os.listdir(images): 阅读全文

posted @ 2020-06-05 18:30 cdekelon 阅读(72) 评论(0) 推荐(0)

delete the image which has no labels , coco2017
摘要:#!/usr/bin/env python # -*- coding: utf-8 -*- import os import shutil image_root = "./train2017" label_root = "./labels" no_label = "./no_label" image 阅读全文

posted @ 2020-06-05 17:20 cdekelon 阅读(66) 评论(0) 推荐(0)

How to draw a bbox into an image
摘要:image_cnt=0 class SSDDataAugmentation: def __init__(self, img_height=300, img_width=300, background=(123, 117, 104), labels_format={'class_id': 0, 'xm 阅读全文

posted @ 2020-06-04 18:14 cdekelon 阅读(57) 评论(0) 推荐(0)

print 和 print+format
摘要:>>> import numpy as np >>> a = np.array([[1,2,3],[4,5,6],[7,8,9]]) >>> a array([[1, 2, 3], [4, 5, 6], [7, 8, 9]]) >>> print("the label is",a) ('the la 阅读全文

posted @ 2020-06-04 18:11 cdekelon 阅读(54) 评论(0) 推荐(0)

read 所有文件的内容
摘要:import os link = "./" for i in os.listdir(link): with open(i, "r") as f: #f.read() for line in f.readlines(): line = line.strip() print(line) 阅读全文

posted @ 2020-05-05 12:25 cdekelon 阅读(77) 评论(0) 推荐(0)

把所有dw的shell文件都转成pw
摘要:import os import shutil link = './' target = "./pw/" for i in os.listdir(link): if i.endswith('.sh'): print(i) new = i.replace("dw","pw") print(new) i 阅读全文

posted @ 2020-05-05 12:20 cdekelon 阅读(60) 评论(0) 推荐(0)

修改所有pw.sh 并把里面的字符串“dw”都换成“pw”
摘要:import os link = './' def alter(file,old_str,new_str): file_data = "" with open(file, "r" ) as f: for line in f: if old_str in line: line = line.repla 阅读全文

posted @ 2020-05-05 12:18 cdekelon 阅读(55) 评论(0) 推荐(0)

convert jpg to png
摘要:https://datatofish.com/jpeg-to-png-python/ from PIL import Image import os jpg_dir = "./2020_jpg/" png_dir = "./2020_png/" for f in os.listdir(jpg_dir 阅读全文

posted @ 2020-03-29 19:08 cdekelon 阅读(55) 评论(0) 推荐(0)

find class quantities in for each tfrecord of coco
摘要:import tensorflow as tf import os tf_dir = './tfrecords_304_304_PIL_test' tf_list = [os.path.join(tf_dir,f) for f in os.listdir(tf_dir) ] print("tfrec 阅读全文

posted @ 2020-02-09 23:43 cdekelon 阅读(38) 评论(0) 推荐(0)

hdf5 check weights
摘要:.>>> import h5py >>> file_name = "resnet_003.hdf5" >>> f = h5py.File(file_name, 'r') >>> group=f["model_weights"] >>> for key in group.keys(): ... pri 阅读全文

posted @ 2020-01-21 12:52 cdekelon 阅读(100) 评论(0) 推荐(0)

shutil copy file to folder
摘要:from __future__ import print_function import tensorflow as tf import os import shutil tf_dir = '../generate_tfrecord_by_me_part' tf_list = [os.path.jo 阅读全文

posted @ 2020-01-06 15:50 cdekelon 阅读(95) 评论(0) 推荐(0)

find different components of two folders, mv some files out
摘要:# cat check_no_label_jpg.py import os import shutil tf_dir = './JPEG_half' label_dir = './label' r = [] no_label_jpg = "./no_label_jpg/" #tf_list = [o 阅读全文

posted @ 2020-01-03 16:53 cdekelon 阅读(62) 评论(0) 推荐(0)

import 来源
摘要:https://blog.csdn.net/lanchunhui/article/details/70160039 >> import iva >> iva.__file__ '/usr/local/lib/python2.7/dist-packages/iva/__init__.pyc' http 阅读全文

posted @ 2019-11-27 14:20 cdekelon 阅读(64) 评论(0) 推荐(0)

1.jpg 变成00001.jpg 字符串用zfill, print用:0>5d
摘要:~/dataset/flir_dataset/FLIR_ADAS_1_3/train$ cat 1028.py import json js_file = './thermal_annotations.json' CLASS_NAME_MAP = { 1:'person', 2:'bicycle', 阅读全文

posted @ 2019-11-08 13:02 cdekelon 阅读(187) 评论(0) 推荐(0)

去掉列表的两个中括号
摘要:import json js_file = './thermal_annotations.json' with open(js_file,'r') as f: js = json.load(f) #print(label) label_info = js['info'] print(label_in 阅读全文

posted @ 2019-11-07 17:13 cdekelon 阅读(528) 评论(0) 推荐(0)

哈希
摘要:http://icejoywoo.github.io/2019/03/16/python-unhashable-type-error.html google: TypeError: unhashable type 为什么这三个类型是不支持哈希的?从哈希计算的方法上我们可以知道,对于可变的类型计算哈希 阅读全文

posted @ 2019-10-09 16:52 cdekelon 阅读(68) 评论(0) 推荐(0)

多维数组,两种效果
摘要:https://blog.csdn.net/u013733326/article/details/78096511 阅读全文

posted @ 2019-08-27 01:21 cdekelon 阅读(74) 评论(0) 推荐(0)

装饰器
摘要:装饰器(decorator)可以给函数动态加上功能。 对于类的方法,装饰器一样起作用。Python内置的@property装饰器就是负责把一个方法变成属性。 直观点,搞了实例后,调用方法可以不加括号()。 另: https://blog.csdn.net/guofeng_hao/article/de 阅读全文

posted @ 2019-08-12 15:50 cdekelon 阅读(69) 评论(0) 推荐(0)

理解 python class的 self
摘要:https://www.w3schools.com/python/python_classes.asp The self parameter is a reference to the current instance of the class, and is used to access vari 阅读全文

posted @ 2019-07-04 11:22 cdekelon 阅读(129) 评论(0) 推荐(0)

上一页 1 2 3 4 5 下一页

导航