Skip to content

Commit

Permalink
demo.py updated
Browse files Browse the repository at this point in the history
  • Loading branch information
Amin Nejatbakhsh committed Jun 22, 2020
1 parent aa67376 commit bd90896
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -136,3 +136,9 @@ dmypy.json

# Cython debug symbols
cython_debug/


# images and videos
*.mp4
*.png
*.jpg
12 changes: 8 additions & 4 deletions demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,20 @@
A = torch.tensor(A).float()
n_nmf = dNMF(torch.tensor(m.mc[0]).float(),positions=A[:,:,np.newaxis],\
radius=params['radius'],step_S=params['step_S'],gamma=params['gamma'],
use_gpu=False,initial_p=A,sigma_inv=params['sigma_inv'], method='1->t', verbose=False)
use_gpu=False,initial_p=A,sigma_inv=params['sigma_inv'],
method='1->t', verbose=True)
n_nmf.optimize(lr=.1,n_iter=0,n_iter_c=20)
end = time.time()
print('normcorre-nmf finished in ' + str(end-start) + ' seconds')

start = time.time()
dnmf = dNMF(video,positions=positions[:,:,0][:,:,np.newaxis],\
radius=params['radius'],step_S=params['step_S'],gamma=params['gamma'],
use_gpu=False,initial_p=positions[:,:,0],sigma_inv=params['sigma_inv'], method='1->t', verbose=False)
use_gpu=False,initial_p=positions[:,:,0],sigma_inv=params['sigma_inv'],
method='1->t', verbose=True)

dnmf.optimize(lr=.1,n_iter=20,n_iter_c=2)
dnmf.optimize(lr=1e-4,n_iter=20,n_iter_c=2)
end = time.time()
print('dNMF finished in ' + str(end-start) + ' seconds')
print('dNMF finished in ' + str(end-start) + ' seconds')

dnmf.visualize_tracks('result',video)

0 comments on commit bd90896

Please sign in to comment.