process_cities.py 文件源码

python
阅读 28 收藏 0 点赞 0 评论 0

项目:learning-to-see-by-moving 作者: pulkitag 项目源码 文件源码
def make_train_test_split(prms):
    '''
    # I will just make one split and consider the last 5% of the iamges as the val images. 
    # Randomly sampling in this data is a bad idea, because many images appear together as 
    # pairs. Selecting from the end will maximize the chances of using unique and different
    # imahes in the train and test splits. 
    '''
    # Read the source pairs. 
    fid    = open(prms['paths']['pairList']['raw'],'r')
    lines  = fid.readlines()
    fid.close()
    numIm, numPairs = int(lines[0].split()[0]), int(lines[0].split()[1])
    lines = lines[1:]

    #Make train and val splits
    N = len(lines)
    trainNum   = int(np.ceil(0.95 * N))
    trainLines = lines[0:trainNum]
    testLines  = lines[trainNum:]
    _write_pairs(prms['paths']['pairList']['train'], trainLines, numIm)
    _write_pairs(prms['paths']['pairList']['test'] , testLines, numIm)

##
# Get the list of tar files for downloading the image data
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号