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的更多相关文章

  1. 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 ...

  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” “ ...

  3. C# - CSV file reader

    // ------------------------------------------------------------------------------------------------- ...

  4. 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 ...

  5. [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, ...

  6. Qt Read and Write Csv File

    This page discusses various available options for working with csv documents in your Qt application. ...

  7. 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', ...

  8. 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 ...

  9. Csharp--Read Csv file to DataTable

    在网上找的资料都不怎么好使,许多代码一看就知道根本没有考虑全面. 最后找到一个好用的,在codeproject上,这位老兄写成了一个framework,太重了. http://www.codeproj ...

随机推荐

  1. c# mongodb drive IngoreExtraElements and RegisterClassMap

    private static void RegisterClassMaps(IEnumerable<Type> clrTypes) { foreach (var clrType in cl ...

  2. 说说Python中的闭包

    Python中的闭包不是一个一说就能明白的概念,但是随着你往学习的深入,无论如何你都需要去了解这么一个东西. 闭包的概念 我们尝试从概念上去理解一下闭包. 在一些语言中,在函数中可以(嵌套)定义另一个 ...

  3. wireshark基础学习—第一部分wireshark的基础知识

    1.Wireshark主窗口 Wireshark的主窗口如下所示 2.每个面板的内容 Packet List(数据包列表): 最上面的面板用表格显示了当前不惑文件中的所有数据包,其中包括了数据包序号. ...

  4. springboot与Mybatis结合

    一:使用generator,关联上数据库生成相关文件, 如 mapping/UserMapper.xml,mapper/UserMapper.java,model/User.java; generat ...

  5. Http 状态码:

    消息 100 Continue 101 Switching Protocols 102 Processing 成功 200 OK 201 Created 202 Accepted 203 Non-Au ...

  6. Visual Studio color schemes

    Vs环境主题配置 下载地址:https://studiostyl.es/ Son of Obsidian 下载:son-of-obsidian_vs2015.zip Litle monokai vst ...

  7. c++ 线程间通信方式

    一:两个进程间的两个线程通信,相当于进程间通信 二:一个进程中的两个线程间通信 通信方式: 1.互斥锁 mutex; lock_guard (在构造函数里加锁,在析构函数里解锁) unique_loc ...

  8. NetSec2019 20165327 Exp3 免杀原理与实践

    NetSec2019 20165327 Exp3 免杀原理与实践 pre基础问题回答 一.免杀原理 一般是对恶意软件做处理,让它不被杀毒软件所检测.也是渗透测试中需要使用到的技术. 要做好免杀,就时清 ...

  9. idea在本地调试,spark创建hiveContext的时候报错

    spark版本:1.6.1 scala版本:2.10 问题呢场景: 在idea调试本地程序的时候创建hiveContext报错,上午的时候是没有这个问题的,下午在项目中写了一个小deamon,出现了而 ...

  10. selenium、UA池、ip池、scrapy-redis的综合应用案例

    案例: 网易新闻的爬取: https://news.163.com/ 爬取的内容为一下4大板块中的新闻内容 爬取: 特点: 动态加载数据  ,用 selenium 爬虫 1. 创建项目 scrapy ...