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 ...
随机推荐
- Qt源码学习之信号槽
Qt源码版本 Qt 5.12.0 moc文件 Qt在编译之前会分析源文件,当发现包含了Q_OBJECT宏,则会生成另外一个标准的C++源文件(包含Q_OBJECT宏实现的代码,文件名为moc_+原文件 ...
- 生信工具汇总--OMICtools
各种生信工具: https://omictools.com/
- 小程序使用阿里巴巴TTF字体文件以及图标
转话地址https://transfonter.org 第一步:下载需要的字体图标 进入阿里图标官网http://iconfont.cn/搜索自己想要的图标,如这里需要一个购物车的图标,流程为: 搜索 ...
- 微信小程序点击列表添加 去除属性
首先说一下场景:我所循环的数据是对象数组,设置了一个属性当作标记,通过这个标记的值判断是否给改元素添加样式 wxml: <view> <view wx:for="{{lis ...
- jmeter 上传附件 如图片
1.要勾选 Use multipart/form-data for POST,否则request中将不包含上传的文件 2.MIME类型为application/octet-stream 图如下:对应 ...
- Android测试(二)——adb常用命令
连接设备: 安装应用包apk文件: adb install apk文件 卸载应用: adb uninstall 包名 将设备中的文件放到本地: adb pull 设备文件目录 本地文件目录 将本地文件 ...
- 【js】【图片显示】js控制html页面显示图片方式
js控制html页面显示图片方式,只需要引入“jquery-1.11.2.min.js” js: /* 引用 <script src="jquery-1.11.2.min.js&quo ...
- python--个人信息修改程序
创建一个新的文本,account.txt,输入以下个人信息内容, lanyinhua,lanyinhua,蓝银花,22,Model,PR,22alex,123,华仔 Li,222,CEO,IT,133 ...
- C语言实现过滤ASCII在0~127范围内的字符,并去除重复的字符
#include <stdio.h> #include <string.h> /* 1.以字符串作为参数 2.找出ASCII在1~127范围内的字符 3.去掉重复字符 */ i ...
- python----数据驱动@ddt.file_data结合yaml文件的使用
一.创建yaml文件1. 安装yaml模块 pip install pyyaml2. 新建yaml文件 右键任意文件夹-->New-->File,输入文件名并以.yaml或.yml结尾 二 ...