示例#1
0
def get_x_pred(df_size=100,scale=1,pre_dir="./test_pad/",cates=0,flat_x = True):

    path = pre_dir +"test_"+categories.get_cate_name(cates)+".csv"
    print("Read data from files: ",path)
    df = pd.read_csv(path)
    if df_size !=-1:
        df=df[:df_size]

    if flat_x:
        x_train = set_x_flat(df, scale, pre_dir)
    else:
        x_train = set_x_img(df, scale, pre_dir)

    print("X shape: ",x_train.shape )
    return x_train, df[["image_id","image_category"]]
示例#2
0
def get_x_y_valid(df_size=-1,scale=1,pre_dir="./train_warm_up_pad/",cates=0,flat_x = True):

    path = pre_dir +"Annotations/train_"+categories.get_cate_name(cates)+"_coord.csv"
    print("Read data from files: ",path)
    df = pd.read_csv(path)
    if df_size !=-1:
        df=df[:df_size]
    
    if flat_x:
        x_train = set_x_flat(df, scale, pre_dir)
    else:
        x_train = set_x_img(df, scale, pre_dir)
    y_train = set_y_coord(df , scale)

    print("X shape: ",x_train.shape , "Y shape: " , y_train.shape)
    return x_train,y_train
示例#3
0
def get_x_y_s_e(start = 0,end=100,scale=1,pre_dir="train_pad/",cates=0,flat_x = True):
    path = pre_dir +"Annotations/train_"+categories.get_cate_name(cates)+"_coord.csv"
    print("Read data from files: ",path)
    df = pd.read_csv(path)

    df=df[start:end]


    if flat_x:
        x_train = set_x_flat(df, scale, "train_pad/")
    else:
        x_train = set_x_img(df, scale, "train_pad/")

    y_train = set_y_coord(df , scale)

    print(x_train.shape)
    return x_train,y_train
示例#4
0
def get_x_y_time(df_size=-1,scale=1,pre_dir="train_pad/",cates=0,flat_x = True):

    path = pre_dir +"Annotations/train_"+categories.get_cate_name(cates)+"_coord.csv"
    print("Read data from files: ",path)
    start_time = time.time()
    df = pd.read_csv(path)
    if df_size !=-1:
        df=df[:df_size]
    print("--- %s secs reading data ---" % ((time.time() - start_time)))
    if flat_x:
        x_train = set_x_flat(df, scale, "train_pad/")
    else:
        x_train = set_x_img(df, scale, "train_pad/")
    print("--- %s secs reading X ---" % ((time.time() - start_time)))
    y_train = set_y_coord(df , scale)
    print("--- %s secs reading Y ---" % ((time.time() - start_time)))
    print("X shape: ",x_train.shape , "Y shape: " , y_train.shape)
    return x_train,y_train   
示例#5
0
def get_x_y_map(df_size=-1,scale=1,pre_dir="train_pad/",cates=0,flat_x = True):

    path = pre_dir +"Annotations/train_"+categories.get_cate_name(cates)+"_coord.csv"
    print("Read data from files: ",path)
    df = pd.read_csv(path)
    if df_size !=-1:
        df=df[:df_size]
    
    if flat_x:
        x_train = set_x_flat(df, scale, "train_pad/")
    else:
        x_train = set_x_img(df, scale, "train_pad/")
    y_train = set_y_map(df , scale)
    y_coord = set_y_coord(df , 1 , True)

    center_map = set_y_center_map(df , scale , 1)

    print("X shape: ",x_train.shape , "Y shape: " , y_train.shape)
    print("Coords shape: ",y_coord.shape , "Map shape: " , center_map.shape)
    return x_train,y_train,y_coord , center_map