moldenhof commited on
Commit
d88e063
β€’
1 Parent(s): 663db57

implementing model switch

Browse files
app.py CHANGED
@@ -44,32 +44,35 @@ def plot_bbox(bbox_XYXY, label):
44
  def atomlenz(modelfile):
45
  model_cls = RCNN
46
  experiment_path_atoms="./models/atoms_model/"
47
- dir_list = os.listdir(experiment_path_atoms)
48
- dir_list = [os.path.join(experiment_path_atoms,f) for f in dir_list]
49
- dir_list.sort(key=os.path.getctime, reverse=True)
50
- checkpoint_file_atoms = [f for f in dir_list if "ckpt" in f][0]
51
  checkpoint_file_atoms=os.path.join(experiment_path_atoms,modelfile)
52
  model_atom = model_cls.load_from_checkpoint(checkpoint_file_atoms)
53
  model_atom.model.roi_heads.score_thresh = 0.65
54
  experiment_path_bonds = "./models/bonds_model/"
55
- dir_list = os.listdir(experiment_path_bonds)
56
- dir_list = [os.path.join(experiment_path_bonds,f) for f in dir_list]
57
- dir_list.sort(key=os.path.getctime, reverse=True)
58
- checkpoint_file_bonds = [f for f in dir_list if "ckpt" in f][0]
 
59
  model_bond = model_cls.load_from_checkpoint(checkpoint_file_bonds)
60
  model_bond.model.roi_heads.score_thresh = 0.65
61
  experiment_path_stereo = "./models/stereos_model/"
62
- dir_list = os.listdir(experiment_path_stereo)
63
- dir_list = [os.path.join(experiment_path_stereo,f) for f in dir_list]
64
- dir_list.sort(key=os.path.getctime, reverse=True)
65
- checkpoint_file_stereo = [f for f in dir_list if "ckpt" in f][0]
 
66
  model_stereo = model_cls.load_from_checkpoint(checkpoint_file_stereo)
67
  model_stereo.model.roi_heads.score_thresh = 0.65
68
  experiment_path_charges = "./models/charges_model/"
69
- dir_list = os.listdir(experiment_path_charges)
70
- dir_list = [os.path.join(experiment_path_charges,f) for f in dir_list]
71
- dir_list.sort(key=os.path.getctime, reverse=True)
72
- checkpoint_file_charges = [f for f in dir_list if "ckpt" in f][0]
 
73
  model_charge = model_cls.load_from_checkpoint(checkpoint_file_charges)
74
  model_charge.model.roi_heads.score_thresh = 0.65
75
 
 
44
  def atomlenz(modelfile):
45
  model_cls = RCNN
46
  experiment_path_atoms="./models/atoms_model/"
47
+ #dir_list = os.listdir(experiment_path_atoms)
48
+ #dir_list = [os.path.join(experiment_path_atoms,f) for f in dir_list]
49
+ #dir_list.sort(key=os.path.getctime, reverse=True)
50
+ #checkpoint_file_atoms = [f for f in dir_list if "ckpt" in f][0]
51
  checkpoint_file_atoms=os.path.join(experiment_path_atoms,modelfile)
52
  model_atom = model_cls.load_from_checkpoint(checkpoint_file_atoms)
53
  model_atom.model.roi_heads.score_thresh = 0.65
54
  experiment_path_bonds = "./models/bonds_model/"
55
+ #dir_list = os.listdir(experiment_path_bonds)
56
+ #dir_list = [os.path.join(experiment_path_bonds,f) for f in dir_list]
57
+ #dir_list.sort(key=os.path.getctime, reverse=True)
58
+ #checkpoint_file_bonds = [f for f in dir_list if "ckpt" in f][0]
59
+ checkpoint_file_bonds=os.path.join(experiment_path_bonds,modelfile)
60
  model_bond = model_cls.load_from_checkpoint(checkpoint_file_bonds)
61
  model_bond.model.roi_heads.score_thresh = 0.65
62
  experiment_path_stereo = "./models/stereos_model/"
63
+ #dir_list = os.listdir(experiment_path_stereo)
64
+ #dir_list = [os.path.join(experiment_path_stereo,f) for f in dir_list]
65
+ #dir_list.sort(key=os.path.getctime, reverse=True)
66
+ #checkpoint_file_stereo = [f for f in dir_list if "ckpt" in f][0]
67
+ checkpoint_file_stereo=os.path.join(experiment_path_stereo,modelfile)
68
  model_stereo = model_cls.load_from_checkpoint(checkpoint_file_stereo)
69
  model_stereo.model.roi_heads.score_thresh = 0.65
70
  experiment_path_charges = "./models/charges_model/"
71
+ #dir_list = os.listdir(experiment_path_charges)
72
+ #dir_list = [os.path.join(experiment_path_charges,f) for f in dir_list]
73
+ #dir_list.sort(key=os.path.getctime, reverse=True)
74
+ #checkpoint_file_charges = [f for f in dir_list if "ckpt" in f][0]
75
+ checkpoint_file_charges=os.path.join(experiment_path_charges,modelfile)
76
  model_charge = model_cls.load_from_checkpoint(checkpoint_file_charges)
77
  model_charge.model.roi_heads.score_thresh = 0.65
78
 
models/atoms_model/{epoch=7-step=13616.ckpt β†’ real.ckpt} RENAMED
File without changes
models/bonds_model/{epoch=5-step=10602.ckpt β†’ real.ckpt} RENAMED
File without changes
models/charges_model/{epoch=6-step=10983.ckpt β†’ real.ckpt} RENAMED
File without changes
models/stereos_model/{epoch=9-step=18160.ckpt β†’ real.ckpt} RENAMED
File without changes