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 ...
随机推荐
- 调用Bytom Chrome插件钱包开发Dapp
安装使用插件钱包 1. 打开Google浏览器的应用商店,搜索Bystore 下载链接:http://t.cn/E6cFFwb 2. 然后点击添加到Chrome,就可以添加到我们的: 3. 使用goo ...
- shell date命令
date命令的语法结构: date [-d][时间运算] [+FORMAT] 先说简单的,[+FORMAT] 部分,主要有如下输出格式: 时间方面: %H : 小时(00..23) %I : 小时(0 ...
- 在线批量将gps经纬度坐标转换为百度经纬度坐标
1.首先打开百度api示例页面: 在浏览器地址栏中输入:http://developer.baidu.com/map/jsdemo.htm#a5_3 2.修改代码 如下图,将需要批量转换的坐标,按规则 ...
- 一张图了解Spring Cloud微服务架构
Spring Cloud作为当下主流的微服务框架,可以让我们更简单快捷地实现微服务架构.Spring Cloud并没有重复制造轮子,它只是将目前各家公司开发的比较成熟.经得起实际考验的服务框架组合起来 ...
- golang相关书签
https://www.zhihu.com/question/30461290 golang资料精选汇编
- Postman中x-www-form-urlencoded请求K-V的ajax实现
在Postman中使用x-www-form-urlencoded,并且用K-V传值,但是在代码中用ajax来请求,传值一直有问题,静下心来思考才发现K-V传入的是string,所以记录下来以防忘记!! ...
- 可迭代对象 TO 迭代器
可迭代对象并不是迭代器,只是支持迭代.可被for循环遍历的对象,比如list,dict ,tuple ,string都是可迭代对象 那既然支持迭代,那要如何用迭代替换for循环呢? 内置函数 iter ...
- chrome浏览器模拟手机端:jquery click()点击无效解决方法
$(".sku-wrap .ok").click(); chrome浏览器模拟手机端,在油猴插件中写JS代码,然后发现click()点击失效. 解决方法:jquery的click( ...
- 爬虫(七)图片懒加载技术、selenium和PhantomJS
动态数据加载处理 一.图片懒加载 什么是图片懒加载? 案例分析:抓取站长素材http://sc.chinaz.com/中的图片数据 #!/usr/bin/env python # -*- coding ...
- postman-SSL证书问题-支持HTTPS请求
使用Google接口调试插件postman请求https协议的接口,postman提示: 为此,需要解决这个问题,提示信息已经给出了解决方案!Using self-signed SSL certifi ...