haritsahm commited on
Commit
4ae0e32
·
1 Parent(s): 7e11c00

Add model warmup

Browse files
Files changed (1) hide show
  1. main.py +8 -0
main.py CHANGED
@@ -33,6 +33,14 @@ EXAMPLE_IMAGES = [
33
  ['examples/P_00001_LEFT_cc.jpg', 'examples/P_00001_LEFT_mlo.jpeg'],
34
  ]
35
 
 
 
 
 
 
 
 
 
36
 
37
  def filter_files(files: List) -> List:
38
  """Filter uploaded files.
 
33
  ['examples/P_00001_LEFT_cc.jpg', 'examples/P_00001_LEFT_mlo.jpeg'],
34
  ]
35
 
36
+ # Model warmup
37
+ test_images = np.random.randint(0, 255, (2, INPUT_HEIGHT, INPUT_WIDTH))
38
+ test_images = torch.from_numpy(test_images).to(device)
39
+ test_images = test_images.unsqueeze(0) # Add batch dimension
40
+ for _ in range(10):
41
+ _, _, _ = BILATERAL_MODEL(test_images)
42
+ test_images = None
43
+
44
 
45
  def filter_files(files: List) -> List:
46
  """Filter uploaded files.