Exemple #1
0
import common
import utrain
import utest

N_EPOCHS = 1000
N_STEPS_PER_EPOCH = 80

dgargs = dict(rotation_range=90,
              fill_mode='reflect',
              horizontal_flip=True,
              vertical_flip=True)
file_id = utrain.main(img_height=256,
                      batch_size=2,
                      epochs=N_EPOCHS,
                      steps_per_epoch=N_STEPS_PER_EPOCH,
                      aug=True,
                      chosen_validation=True,
                      rgb=False,
                      pretrained_weights=None,
                      monitor="val_acc",
                      root_folder=".",
                      data_gen_args=dgargs)
hdf5_path = os.path.join(common.RESULTS_PATH, file_id + ".hdf5")
subm_path = utest.main(
    ckpt_path=hdf5_path,
    use_max=True,
    four_split=True,
    training=False,
)
print(f"Saved submission file at {subm_path}.")
Exemple #2
0
        print('type invoke() to call my_func')

    @utest.cond(equals(2))
    def test_mapper_single_interrupt(self):
        tim = pyb.Timer(1)
        tim.init(freq=2)

        @cmemgr.map_to_thread(tim.callback)
        def led_blink():
            with Indicator(1):
                pyb.delay(30)

    @utest.cond(equals(3))
    def test_mapper_multi_interrupts(self):
        TiTuple = namedtuple('TiTuple', ('tim', 'id'))
        for info in [TiTuple(pyb.Timer(tim_id, freq=tim_id + 1), tim_id) for tim_id in (1, 2, 4)]:
            @cmemgr.map_to_thread(info.tim.callback, info.id)
            def led_blink(led_id):
                with Indicator(led_id):
                    pyb.delay(30)


if __name__ == '__main__':
    print('tests list:')
    print('1. test for single thread')
    print('2. test for single interrupt')
    print('3. test for multi interrupts')
    x = int(input('please choose one: '))
    utest.main(x)