Write CSV file for a dataset
import numpy as np
import cv2 as cv2
import os
import csv dataste_path = 'datasets/pascal-parts/pascal/data'
dirs= os.listdir(dataste_path)
with open("datasets/pascal-parts/pascal/test.csv","w") as csvfile:
writer = csv.writer(csvfile)
writer.writerow(["source_image","target_image"])
for direc in dirs:
if not direc.startswith('.'):
print('')
file_list = list()
files = os.listdir(os.path.join(dataste_path,direc))
for file in files:
if file.endswith('.jpg') and not file.startswith('.') and file[0].isdigit():
file_name = os.path.join('pascal/data',direc,file)
file_list.append(file_name)
for i in range(len(file_list)):
for j in range(len(file_list)):
if(i == j):
continue
else:
writer.writerow([file_list[i],file_list[j]])
else: print('')
Write CSV file for a dataset的更多相关文章
- save tracking results into csv file for oxuva long-term tracking dataset (from txt to csv)
save tracking results into csv file for oxuva long-term tracking dataset (from txt to csv) 2019-10-2 ...
- ogr2ogr: Export Well Known Text (WKT) for one feature to a CSV file
Perhaps you’re looking for this? ogr2ogr -f “CSV” “E:\4_GIS\NorthArkCartoData\UnitedStates\MO_wkt” “ ...
- C# - CSV file reader
// ------------------------------------------------------------------------------------------------- ...
- SQL SERVER – Import CSV File Into SQL Server Using Bulk Insert – Load Comma Delimited File Into SQL Server
CSV stands for Comma Separated Values, sometimes also called Comma Delimited Values. Create TestTabl ...
- [PowerShell Utils] Create a list of virtual machines based on configuration read from a CSV file in Hyper-V
Hello everyone, this is the third post of the series. . Background =============== In my solution, ...
- Qt Read and Write Csv File
This page discusses various available options for working with csv documents in your Qt application. ...
- Python: Write UTF-8 characters to csv file
To use codecs, we can write UTF-8 characters into csv file import codecs with open('ExcelUtf8.csv', ...
- Powercli随笔 - PowerCLI script to sequentially Storage vMotion VMs from a CSV File
PowerCLI script to sequentially Storage vMotion VMs from a CSV File This is a PowerCLI script that I ...
- Csharp--Read Csv file to DataTable
在网上找的资料都不怎么好使,许多代码一看就知道根本没有考虑全面. 最后找到一个好用的,在codeproject上,这位老兄写成了一个framework,太重了. http://www.codeproj ...
随机推荐
- centOS 及 ubuntu 下载地址记录
CentOS下载地址: http://isoredirect.centos.org/centos/7/isos/x86_64/CentOS-7-x86_64-DVD-1611.iso : ubu ...
- 【搬运工】mysql用户权限设置
关于mysql的用户管理,笔记 1.创建新用户 通过root用户登录之后创建 >> grant all privileges on *.* to testuser@localhost id ...
- 修改vim的颜色主题 及显示行号
1.打开vim窗口,输入命令:color 或者colorscheme后回车查看当前颜色主题. 2. 输入:colorscheme <主题> 即可设置当前vim的颜色主题. sample: ...
- jsp servlet table 集合list 数据 绑定
删除 前端
- Vue-admin工作整理(二):项目结构个人配置
通过上一篇文章(Vue-admin工作整理(一):项目搭建)操作完毕后,基础项目已经搭建,下面就要对项目本身进行一下项目结构调整来符合自己的项目要求 1.首先要对package.json文件进行调整, ...
- 如何查找redis使用的是哪个配置文件
ps -ef|grep redis 得到了进程号 xxxx 然后 ls -l /proc/xxxx/cwd ps:可以推广到其他进程,只要有pid,就能找到配置文件
- 二、Python数据类型(一)
一.Python的基本输入与输出语句 (一)输出语句 print() 示例: print('你好,Python') print(4+5) a = 10 print(a) 输出的内容可以是字符串,变量, ...
- Pandas 基础(14) - DatetimeIndex and Resample
这一小节要介绍两个内容, 一个是 DatetimeIndex 日期索引, 另一个是 Resample, 这是一个函数, 可以通过参数的设置, 来调整数据的查询条件, 从而得到不同的结果. 首先看下关于 ...
- time to set up Goals
Function Goal Training for new guys, meanings who takes part of QA jobs and make other QA members g ...
- load data导txt文件进mysql中的数据
1.实验内容: 利用SQL语句“load data ”将“.txt”文本文件中的数据导入到mysql中 2.实验过程: 首先我创了一个txt(也可以是其他的),设置其编码为utf-8,在windows ...