In Masterarbeit:"Anomalie-Detektion in Zellbildern zur Anwendung der Leukämieerkennung" verwendete CSI Methode.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

__init__.py 1.0KB

123456789101112131415161718192021222324252627282930313233
  1. def setup(mode, P):
  2. fname = f'{P.dataset}_{P.model}_{mode}_{P.res}'
  3. if mode == 'sup_linear':
  4. from .sup_linear import train
  5. elif mode == 'sup_CSI_linear':
  6. from .sup_CSI_linear import train
  7. elif mode == 'sup_simclr':
  8. from .sup_simclr import train
  9. elif mode == 'sup_simclr_CSI':
  10. assert P.batch_size == 32
  11. # currently only support rotation
  12. from .sup_simclr_CSI import train
  13. else:
  14. raise NotImplementedError()
  15. if P.suffix is not None:
  16. fname += f'_{P.suffix}'
  17. return train, fname
  18. def update_comp_loss(loss_dict, loss_in, loss_out, loss_diff, batch_size):
  19. loss_dict['pos'].update(loss_in, batch_size)
  20. loss_dict['neg'].update(loss_out, batch_size)
  21. loss_dict['diff'].update(loss_diff, batch_size)
  22. def summary_comp_loss(logger, tag, loss_dict, epoch):
  23. logger.scalar_summary(f'{tag}/pos', loss_dict['pos'].average, epoch)
  24. logger.scalar_summary(f'{tag}/neg', loss_dict['neg'].average, epoch)
  25. logger.scalar_summary(f'{tag}', loss_dict['diff'].average, epoch)