Moditha24 commited on
Commit
2dcf762
·
verified ·
1 Parent(s): c197dad

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -13
app.py CHANGED
@@ -1,26 +1,20 @@
1
- from config import MLP
2
  from mmcv import Config
3
  from mmdet.models import build_detector
4
  import torch
5
 
6
  def main():
7
- # Print model type from config
8
- print(f"Model type: {MLP['type']}")
9
 
10
- # Build the model from the config dict
11
- model = build_detector(MLP, train_cfg=MLP.get('train_cfg'), test_cfg=MLP.get('test_cfg'))
12
 
13
- # Set model to evaluation mode
14
- model.eval()
15
 
16
- # Print model architecture summary
17
- print(model)
18
-
19
- # Optional: dummy input test (batch of 1 image with 3 channels, 800x1333)
20
  dummy_input = torch.randn(1, 3, 800, 1333)
21
  with torch.no_grad():
22
- result = model.forward_dummy(dummy_input)
23
- print("Forward pass output:", result)
24
 
25
  if __name__ == "__main__":
26
  main()
 
1
+ from config import model
2
  from mmcv import Config
3
  from mmdet.models import build_detector
4
  import torch
5
 
6
  def main():
7
+ print(f"Model type: {model['type']}")
 
8
 
9
+ detector = build_detector(model, train_cfg=model.get('train_cfg'), test_cfg=model.get('test_cfg'))
10
+ detector.eval()
11
 
12
+ print(detector)
 
13
 
 
 
 
 
14
  dummy_input = torch.randn(1, 3, 800, 1333)
15
  with torch.no_grad():
16
+ output = detector.forward_dummy(dummy_input)
17
+ print("Forward output:", output)
18
 
19
  if __name__ == "__main__":
20
  main()