예제 #1
0
from deeplkt.config import *
params = dotdict({
    'mode' : MODE,
    'max_iterations' : MAX_LK_ITERATIONS,
    'epsilon' : EPSILON,
    'num_classes': NUM_CLASSES,
    'num_channels': 3,
    'info': "LearnedLKTALOV"

})
# lr = 0.0005
# momentum = 0.5


net = PureLKTNet(device, params)
tracker = LKTTracker(net)
train_params = dotdict({
    'batch_size' : BATCH_SIZE,
    'val_split' : VALIDATION_SPLIT,
    'train_examples':TRAIN_EXAMPLES,
    'shuffle_train': SHUFFLE_TRAIN,
    'lr': LR,
    'momentum': MOMENTUM,
    'l2': L2,
    'random_seed': RANDOM_SEED
})

model = BaseModel(tracker, 'checkpoint', 'logs', train_params)
def count_parameters(model):
    return sum(p.numel() for p in model.parameters() if p.requires_grad)
print(count_parameters(net))
예제 #2
0



params = dotdict({
    'mode' : MODE,
    'max_iterations' : MAX_LK_ITERATIONS,
    'epsilon' : EPSILON,
    'info': "Pure LKT"
})
# lr = 0.0005
# momentum = 0.5


nn = PureLKTNet(device, params)
tracker = LKTTracker(nn)

video_name = "../red_square.mp4"
dir_name = "../red_square"
outdir_name = "../red_square_results"

window_name = "ABC"
make_dir(dir_name)
make_dir(outdir_name)

# convertVideoToDir(video_name, dir_name)
frames = readDir(dir_name)
first_frame = True
cnt = 0
for frame in frames:
    frame = np.expand_dims(frame, 0)