import torch
import onnx
import sys
sys.path.append('/Users/sandeepchaudhary/ESRGAN/models/')
from RRDB_ESRGAN_x4 import ESRGAN
# Import your ESRGAN model
# Initialize and load your model
model = ESRGAN()
model.load_state_dict(torch.load('/Users/sandeepchaudhary/ESRGAN/models/RRDB_ESRGAN_x4.pth'))
model.eval()
# Create a dummy input with the specified dimensions
dummy_input = torch.randn(1, 3, 10980, 10980) # RGB image of 10,980 x 10,980
# Export the model to ONNX format
torch.onnx.export(model, dummy_input, 'esrgan.onnx', verbose=True)
sandeepchaudhary@Sandeeps-MacBook-Pro ~ % /Applications/miniconda3/envs/new
env/bin/python /Users/sandeepchaudhary/ESRGAN/Convert.py
Traceback (most recent call last):
File “/Users/sandeepchaudhary/ESRGAN/Convert.py”, line 5, in
from RRDB_ESRGAN_x4 import ESRGAN
ModuleNotFoundError: No module named ‘RRDB_ESRGAN_x4’
the error is persisting