Spaces:
Build error
Build error
Update Lowlight.py
Browse files- Lowlight.py +5 -3
Lowlight.py
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
import torch
|
|
|
2 |
import onnxruntime
|
3 |
import onnx
|
4 |
import cv2
|
@@ -32,9 +33,10 @@ try:
|
|
32 |
onnx_input = {'input': input_image}
|
33 |
#onnx_output0, onnx_output1, onnx_output2 = onnx_session.run(['output0', 'output1', 'output2'], onnx_input)
|
34 |
onnx_output = onnx_session.run(['output'], onnx_input)
|
35 |
-
|
36 |
-
torch_output = np.
|
37 |
-
|
|
|
38 |
except Exception as e:
|
39 |
print(f'Input on model:{model_name} failed')
|
40 |
print(e)
|
|
|
1 |
import torch
|
2 |
+
import torchvision
|
3 |
import onnxruntime
|
4 |
import onnx
|
5 |
import cv2
|
|
|
33 |
onnx_input = {'input': input_image}
|
34 |
#onnx_output0, onnx_output1, onnx_output2 = onnx_session.run(['output0', 'output1', 'output2'], onnx_input)
|
35 |
onnx_output = onnx_session.run(['output'], onnx_input)
|
36 |
+
torchvision.utils.save_image(torch.from_numpy(onnx_ouput[0]), config.save_path+'output.png')
|
37 |
+
#torch_output = np.squeeze(onnx_output[0], 0)
|
38 |
+
#torch_output = np.transpose(torch_output * 255, [1, 2, 0]).astype(np.uint8)
|
39 |
+
#plt.imsave(config.save_path+'output.png', torch_output)
|
40 |
except Exception as e:
|
41 |
print(f'Input on model:{model_name} failed')
|
42 |
print(e)
|