Open chrisdottel opened 3 years ago
Last thrown error means the class Pix2PixModel
does not implement the method optimize_parameters()
, previously declared in the class BaseModel
.
For testing purposes, a quick fix can be done by implementing a pass statement, since optimization is not required:
# inside Pix2PixModel class in pix2pix_model.py
def optimize_parameters(self):
"""No optimization for test model."""
pass
After that, there is a bunch of errors in test.py
regarding imports and a leftover self
in load_image()
.
This code snippet should fix it:
# from custom_dataset import DepthDataset
from torchvision import transforms
from PIL import Image
import glob
def load_image(image_path):
# Convert image to tensor
to_tensor = transforms.Compose([
transforms.ToTensor(),
transforms.Normalize((0.5, 0.5, 0.5), (0.5, 0.5, 0.5))
])
# image
image = Image.open(image_path).convert('RGB')
image = to_tensor(image) # remove `self.`
return { 'A': image.unsqueeze(0) }
And finally, there's a missing method convert_model()
.
Traceback (most recent call last):
File "test.py", line 119, in <module>
model = create_model(opt) # create a model given opt.model and other options
File "/home/Imatge/projects/vivim/PeeledHuman/models/__init__.py", line 65, in create_model
instance = model(opt)
File "/home/Imatge/projects/vivim/PeeledHuman/models/test_model.py", line 46, in __init__
opt.norm, not opt.no_dropout, opt.init_type, opt.init_gain, self.gpu_ids)
File "/home/Imatge/projects/vivim/PeeledHuman/models/networks.py", line 149, in define_G
return init_net(net, init_type, init_gain, gpu_ids)
File "/home/Imatge/projects/vivim/PeeledHuman/models/networks.py", line 115, in init_net
net = convert_model(net)
NameError: name 'convert_model' is not defined
Not sure what it really does, it's anywhere declared. But comment that 115 line and the code apparently runs with no crash.
I also tried to use the class TestModel
via --model test
(instead of pix2pix), but it's apparently incompatible with the provided checkpoint.
On a side note, I tested on several video frames and the code throws a bunch cluttered files (*_mesh.obj
, *.inp.png
, and *_depth.png
) as expected, however some frames and meshes were missing. But hey, I should probably read the paper and code more carefully.
@valillon the checkpoint link is no longer available, would mind uploading it to a google drive link so that others can work with this repository? It would be much appreciated!
Code references a
custom_dataset
module that doesn't exist. Removed it. Then I get this ghost parametertest.py: error: the following arguments are required: --dataroot
There seems to be no description to what this parameters is for. Passing it in blank we get
TypeError: Can't instantiate abstract class Pix2PixModel with abstract methods optimize_parameters
Did anyone work through all of this to get the base pretrained model working?