Paolo-Fraccaro commited on
Commit
87b76e7
·
1 Parent(s): d54b8be

fix channels order

Browse files
Files changed (1) hide show
  1. app.py +6 -1
app.py CHANGED
@@ -134,7 +134,12 @@ def inference_on_file(target_image, model, custom_test_pipeline):
134
 
135
  st = time.time()
136
  print('Running inference...')
137
- result = inference_segmentor(model, target_image, custom_test_pipeline)
 
 
 
 
 
138
  print("Output has shape: " + str(result[0].shape))
139
 
140
  # prep outputs
 
134
 
135
  st = time.time()
136
  print('Running inference...')
137
+ try:
138
+ result = inference_segmentor(model, target_image, custom_test_pipeline)
139
+ except:
140
+ print('Error: Try different channels order.')
141
+ model.cfg.data.test.pipeline[0]['channels_last'] = True
142
+ result = inference_segmentor(model, target_image, custom_test_pipeline)
143
  print("Output has shape: " + str(result[0].shape))
144
 
145
  # prep outputs