likyoo / change_detection.pytorch Goto Github PK
View Code? Open in Web Editor NEWDeep learning models for change detection of remote sensing images
License: MIT License
Deep learning models for change detection of remote sensing images
License: MIT License
In the verification step of the last step, each “tiff” cannot be opened, which causes the program to end directly and cannot view the accuracy. I guess it's the "infer_vis" problem, have you ever encountered this situation?
Hi @likyoo ,
I study with yoru repo for my project.I have been added to new features to your repo.I'll share it with you when I'm done.
But I have a significant question;
How can I load weigths after training operation?
warnings.warn("pyprof will be removed by the end of June, 2022", FutureWarning)
Traceback (most recent call last):
File "D:/WorkSpace/PythonWorkSpace/change_detection/test.py", line 60, in
y_pred = model(img1, img2)
File "D:\Software\Anconda\envs\pytorch\lib\site-packages\torch\nn\modules\module.py", line 889, in call_impl
result = self.forward(*input, **kwargs)
File "D:\WorkSpace\PythonWorkSpace\change_detection\change_detection_pytorch\base\model.py", line 35, in forward
return self.base_forward(x1, x2)
File "D:\WorkSpace\PythonWorkSpace\change_detection\change_detection_pytorch\base\model.py", line 20, in base_forward
decoder_output = self.decoder(*features)
File "D:\Software\Anconda\envs\pytorch\lib\site-packages\torch\nn\modules\module.py", line 889, in call_impl
result = self.forward(*input, **kwargs)
File "D:\WorkSpace\PythonWorkSpace\change_detection\change_detection_pytorch\unetplusplus\decoder.py", line 137, in forward
output = self.blocks[f'x{depth_idx}{depth_idx}'](features[depth_idx], features[depth_idx+1])
File "D:\Software\Anconda\envs\pytorch\lib\site-packages\torch\nn\modules\module.py", line 889, in _call_impl
result = self.forward(*input, **kwargs)
File "D:\WorkSpace\PythonWorkSpace\change_detection\change_detection_pytorch\unetplusplus\decoder.py", line 39, in forward
x = torch.cat([x, skip], dim=1)
RuntimeError: Sizes of tensors must match except in dimension 2. Got 49 and 50 (The offending index is 0)
RuntimeError: Sizes of tensors must match except in dimension 2. Got 49 and 50 (The offending index is 0)
File "H:\T\change_detection_pytorch\utils\train.py", line 97, in infer_vis
inf_seg_maps.append(np.concatenate([y_pred[i] for i in range(window_idx[row_idx],
File "<array_function internals>", line 200, in concatenate
numpy.AxisError: axis 1 is out of bounds for array of dimension 1
Can you tell me the implementation principle of this change detection network?
变化检测微信群二维码失效了,可否提供一个新的呢?
Dear Likyoo
my thesis is about change detection as well . i run your progrmam in section test model and trained it . so how can extract change image and evaluation data.
warm regsrds
We keep this issue open to collect feature requests from users and hear your voice. Our release plan is also available here.
You can either:
Suggest a new feature by leaving a comment.
Vote for a feature request with 👍 or be against with 👎.
Tell us that you would like to help implement one of the features in the list or review the PRs. (This is the greatest things to hear about!:laughing:)
There is no code for batch generation of predictive images using trained models, thank you
Hi, your project change_detection.pytorch(commit id: 0a86d51) requires "albumentations==1.0.3" in its dependency. After analyzing the source code, we found that the following versions of albumentations can also be suitable, i.e., albumentations 1.0.0, 1.0.1, 1.0.2, since all functions that you directly (8 APIs: albumentations.core.transforms_interface.BasicTransform.init, albumentations.augmentations.geometric.resize.Resize.init, albumentations.core.composition.Compose.init, albumentations.pytorch.transforms.ToTensorV2.init, albumentations.augmentations.crops.functional.random_crop, albumentations.core.transforms_interface.DualTransform.init, albumentations.augmentations.crops.transforms.RandomCrop.init, albumentations.augmentations.transforms.Normalize.init) or indirectly (propagate to 11 albumentations's internal APIs and 0 outsider APIs) used from the package have not been changed in these versions, thus not affecting your usage.
Therefore, we believe that it is quite safe to loose your dependency on albumentations from "albumentations==1.0.3" to "albumentations>=1.0.0,<=1.0.3". This will improve the applicability of change_detection.pytorch and reduce the possibility of any further dependency conflict with other projects.
May I pull a request to further loosen the dependency on albumentations?
By the way, could you please tell us whether such an automatic tool for dependency analysis may be potentially helpful for maintaining dependencies easier during your development?
Dear @likyoo thanks for your open source project. I have trained models and saved the best model. Now, how can I test model on new images (not validation)
请问为啥,两张影像输入的先后顺序不同,结果基本不一样,变化检测不是孪生网络么,理论上不应该啊? 我参考了其他的变化检测项目代码,也是一样的情况
Epoch: 0
train: 0%| | 0/269 [05:14<?, ?it/s]
Traceback (most recent call last):
File "/home/Faith/anaconda3/envs/d2l/lib/python3.8/runpy.py", line 192, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/home/Faith/anaconda3/envs/d2l/lib/python3.8/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/home/Faith/.vscode-server/extensions/ms-python.python-2023.20.0/pythonFiles/lib/python/debugpy/adapter/../../debugpy/launcher/../../debugpy/main.py", line 39, in
cli.main()
File "/home/Faith/.vscode-server/extensions/ms-python.python-2023.20.0/pythonFiles/lib/python/debugpy/adapter/../../debugpy/launcher/../../debugpy/../debugpy/server/cli.py", line 430, in main
run()
File "/home/Faith/.vscode-server/extensions/ms-python.python-2023.20.0/pythonFiles/lib/python/debugpy/adapter/../../debugpy/launcher/../../debugpy/../debugpy/server/cli.py", line 284, in run_file
runpy.run_path(target, run_name="main")
File "/home/Faith/.vscode-server/extensions/ms-python.python-2023.20.0/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 321, in run_path
return _run_module_code(code, init_globals, run_name,
File "/home/Faith/.vscode-server/extensions/ms-python.python-2023.20.0/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 135, in _run_module_code
_run_code(code, mod_globals, init_globals,
File "/home/Faith/.vscode-server/extensions/ms-python.python-2023.20.0/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 124, in _run_code
exec(code, run_globals)
File "/home/Faith/project/sim/Siamese-pytorch-bilibili/change_detection_pytorch/local_test.py", line 82, in
train_logs = train_epoch.run(train_loader)
File "/home/Faith/project/sim/Siamese-pytorch-bilibili/change_detection_pytorch/change_detection_pytorch/utils/train.py", line 114, in run
for (x1, x2, y, filename) in iterator:
File "/home/Faith/anaconda3/envs/d2l/lib/python3.8/site-packages/tqdm/std.py", line 1178, in iter
for obj in iterable:
File "/home/Faith/anaconda3/envs/d2l/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 634, in next
data = self._next_data()
File "/home/Faith/anaconda3/envs/d2l/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 678, in _next_data
data = self._dataset_fetcher.fetch(index) # may raise StopIteration
File "/home/Faith/anaconda3/envs/d2l/lib/python3.8/site-packages/torch/utils/data/_utils/fetch.py", line 51, in fetch
data = [self.dataset[idx] for idx in possibly_batched_index]
File "/home/Faith/anaconda3/envs/d2l/lib/python3.8/site-packages/torch/utils/data/_utils/fetch.py", line 51, in
data = [self.dataset[idx] for idx in possibly_batched_index]
File "/home/Faith/project/sim/Siamese-pytorch-bilibili/change_detection_pytorch/change_detection_pytorch/datasets/LEVIR_CD.py", line 54, in getitem
img1, img2, ann, filename = self.prepare_img_ann(idx)
File "/home/Faith/project/sim/Siamese-pytorch-bilibili/change_detection_pytorch/change_detection_pytorch/datasets/custom.py", line 217, in prepare_img_ann
img1, img2 = self.get_image(img_info)
File "/home/Faith/project/sim/Siamese-pytorch-bilibili/change_detection_pytorch/change_detection_pytorch/datasets/custom.py", line 178, in get_image
img2 = cv2.cvtColor(cv2.imread(img_info['img']['img2_path']), cv2.COLOR_BGR2RGB)
cv2.error: OpenCV(4.8.1) /io/opencv/modules/imgproc/src/color.cpp:182: error: (-215:Assertion failed) !_src.empty() in function 'cvtColor'
RuntimeError: Attempted to set the storage of a tensor on device "cpu" to a storage on different device "cuda:0". This is no longer allowed; the devices must match.
使用预训练模型为imagenet时会报错,其他预训练模型就可以
Since the number of data channels is not 3, I cannot use the pre-trained model. How can I modify the code
This piece of code :
for x in np.arange(0.6, 0.9, 0.1):
print('Eval with TH:', x)
metrics = [
cdp.utils.metrics.Fscore(activation='argmax2d', threshold=x),
cdp.utils.metrics.Precision(activation='argmax2d', threshold=x),
cdp.utils.metrics.Recall(activation='argmax2d', threshold=x),
]
valid_epoch = cdp.utils.train.ValidEpoch(
model,
loss=loss,
metrics=metrics,
device=DEVICE,
verbose=True,
)
valid_logs = valid_epoch.run(valid_loader)
print(valid_logs)
Give me the following result:
Eval with TH: 0.6
valid: 100%|█████████████████████████████████████████████████████████████| 505/505 [01:12<00:00, 6.98it/s, cross_entropy_loss - 0.08708, fscore - 0.8799, precision - 0.8946, recall - 0.8789]
{'cross_entropy_loss': 0.0870812193864016, 'fscore': 0.8798528309538921, 'precision': 0.8946225793644936, 'recall': 0.8789094516579565}
Eval with TH: 0.7
valid: 100%|█████████████████████████████████████████████████████████████| 505/505 [01:12<00:00, 6.99it/s, cross_entropy_loss - 0.08708, fscore - 0.8799, precision - 0.8946, recall - 0.8789]
{'cross_entropy_loss': 0.08708121913835626, 'fscore': 0.8798528309538921, 'precision': 0.8946225793644936, 'recall': 0.8789094516579565}
Eval with TH: 0.7999999999999999
valid: 100%|█████████████████████████████████████████████████████████████| 505/505 [01:11<00:00, 7.02it/s, cross_entropy_loss - 0.08708, fscore - 0.8799, precision - 0.8946, recall - 0.8789]
{'cross_entropy_loss': 0.08708121978843793, 'fscore': 0.8798528309538921, 'precision': 0.8946225793644936, 'recall': 0.8789094516579565}
您好,我在运行local_test.py文件时出现了错误,而我一直解决不了,错误如下:
RuntimeError: Expected 4-dimensional input for 4-dimensional weight [64, 3, 7, 7], but got 3-dimensional input of size [3, 256, 256] instead 我想知道[6,3,7,7]代表的是什么?
这个错误是发生在valed部分,在执行epoch1时train可以正常读取图片并运行,但到valed就报错了,希望能获得您的建议。
There is a bcl.py in losses but it is not compatible with the package and I received error. Could you please advise?
Executing the example leads to an error of mismatched devices. The model is initialized on the CPU, while during initialization weights are loaded on CUDA. Pytorch doesn't allow mismatched devices between tensors anymore. Solution: handle everythingo on the cpu until initialization is done, then move the model over to CUDA.
Hi! Thank you for this repo! I want to use these models in an App. Have you considered adding exporting functionality to TFLite?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.