facebookresearch / facebookresearch/hyperreel

Fail to run the code

Open
#26 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
481
Forks
33
PR merge metrics
No merged PRs in 30d

Description

It seems to be some problem with ssim. I don’t know what causes this problem? Can you reply? Thank you very much.

```
Traceback (most recent call last):
File "main.py", line 209, in main
elastic_run(cfg)
File "main.py", line 204, in elastic_run
run(cfg, "", "", "")
File "main.py", line 183, in run
trainer.fit(system, datamodule=dm)
File "/home/zkz/anaconda3/envs/hyperreel2/lib/python3.8/site-packages/pytorch_lightning/trainer/trainer.py", line 696, in fit
self._call_and_handle_interrupt(
File "/home/zkz/anaconda3/envs/hyperreel2/lib/python3.8/site-packages/pytorch_lightning/trainer/trainer.py", line 650, in _call_and_handle_interrupt
return trainer_fn(*args, **kwargs)
File "/home/zkz/anaconda3/envs/hyperreel2/lib/python3.8/site-packages/pytorch_lightning/trainer/trainer.py", line 735, in _fit_impl
results = self._run(model, ckpt_path=self.ckpt_path)
File "/home/zkz/anaconda3/envs/hyperreel2/lib/python3.8/site-packages/pytorch_lightning/trainer/trainer.py", line 1166, in _run
results = self._run_stage()
File "/home/zkz/anaconda3/envs/hyperreel2/lib/python3.8/site-packages/pytorch_lightning/trainer/trainer.py", line 1252, in _run_stage
return self._run_train()
File "/home/zkz/anaconda3/envs/hyperreel2/lib/python3.8/site-packages/pytorch_lightning/trainer/trainer.py", line 1274, in _run_train
self._run_sanity_check()
File "/home/zkz/anaconda3/envs/hyperreel2/lib/python3.8/site-packages/pytorch_lightning/trainer/trainer.py", line 1343, in _run_sanity_check
val_loop.run()
File "/home/zkz/anaconda3/envs/hyperreel2/lib/python3.8/site-packages/pytorch_lightning/loops/loop.py", line 200, in run
self.advance(*args, **kwargs)
File "/home/zkz/anaconda3/envs/hyperreel2/lib/python3.8/site-packages/pytorch_lightning/loops/dataloader/evaluation_loop.py", line 155, in advance
dl_outputs = self.epoch_loop.run(self._data_fetcher, dl_max_batches, kwargs)
File "/home/zkz/anaconda3/envs/hyperreel2/lib/python3.8/site-packages/pytorch_lightning/loops/loop.py", line 200, in run
self.advance(*args, **kwargs)
File "/home/zkz/anaconda3/envs/hyperreel2/lib/python3.8/site-packages/pytorch_lightning/loops/epoch/evaluation_epoch_loop.py", line 143, in advance
output = self._evaluation_step(**kwargs)
File "/home/zkz/anaconda3/envs/hyperreel2/lib/python3.8/site-packages/pytorch_lightning/loops/epoch/evaluation_epoch_loop.py", line 240, in _evaluation_step
output = self.trainer._call_strategy_hook(hook_name, *kwargs.values())
File "/home/zkz/anaconda3/envs/hyperreel2/lib/python3.8/site-packages/pytorch_lightning/trainer/trainer.py", line 1704, in _call_strategy_hook
output = fn(*args, **kwargs)
File "/home/zkz/anaconda3/envs/hyperreel2/lib/python3.8/site-packages/pytorch_lightning/strategies/strategy.py", line 370, in validation_step
return self.model.validation_step(*args, **kwargs)
File "/home/zkz/python/hyperreel-main/nlf/__init__.py", line 1004, in validation_step
log = self.validation_image(batch, batch_idx)
File "/home/zkz/python/hyperreel-main/nlf/__init__.py", line 980, in validation_image
outputs['val/ssim'] = ssim(img.transpose(1, 2, 0), img_gt.transpose(1, 2, 0))
File "/home/zkz/python/hyperreel-main/metrics.py", line 35, in ssim
return structural_similarity(np.array(image1), np.array(image0), win_size=11, multichannel=True, gaussian_weights=True, data_range=1.0)
File "/home/zkz/anaconda3/envs/hyperreel2/lib/python3.8/site-packages/skimage/metrics/_structural_similarity.py", line 178, in structural_similarity
raise ValueError(
ValueError: win_size exceeds image extent. Either ensure that your images are at least 7x7; or pass win_size explicitly in the function call, with an odd value less than or equal to the smaller side of your images. If your images are multichannel (with color channels), set channel_axis to the axis number corresponding to the channels.
```

Contributor guide

Open the contributing guide

Research direction

Start with nlf/__init__.py at validation_image and metrics.py at the ssim call, then reproduce the failure using the reported training command and configuration. Inspect the shapes of img and img_gt at validation time and compare them with the scikit-image error. Done means validation completes without the ValueError and SSIM is computed for the affected inputs.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
computer-vision, machine-learning
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.