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 ...
随机推荐
- LINQ to Entities does not recognize the method 'System.DateTime AddDays(Double)' method, and this method cannot be translated into a store expression.
NormalSubmission=analysis.Count(x=>x.FinishTime<= endTime.AddDays(1))报错linq不能识别 => var endT ...
- Go 参数传递是传值还是传引用
什么是传值(值传递)? 传值的意思是:函数传递的总是原来这个东西的一个副本.一个副拷贝.比如我们传递一个 int 类型的参数,传递 的其实这个参数的一个副本:传递一个指针类型的参数,其实传递的是这个指 ...
- mysql基础篇(上篇)
一.数据库 1.数据库介绍 2.RDBMS专业术语 3.MySQL数据库 4.常用数据库命令 1.数据库介绍 :什么是数据库 数据库就是按照数据结构来组织.存储和管理数据的仓库. 我们常常讲的数据库往 ...
- 浏览器输入URL后,HTTP请求返回的完整过程
1.Redirect,跳转 浏览器记录里这个地址永久跳转的新地址,浏览器先去判断需不需要跳转 2.Application cache ,应用缓存 浏览器看请求的资源是否有缓存 3.DNS解 ...
- error CS1002: ; expected 错误解决
一般出现这种错误,大概原因是因为前端页面里的C#代码少个分号,或少个括号 导致编译器出错:仔细检查页面中的C#代码是否写的正确. 我之所以出现这个错误是因为前台页面中:@{ } 这里的代码少一个括号 ...
- Linux(例如CentOS 7)打开TCP 22端口,基于SSH协议
SSH 为 Secure Shell 的缩写,由 IETF 的网络工作小组(Network Working Group)所制定:SSH 为建立在应用层和传输层基础上的安全协议.SSH 是目前较可靠,专 ...
- vim实现实时自动保存
进https://www.vim.org/scripts/script.php?script_id=4521网站下载vim -auto-save wget https://www.vim.org/s ...
- 自己封装的一个类似axios的请求
下载:https://pan.baidu.com/s/1k0-CpGGtfDTsCm85NMfuHA 使用: axios({ method:'post', baseURL:baseAddress, u ...
- Django-models & QuerySet API
django中配置mysql数据库 1,首先配置settings.py. 一是在INSTALLED_APPS里面加入app名称: 二是配置数据库相关信息 INSTALLED_APPS = [ 'dja ...
- AJAX的简单解释
什么是AJAX AJAX = 异步 JavaScript 和 XML. AJAX 是一种用于创建快速动态网页的技术. 通过在后台与服务器进行少量数据交换,AJAX 可以使网页实现异步更新.这意味着可以 ...