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 ...
随机推荐
- Valse2019笔记——弱监督视觉理解
程明明(南开大学):面向开放环境的自适应视觉感知 (图片来自valse2019程明明老师ppt) 面向识别与理解的神经网络共性技术 深度神经网络通用架构 -- VggNet(ICLR'15).ResN ...
- 安装linux14.04
一.制作Ubuntu启动盘 1.将空的优盘格式化当做启动盘,下载UltralSO并安装,安装成功后打开,点击工具栏中的第二个打开镜像文件工具(或通过文件-打开的方式打开),选择下载好的Ubuntu镜像 ...
- bug日记之---------js中调用另一个js中的有ajax的方法, 返回值为undefind
今天做一个OCR授权的需求, 需要开发一个OCR弹框, 让用户选择是否授权给第三方识别公司(旷世科技)保存和识别用户个人信息, 照片等. 其中用到了在一个js的方法中调用另外一个js的方法, 其中有一 ...
- myeclipse编码问题
在中文操作系统中,Eclipse中的Java类型文件的编码的默认设置是GBK, 但是对Properties资源文件的编码的默认设置是ISO-8859-1. 所以编辑Java文件中的中文不会出现问题,但 ...
- eclipse报错:Multiple annotations found at this line: - String cannot be resolved to a type解决方法实测
Multiple annotations found at this line:- String cannot be resolved to a type- The method getContext ...
- 利用GSEA对基因表达数据做富集分析
image Gene Set Enrichment Analysis (GSEA) is a computational method that determines whether an a p ...
- HTML5外包注意事项-开发HTML5游戏的九大坑与解决方法剖析
随着移动社区兴起,势必带动HTML5的革命.未来一两年内,HTML5移动游戏必将呈现大爆发趋势. 以下是整理的HTML5游戏研发.市场趋势以及渠道布局和技术解决方案的内容.希望大家能从本文中找到对HT ...
- Vnpy官网汇总
Vnpy首页:http://www.vnpy.cn/ Vnpy社区:https://www.vnpy.com/ Vnpy论坛:http://www.vnpie.com/forum.php Github ...
- nginx的前世今生
Nginx最初的设计是称为一个http服务器,一个能够解决C10K问题的http服务器. 那么问题来了,什么是C10K呢?C10K问题即(单机10万个并发链接问题),这个概念最早是由Dan Kegel ...
- Lambd Expression
“Lambda 表达式”(lambda expression)是一个匿名函数,Lambda表达式基于数学中的λ演算得名,直接对应于其中的lambda抽象(lambda abstraction),是一个 ...