zoukankan      html  css  js  c++  java
  • 软工超越日报-paddle目标检测算法 数据集统合 5/30

    今天我们来做数据集统合,和预测算法不同,这次我们要对照的是各自的xml文件

    代码如下:

    import os
    
    path = ['人纹污灯蛾', '丝带凤蝶', '日本脊吉丁', '星天牛', '杨小舟蛾', '杨扇舟蛾', '松墨天牛',
            '柳兰叶甲', '桑天牛', '美国白蛾', '草履蚧',
            '褐边绿刺蛾成虫', '霜天蛾', '麻皮椿成虫', '黄刺蛾']
    
    
    def walkFile(file1,id):
        for root, dirs, files in os.walk(file1):
    
            # 遍历文件
            # for f in files:
            #     print(os.path.join(root, f))
            with open('trainval.txt', 'w') as c:
                for f in files:
                    c.write('C:/Users/14997/PycharmProjects/mushi/images/' + path[10] + '/' + os.path.splitext(f)[0] + '.jpg ')
                    c.write('C:/Users/14997/Desktop/数据集xml/'+path[10]+'/'+os.path.splitext(f)[0]+'.xml
    ')
    
    
            with open('test.txt', 'w') as c:
                for f in files:
                    c.write('C:/Users/14997/PycharmProjects/mushi/images/' + path[10] + '/' + os.path.splitext(f)[0] + '.jpg ')
                    c.write('C:/Users/14997/Desktop/数据集xml/' + path[10] + '/' + os.path.splitext(f)[0] + '.xml
    ')
    
    
    
    def ssc():
        walkFile("C:/Users/14997/Desktop/数据集xml/"+path[10], 10)
    
    
    ssc()                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                

    这样就可以实现以下效果:

  • 相关阅读:
    static作用(修饰函数、局部变量、全局变量)(转)
    地弹
    开漏(open drain)和开集(open colletor)
    过冲、振铃,非单调性
    串扰(crosstalk)
    数字通信基本概念
    电源和地
    分布式系统与集总系统
    传输线及其特性阻抗
    MSP430G2553 Launchpad 硬件I2C驱动
  • 原文地址:https://www.cnblogs.com/Sakuraba/p/14911734.html
Copyright © 2011-2022 走看看