Usage of FCSiamConc
See original GitHub issueWhen I used FCSiamConc model on Levir dataset I got
‘FCSiamConc’ object has no attribute ‘_current_fx_name’ error.Have you any suggestion for that?
from torch.utils.data import DataLoader
from torchgeo.datasets import LEVIRCDPlus
from torchgeo.models import FCSiamConc
from pytorch_lightning import Trainer
dataset = LEVIRCDPlus(root="lev", split="train", download=True, checksum=True)
dataloader = DataLoader(dataset, batch_size=4, shuffle=True, num_workers=4)
for sample in dataloader:
image = sample["image"]
target = sample["mask"]
model=FCSiamConc(classes=2)
trainer = Trainer(
gpus=1,
max_epochs=30,
progress_bar_refresh_rate=30,
)
trainer.fit(model, dataloader)
_AttributeError Traceback (most recent call last)
Input In [1], in <cell line: 19>()
11 model=FCSiamConc(classes=2)
13 trainer = Trainer(
14 gpus=1,
15 max_epochs=30,
16 progress_bar_refresh_rate=30,
17 )
---> 19 trainer.fit(model, dataloader)
File ~\anaconda3\envs\thesis\lib\site-packages\pytorch_lightning\trainer\trainer.py:740, in Trainer.fit(self, model, train_dataloaders, val_dataloaders, datamodule, train_dataloader, ckpt_path)
735 rank_zero_deprecation(
736 "`trainer.fit(train_dataloader)` is deprecated in v1.4 and will be removed in v1.6."
737 " Use `trainer.fit(train_dataloaders)` instead. HINT: added 's'"
738 )
739 train_dataloaders = train_dataloader
--> 740 self._call_and_handle_interrupt(
741 self._fit_impl, model, train_dataloaders, val_dataloaders, datamodule, ckpt_path
742 )
File ~\anaconda3\envs\thesis\lib\site-packages\pytorch_lightning\trainer\trainer.py:685, in Trainer._call_and_handle_interrupt(self, trainer_fn, *args, **kwargs)
675 r"""
676 Error handling, intended to be used only for main trainer function entry points (fit, validate, test, predict)
677 as all errors should funnel through them
(...)
682 **kwargs: keyword arguments to be passed to `trainer_fn`
683 """
684 try:
--> 685 return trainer_fn(*args, **kwargs)
686 # TODO: treat KeyboardInterrupt as BaseException (delete the code below) in v1.7
687 except KeyboardInterrupt as exception:
File ~\anaconda3\envs\thesis\lib\site-packages\pytorch_lightning\trainer\trainer.py:777, in Trainer._fit_impl(self, model, train_dataloaders, val_dataloaders, datamodule, ckpt_path)
775 # TODO: ckpt_path only in v1.7
776 ckpt_path = ckpt_path or self.resume_from_checkpoint
--> 777 self._run(model, ckpt_path=ckpt_path)
779 assert self.state.stopped
780 self.training = False
File ~\anaconda3\envs\thesis\lib\site-packages\pytorch_lightning\trainer\trainer.py:1125, in Trainer._run(self, model, ckpt_path)
1122 # attach model to the training type plugin
1123 self.training_type_plugin.connect(model)
-> 1125 self._callback_connector._attach_model_callbacks()
1126 self._callback_connector._attach_model_logging_functions()
1128 verify_loop_configurations(self)
File ~\anaconda3\envs\thesis\lib\site-packages\pytorch_lightning\trainer\connectors\callback_connector.py:266, in CallbackConnector._attach_model_callbacks(self)
258 def _attach_model_callbacks(self) -> None:
259 """Attaches the callbacks defined in the model.
260
261 If a callback returned by the model's configure_callback method has the same type as one or several
(...)
264 will be pushed to the end of the list, ensuring they run last.
265 """
--> 266 model_callbacks = self.trainer.call_hook("configure_callbacks")
267 if not model_callbacks:
268 return
File ~\anaconda3\envs\thesis\lib\site-packages\pytorch_lightning\trainer\trainer.py:1486, in Trainer.call_hook(self, hook_name, pl_module, *args, **kwargs)
1484 pl_module = self.lightning_module or pl_module
1485 if pl_module:
-> 1486 prev_fx_name = pl_module._current_fx_name
1487 pl_module._current_fx_name = hook_name
1489 # always profile hooks
File ~\anaconda3\envs\thesis\lib\site-packages\torch\nn\modules\module.py:1177, in Module.__getattr__(self, name)
1175 if name in modules:
1176 return modules[name]
-> 1177 raise AttributeError("'{}' object has no attribute '{}'".format(
1178 type(self).__name__, name))
AttributeError: 'FCSiamConc' object has no attribute '_current_fx_name'_
Issue Analytics
- State:
- Created a year ago
- Comments:6 (1 by maintainers)
Top Results From Across the Web
torchgeo.models.fcsiam — torchgeo 0.4.0.dev0 documentation
If you use this model in your research, please cite the following paper: ... Callable[[Tensor], Tensor]]] = None, ): """Initialize a new FCSiamConc...
Read more >torch-rs - PyPI
The dataset contains building/land use change masks from 20 different regions ... import torch from torchrs.models import FCEF, FCSiamConc, ...
Read more >Joint Frequency-Spatial Domain Network for Remote Sensing ...
In image processing, the spatial domain uses grayscale values to describe an image. The frequency is directly related to the spatial change rate, ......
Read more >Usage of FCSiamConc - 软件工程师- 开源软件问题中文版
Usage of FCSiamConc 当我在Levir DataSet上使用FCSIAMCONC模型时,我得到了'fcsiamconc'对象没有属性'_current_fx_name'错误。
Read more >torchrs | PyTorch implementation of popular datasets - kandi
torchrs is a Python library typically used in Internet of Things (IoT), Deep Learning, ... import torch from torchrs.models import FCEF, FCSiamConc, ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
torchgeo.models.FCSiamConc
isn’t a LightningModuleI think we should have a ChangeDetectionTask which I think would solve the confusion here since we can’t currently use FCSiam models with our current SegmentationTask.