src/DOTA_devkit/prepare_Rotatexml_COCOformat.py
def generate_txt_labels(src_path, out_path, trainval=True):
    """Generate .txt labels recording img_names
    Args:
        src_path: dataset path containing images and labelTxt folders.
        out_path: output txt file path
        trainval: trainval or test?
    """
    img_path = os.path.join(src_path, 'images')
    label_path = os.path.join(src_path, 'labelTxt')
    img_lists = os.listdir(img_path)
    with open(out_path, 'w') as f:
        for img in img_lists:
            img_name = osp.splitext(img)[0]
            label = os.path.join(label_path, img_name+'.txt')
            if(trainval == True):
                if(os.path.exists(label) == False):
                    print('Label:'+img_name+'.txt'+' Not Exist')
                else:
                    f.write(img_name+'\n')
            else:
                f.write(img_name+'\n')
Generate .txt labels recording img_names
    Args:
        src_path: dataset path containing images and labelTxt folders.
        out_path: output txt file path
        trainval: trainval or test?
    
Generate .txt labels recording img_names
Generate . txt labels recording img_names
def generate_txt_labels(src_path, out_path, trainval=True):
    img_path = os.path.join(src_path, 'images')
    label_path = os.path.join(src_path, 'labelTxt')
    img_lists = os.listdir(img_path)
    with open(out_path, 'w') as f:
        for img in img_lists:
            img_name = osp.splitext(img)[0]
            label = os.path.join(label_path, img_name+'.txt')
            if(trainval == True):
                if(os.path.exists(label) == False):
                    print('Label:'+img_name+'.txt'+' Not Exist')
                else:
                    f.write(img_name+'\n')
            else:
                f.write(img_name+'\n')
def generate_txt_labels ( src_path , out_path , trainval = True ) : img_path = os . path . join ( src_path , 'images' ) label_path = os . path . join ( src_path , 'labelTxt' ) img_lists = os . listdir ( img_path ) with open ( out_path , 'w' ) as f : for img in img_lists : img_name = osp . splitext ( img ) [ 0 ] label = os . path . join ( label_path , img_name + '.txt' ) if ( trainval == True ) : if ( os . path . exists ( label ) == False ) : print ( 'Label:' + img_name + '.txt' + ' Not Exist' ) else : f . write ( img_name + '\n' ) else : f . write ( img_name + '\n' )
Generate .txt labels recording img_names
Generate . txt labels recording img_names
"""Generate .txt labels recording img_names
    Args:
        src_path: dataset path containing images and labelTxt folders.
        out_path: output txt file path
        trainval: trainval or test?
    """
src_path
dataset path containing images and labelTxt folders.
dataset path containing images and labelTxt folders .
out_path
output txt file path
output txt file path
trainval
None