4163c4eb8cffd43b05931100fa2dd807a3b19fbb,examples/utils/tf_records_generation.py,,main,#Any#,97

Before Change


    column_name = ["filename", "width", "height", "class", "xmin", "ymin", "xmax", "ymax"]
    df = pd.DataFrame(tf_tiles_info, columns=column_name)
    //shuffle the dataframe
    df = df.sample(frac=1)
    train_df = df[:split_index]
    test_df = df[split_index:]
    print("You have {} training tiles and {} test tiles ready".format(
    len(set(train_df["filename"])), len(set(test_df["filename"]))))
    // train_df.to_csv("train_df.csv")
    // test_df.to_csv("test_df.csv")

    tiles_dir = op.join(os.getcwd(), "tiles")
    train_dir = op.join(os.getcwd(), "images", "train")
    test_dir = op.join(os.getcwd(), "images", "test")

    if not op.isdir(train_dir):
        makedirs(train_dir)
    if not op.isdir(test_dir):
        makedirs(test_dir)

    for tile in train_df["filename"]:
        tile_dir = op.join(tiles_dir, tile)
        shutil.copy(tile_dir, train_dir)

    for tile in test_df["filename"]:
        tile_dir = op.join(tiles_dir, tile)
        shutil.copy(tile_dir, test_dir)
    ////// for train
    writer = tf.python_io.TFRecordWriter(FLAGS.train_rd_path)
    grouped = split(train_df, "filename")

    for group in grouped:
        tf_example = create_tf_example(group, train_dir)
        writer.write(tf_example.SerializeToString())
    writer.close()
    output_train= op.join(os.getcwd(),FLAGS.train_rd_path)
    print("Successfully created the TFRecords: {}".format(output_train))

After Change


    tf_array = np.array(tf_tiles_info)
    split_index = int(len(tf_tiles_info) *0.8 )
    tf_train = tf_array[0: split_index]
    tf_test = tf_array[split_index, :]
    print("You have {} training tiles and {} test tiles ready".format(
    len(set(list(tf_train[:,1]))), len(set(list(tf_test[:,1])))))
    tiles_dir = op.join(os.getcwd(), "tiles")
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 5

Instances


Project Name: developmentseed/label-maker
Commit Name: 4163c4eb8cffd43b05931100fa2dd807a3b19fbb
Time: 2018-01-26
Author: geospatialanalystyi@gmail.com
File Name: examples/utils/tf_records_generation.py
Class Name:
Method Name: main


Project Name: uber/pyro
Commit Name: f6e75e7593d5305b1b6c9ce1a5b2eee8a3c7f38a
Time: 2019-11-15
Author: fritzo@uber.com
File Name: tests/infer/test_smcfilter.py
Class Name: SmokeModel
Method Name: step


Project Name: HyperGAN/HyperGAN
Commit Name: 174ff6fbaaef8678313f8722690c5db4bbe58ae9
Time: 2020-02-07
Author: martyn@255bits.com
File Name: hypergan/trainers/simultaneous_trainer.py
Class Name: SimultaneousTrainer
Method Name: _step