Skip to content
This repository has been archived by the owner on Oct 9, 2023. It is now read-only.

flash_examples object_detection trainer.predict not work #1416

Closed
aizaiyishunjian opened this issue Aug 11, 2022 · 2 comments
Closed

flash_examples object_detection trainer.predict not work #1416

aizaiyishunjian opened this issue Aug 11, 2022 · 2 comments
Labels
bug / fix Something isn't working help wanted Extra attention is needed

Comments

@aizaiyishunjian
Copy link

run examples:object_detection,occour error:

Traceback (most recent call last):
File "D:\virtualenv\lightning_flash\lib\site-packages\pytorch_lightning\trainer\trainer.py", line 654, in _call_and_handle_interrupt
return trainer_fn(*args, **kwargs)
File "D:\virtualenv\lightning_flash\lib\site-packages\pytorch_lightning\trainer\trainer.py", line 1002, in _predict_impl
results = self._run(model, ckpt_path=self.ckpt_path)
File "D:\virtualenv\lightning_flash\lib\site-packages\pytorch_lightning\trainer\trainer.py", line 1166, in _run
results = self._run_stage()
File "D:\virtualenv\lightning_flash\lib\site-packages\pytorch_lightning\trainer\trainer.py", line 1251, in _run_stage
return self._run_predict()
File "D:\virtualenv\lightning_flash\lib\site-packages\pytorch_lightning\trainer\trainer.py", line 1310, in _run_predict
return self.predict_loop.run()
File "D:\virtualenv\lightning_flash\lib\site-packages\pytorch_lightning\loops\loop.py", line 200, in run
self.advance(*args, **kwargs)
File "D:\virtualenv\lightning_flash\lib\site-packages\pytorch_lightning\loops\dataloader\prediction_loop.py", line 102, in advance
dataloader_iter, self.current_dataloader_idx, dl_max_batches, self.num_dataloaders
File "D:\virtualenv\lightning_flash\lib\site-packages\pytorch_lightning\loops\loop.py", line 200, in run
self.advance(*args, **kwargs)
File "D:\virtualenv\lightning_flash\lib\site-packages\pytorch_lightning\loops\epoch\prediction_epoch_loop.py", line 89, in advance
batch_idx, batch = next(dataloader_iter)
File "D:\virtualenv\lightning_flash\lib\site-packages\torch\utils\data\dataloader.py", line 521, in next
data = self._next_data()
File "D:\virtualenv\lightning_flash\lib\site-packages\torch\utils\data\dataloader.py", line 561, in _next_data
data = self._dataset_fetcher.fetch(index) # may raise StopIteration
File "D:\virtualenv\lightning_flash\lib\site-packages\torch\utils\data_utils\fetch.py", line 52, in fetch
return self.collate_fn(data)
File "D:\virtualenv\lightning_flash\lib\site-packages\icevision\models\utils.py", line 88, in inner
tupled_output, records = build_batch(records)
File "D:\virtualenv\lightning_flash\lib\site-packages\icevision\models\utils.py", line 79, in inner
return build_batch(records, **build_batch_kwargs)
File "D:\virtualenv\lightning_flash\lib\site-packages\icevision\models\ross\efficientdet\dataloaders.py", line 152, in build_infer_batch
*(process_infer_record(record) for record in records)
File "D:\virtualenv\lightning_flash\lib\site-packages\icevision\models\ross\efficientdet\dataloaders.py", line 152, in
*(process_infer_record(record) for record in records)
File "D:\virtualenv\lightning_flash\lib\site-packages\icevision\models\ross\efficientdet\dataloaders.py", line 181, in process_infer_record
image = im2tensor(record.img)
AttributeError: 'dict' object has no attribute 'img'

Process finished with exit code 1

@aizaiyishunjian aizaiyishunjian added bug / fix Something isn't working help wanted Extra attention is needed labels Aug 11, 2022
@krshrimali
Copy link
Contributor

Hi, @aizaiyishunjian - Thanks for raising the issue. Unfortunately, this happened with the latest PL 1.7.0 release. We have fixed this issue here: #1410, but it might take a couple of days more.

Meanwhile, can you please try going back to PL 1.6.5 and run the example again? pip install pytorch_lightning==1.6.5 --force and then re-run the example to see if it works?

@aizaiyishunjian
Copy link
Author

@krshrimali ok, Thanks
PL 1.6.5 ,it works.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug / fix Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants