Coder Social home page Coder Social logo

justchenhao / stanet Goto Github PK

View Code? Open in Web Editor NEW
384.0 11.0 109.0 1.92 MB

official implementation of the spatial-temporal attention neural network (STANet) for remote sensing image change detection

License: BSD 2-Clause "Simplified" License

Python 98.96% Shell 1.04%
change-detection remote-sensing siamese-neural-network attention-mechanism contrastive-loss dataset

stanet's Introduction

STANet for remote sensing image change detection

It is the implementation of the paper: A Spatial-Temporal Attention-Based Method and a New Dataset for Remote Sensing Image Change Detection.

Here, we provide the pytorch implementation of the spatial-temporal attention neural network (STANet) for remote sensing image change detection.

image-20200601213320103

Change log

20230311:

  • We have supplemented geospatial information (e.g., latitude and longitude coordinates) for each sample in LEVIR_CD. Specifically, we provide a geojson file and a json file, both of which contains the correspondence of the sample name and the geospatial location. Files and more information can be seen in the LEVIR_CD_spatial_info folder.

20210112:

20201105:

  • add a demo for quick start.
  • add more dataset loader modes.
  • enhance the image augmentation module (crop and rotation).

20200601:

  • first commit

Prerequisites

  • windows or Linux
  • Python 3.6+
  • CPU or NVIDIA GPU
  • CUDA 9.0+
  • PyTorch > 1.0
  • visdom

Installation

Clone this repo:

git clone https://github.com/justchenhao/STANet
cd STANet

Install PyTorch 1.0+ and other dependencies (e.g., torchvision, visdom and dominate)

Quick Start

You can run a demo to get started.

python demo.py

The input samples are in samples. After successfully run this script, you can find the predicted results in samples/output.

Prepare Datasets

download the change detection dataset

You could download the LEVIR-CD at https://justchenhao.github.io/LEVIR/;

The path list in the downloaded folder is as follows:

path to LEVIR-CD:
                ├─train
                │  ├─A
                │  ├─B
                │  ├─label
                ├─val
                │  ├─A
                │  ├─B
                │  ├─label
                ├─test
                │  ├─A
                │  ├─B
                │  ├─label

where A contains images of pre-phase, B contains images of post-phase, and label contains label maps.

cut bitemporal image pairs

The original image in LEVIR-CD has a size of 1024 * 1024, which will consume too much memory when training. Therefore, we can cut the origin images into smaller patches (e.g., 256 * 256, or 512 * 512). In our paper, we cut the original image into patches of 256 * 256 size without overlapping.

Make sure that the corresponding patch samples in the A, B, and label subfolders have the same name.

Train

Monitor training status

To view training results and loss plots, run this script and click the URL http://localhost:8097.

python -m visdom.server

train with our base method

Run the following script:

python ./train.py --save_epoch_freq 1 --angle 15 --dataroot path-to-LEVIR-CD-train --val_dataroot path-to-LEVIR-CD-val --name LEVIR-CDF0 --lr 0.001 --model CDF0 --batch_size 8 --load_size 256 --crop_size 256 --preprocess rotate_and_crop

Once finished, you could find the best model and the log files in the project folder.

train with Basic spatial-temporal Attention Module (BAM) method

python ./train.py --save_epoch_freq 1 --angle 15 --dataroot path-to-LEVIR-CD-train --val_dataroot path-to-LEVIR-CD-val --name LEVIR-CDFA0 --lr 0.001 --model CDFA --SA_mode BAM --batch_size 8 --load_size 256 --crop_size 256 --preprocess rotate_and_crop

train with Pyramid spatial-temporal Attention Module (PAM) method

python ./train.py --save_epoch_freq 1 --angle 15 --dataroot path-to-LEVIR-CD-train --val_dataroot path-to-LEVIR-CD-val --name LEVIR-CDFAp0 --lr 0.001 --model --SA_mode PAM CDFA --batch_size 8 --load_size 256 --crop_size 256 --preprocess rotate_and_crop

Test

You could edit the file val.py, for example:

if __name__ == '__main__':
    opt = TestOptions().parse()   # get training options
    opt = make_val_opt(opt)
    opt.phase = 'test'
    opt.dataroot = 'path-to-LEVIR-CD-test' # data root 
    opt.dataset_mode = 'changedetection'
    opt.n_class = 2
    opt.SA_mode = 'PAM' # BAM | PAM 
    opt.arch = 'mynet3'
    opt.model = 'CDFA' # model type
    opt.name = 'LEVIR-CDFAp0' # project name
    opt.results_dir = './results/' # save predicted images 
    opt.epoch = 'best-epoch-in-val' # which epoch to test
    opt.num_test = np.inf
    val(opt)

then run the script: python val.py. Once finished, you can find the prediction log file in the project directory and predicted image files in the result directory.

Using other dataset mode

List mode

list=train
lr=0.001
dataset_mode=list
dataroot=path-to-dataroot
name=project_name

python ./train.py --num_threads 4 --display_id 0 --dataroot ${dataroot} --val_dataroot ${dataroot} --save_epoch_freq 1 --niter 100 --angle 15 --niter_decay 100  --display_env FAp0 --SA_mode PAM --name $name --lr $lr --model CDFA --batch_size 4 --dataset_mode $dataset_mode --val_dataset_mode $dataset_mode --split $list --load_size 256 --crop_size 256 --preprocess resize_rotate_and_crop

In this case, the data structure should be the following:

"""
data structure
-dataroot
    ├─A
        ├─train1.png
        ...
    ├─B
        ├─train1.png
        ...
    ├─label
        ├─train1.png
        ...
    └─list
        ├─val.txt
        ├─test.txt
        └─train.txt

# In list/train.txt, each low writes the filename of each sample,
   # for example:
       list/train.txt
           train1.png
           train2.png
           ...
"""

Concat mode for loading multiple datasets (each default mode is List)

list=train
lr=0.001
dataset_type=CD_data1,CD_data2,...,
val_dataset_type=CD_data
dataset_mode=concat
name=project_name

python ./train.py --num_threads 4 --display_id 0 --dataset_type $dataset_type --val_dataset_type $val_dataset_type --save_epoch_freq 1 --niter 100 --angle 15 --niter_decay 100  --display_env FAp0 --SA_mode PAM --name $name --lr $lr --model CDFA --batch_size 4 --dataset_mode $dataset_mode --val_dataset_mode $dataset_mode --split $list --load_size 256 --crop_size 256 --preprocess resize_rotate_and_crop

Note, in this case, you should modify the get_dataset_info in data/data_config.py to add the corresponding dataset_name and dataroot in it.

if dataset_type == 'LEVIR_CD':
    root = 'path-to-LEVIR_CD-dataroot'
elif ...
# add more dataset ...

Other TIPS

For more Training/Testing guides, you could see the option files in the ./options/ folder.

Citation

If you use this code for your research, please cite our papers.

@Article{rs12101662,
AUTHOR = {Chen, Hao and Shi, Zhenwei},
TITLE = {A Spatial-Temporal Attention-Based Method and a New Dataset for Remote Sensing Image Change Detection},
JOURNAL = {Remote Sensing},
VOLUME = {12},
YEAR = {2020},
NUMBER = {10},
ARTICLE-NUMBER = {1662},
URL = {https://www.mdpi.com/2072-4292/12/10/1662},
ISSN = {2072-4292},
DOI = {10.3390/rs12101662}
}

Acknowledgments

Our code is inspired by pytorch-CycleGAN.

stanet's People

Contributors

justchenhao avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

stanet's Issues

about model CDF0 and CDFA

hi, thanks for your work.
BAM and PAM are the attention modules which were described in the paper.
feature ectractor is modified resnet18.
However, what is CDF0? and CDFA?

bug report in the testing phase

Hi, @justchenhao

Traceback (most recent call last):
  File "/workspace/pyroom/STANet/val.py", line 100, in <module>
    val(opt)
  File "/workspace/pyroom/STANet/val.py", line 64, in val
    score = model.test(val=True)           # run inference return confusion_matrix
  File "/workspace/pyroom/STANet/models/CDFA_model.py", line 83, in test
    metrics.update(self.L.detach().cpu().numpy(), pred.detach().cpu().numpy())
AttributeError: 'CDFAModel' object has no attribute 'L'
  1. 64th line of val.py: score = model.test(val=True)
  2. from 23th to 29th line of changedetection_dataset.py:
        self.istest = False
        if opt.phase == 'test':
            self.istest = True
        if not self.istest:
            self.L_paths = sorted(make_dataset(os.path.join(opt.dataroot, folder_L), opt.max_dataset_size))

when testing with val=True, dataset would not load the labels self.L so that it would raise a error.

Some new problems in the latest code

Thank you for maintaining this code. Your code and paper has brought us a lot of inspiration for our future work.
However, we also found some problems in the latest code. For example, the code can't be trained with multiple GPUs. And in the new version, we can't use visdom to preview the real-time detection results, because the image folder under the checkpoint folder is always blank, while other line graphs work normally.
We are looking forward to your early reply and wish you all the best in your future research.

Hi,my BASE results is better than PAM.

BASE:
(epoch: 196) Overall_Acc: 0.973 Mean_IoU: 0.787 0: 0.972 1: 0.602 precision_1: 0.612 recall_1: 0.972 F1_1: 0.751
================ val acc (Tue Jul 21 23:39:54 2020) ================
(epoch: 197) Overall_Acc: 0.972 Mean_IoU: 0.784 0: 0.971 1: 0.596 precision_1: 0.607 recall_1: 0.971 F1_1: 0.747
================ val acc (Tue Jul 21 23:40:53 2020) ================
(epoch: 198) Overall_Acc: 0.973 Mean_IoU: 0.786 0: 0.972 1: 0.600 precision_1: 0.612 recall_1: 0.970 F1_1: 0.750
================ val acc (Tue Jul 21 23:41:53 2020) ================
(epoch: 199) Overall_Acc: 0.968 Mean_IoU: 0.766 0: 0.967 1: 0.565 precision_1: 0.572 recall_1: 0.977 F1_1: 0.722
================ val acc (Tue Jul 21 23:42:53 2020) ================
(epoch: 200) Overall_Acc: 0.970 Mean_IoU: 0.773 0: 0.969 1: 0.577 precision_1: 0.585 recall_1: 0.974 F1_1: 0.731

PAM:

================ val acc (Sun Jul 19 21:39:19 2020) ================
(epoch: 196) Overall_Acc: 0.976 Mean_IoU: 0.532 0: 0.976 1: 0.087 precision_1: 0.466 recall_1: 0.097 F1_1: 0.161
================ val acc (Sun Jul 19 21:39:40 2020) ================
(epoch: 197) Overall_Acc: 0.976 Mean_IoU: 0.534 0: 0.976 1: 0.092 precision_1: 0.443 recall_1: 0.104 F1_1: 0.168
================ val acc (Sun Jul 19 21:40:01 2020) ================
(epoch: 198) Overall_Acc: 0.976 Mean_IoU: 0.528 0: 0.976 1: 0.079 precision_1: 0.502 recall_1: 0.086 F1_1: 0.147
================ val acc (Sun Jul 19 21:40:23 2020) ================
(epoch: 199) Overall_Acc: 0.976 Mean_IoU: 0.535 0: 0.975 1: 0.095 precision_1: 0.424 recall_1: 0.109 F1_1: 0.174
================ val acc (Sun Jul 19 21:40:45 2020) ================
(epoch: 200) Overall_Acc: 0.976 Mean_IoU: 0.529 0: 0.976 1: 0.081 precision_1: 0.476 recall_1: 0.089 F1_1: 0.150

关于预训练模型的问题

我使用了您提供的Pre-train Module,进行测试,测试结果F1为0.881,而论文中F1为87.3。请问您是取了多次的平均值吗?

when I test the PAM model , I find the issue "AttributeError: 'PAM' object has no attribute 'query_conv'", the issue is like :

dataset [ChangeDetectionDataset] was created
using mynet3 backbone
arch: mynet3
in_c: 3
ds: 1
model [CDFAModel] was created
loading the model from ./checkpoints/LEVIR-CDFA0/latest_net_F.pth
loading the model from ./checkpoints/LEVIR-CDFA0/latest_net_A.pth
Traceback (most recent call last):
File "test.py", line 113, in
val(opt)
File "test.py", line 47, in val
model.setup(opt) # regular setup: load and print networks; create schedulers
File "/data2/zhouyuan/CHANGE_PROJECT/STANet-master/STANet-master/models/base_model.py", line 119, in setup
self.load_networks(load_suffix)
File "/data2/zhouyuan/CHANGE_PROJECT/STANet-master/STANet-master/models/base_model.py", line 243, in load_networks
self.__patch_instance_norm_state_dict(state_dict, net, key.split('.'))
File "/data2/zhouyuan/CHANGE_PROJECT/STANet-master/STANet-master/models/base_model.py", line 213, in __patch_instance_norm_state_dict
self.__patch_instance_norm_state_dict(state_dict, getattr(module, key), keys, i + 1)
File "/data2/zhouyuan/CHANGE_PROJECT/STANet-master/STANet-master/models/base_model.py", line 213, in __patch_instance_norm_state_dict
self.__patch_instance_norm_state_dict(state_dict, getattr(module, key), keys, i + 1)
File "/data2/zhouyuan/anaconda3.5/envs/torch_py36/lib/python3.6/site-packages/torch/nn/modules/module.py", line 539, in getattr
type(self).name, name))
AttributeError: 'PAM' object has no attribute 'query_conv'

Which training method is better?

First of all congratulate you on the great work done, the code is wonderful.

My question is about what differences exist between the three different training methods( PAM,BAM , etc) and which is better and more precise.

Thank you very much for your attention

codes

are you upload your codes?

about label

learned a lot from you, thanks. one more question. how can I label my own image dataset just like LEVIR-CD, is there any tools or code?

Issue in BCL Loss.

@justchenhao

class BCL(nn.Module):
    """
    batch-balanced contrastive loss
    no-change,1
    change,-1
    """

    def __init__(self, margin=2.0):
        super(BCL, self).__init__()
        self.margin = margin

    def forward(self, distance, label):
        label[label==255] = 1
        mask = (label != 255).float()
        distance = distance * mask
        pos_num = torch.sum((label==1).float())+0.0001
        neg_num = torch.sum((label==-1).float())+0.0001

        loss_1 = torch.sum((1+label) / 2 * torch.pow(distance, 2)) /pos_num
        loss_2 = torch.sum((1-label) / 2 *
            torch.pow(torch.clamp(self.margin - distance, min=0.0), 2)
        ) / neg_num
        loss = loss_1 + loss_2
        return loss

In this code why are you doing label[label==255] = 1, because label is already transformed in -1 and 1. The mask tensor below it will also be always completely 1.

val.py

image
请问这是什么问题,有大佬知道吗?

How to train with my own dataset?

Thanks for your work.
I want to use your model for training, and at the same time change the learning rate drop method and data augmentation method during training. What should I do?

请问您的gpu是多大的,总是会爆下面的错误

Traceback (most recent call last): File "train.py", line 142, in <module> model.optimize_parameters() # calculate loss functions, get gradients, update network weights File "/home/user/zxm/stanet/STANet-master1/STANet-master/models/CDFA_model.py", line 122, in optimize_parameters self.backward() # calculate graidents for G File "/home/user/zxm/stanet/STANet-master1/STANet-master/models/CDFA_model.py", line 108, in backward self.loss.backward() File "/home/user/anaconda3/lib/python3.6/site-packages/torch/tensor.py", line 118, in backward torch.autograd.backward(self, gradient, retain_graph, create_graph) File "/home/user/anaconda3/lib/python3.6/site-packages/torch/autograd/__init__.py", line 93, in backward allow_unreachable=True) # allow_unreachable flag RuntimeError: CUDA out of memory. Tried to allocate 2.00 GiB (GPU 3; 7.43 GiB total capacity; 5.01 GiB already allocated; 1.92 GiB free; 12.36 MiB cached)

关于模型参数量

感谢您的工作。
请问 BAM 和 PAM 的模型参数量和 FLOPs 情况如何呢?

image size

您好,请问512x512的图片可以训练吗,我用了,但是报显存不足,我换了台机器,问题还存在;
CDFA+PAM, 512x512,batch_size=1,12G显存,应该可以啊

AssertionError: X and Y should be the same shape

Setting up a new session...
create web directory ./checkpoints\LEVIR-CDF0\web...
(epoch: 1, iters: 200, time: 0.033, data: 4.480) f: 1.110
(epoch: 1, iters: 400, time: 0.048, data: 1.109) f: 0.909
Traceback (most recent call last):
File "./train.py", line 148, in
visualizer.plot_current_losses(epoch, float(epoch_iter) / dataset_size, losses)
File "D:\xunleiDownload\STANet-master\util\visualizer.py", line 212, in plot_current_losses
win=self.display_id)
File "D:\Software\anaconda3\envs\pytorch_gpu\lib\site-packages\visdom_init_.py", line 389, in wrapped_f
return f(*args, **kwargs)
File "D:\Software\anaconda3\envs\pytorch_gpu\lib\site-packages\visdom_init_.py", line 1694, in line
assert X.shape == Y.shape, 'X and Y should be the same shape'
AssertionError: X and Y should be the same shape

Please help me what should I do next.

Test without label

Hello, I would like to know how it would be possible to test without the label layer, that is, only the image from before and the image from after.

I imagine the code could be modified to do this.
Thank you very much for your attention . I await your response .

Why the precision_1 is about 6.30 whatever base,bam,pam?

I train your code,but get precision_1 is about 6.3 whatever base,bam,pam.

base:
================ val acc (Sun Jun 14 01:54:07 2020) ================
(epoch: 200) Overall_Acc: 0.975 Mean_IoU: 0.796 0: 0.974 1: 0.617 precision_1: 0.633 recall_1: 0.962 F1_1: 0.763

bam:
================ val acc (Sat Jun 13 18:21:13 2020) ================
(epoch: 200) Overall_Acc: 0.975 Mean_IoU: 0.794 0: 0.974 1: 0.615 precision_1: 0.630 recall_1: 0.963 F1_1: 0.762

pam:
================ val acc (Sun Jun 14 06:59:22 2020) ================
(epoch: 200) Overall_Acc: 0.975 Mean_IoU: 0.794 0: 0.974 1: 0.614 precision_1: 0.629 recall_1: 0.963 F1_1: 0.761

congratulations

HI congratulations
thanks a lot for your code
I learn lot of things about your code

模型测试

可不可以先把val的测试图片切成256x256的图片呢,测试后在拼接成原图片可以吧,要不然会出现图片信息损失问题

implementation detail about SZRAKI dataset

Hi, in section 2.3 ( Implementation Details) of your paper, It said that when training on the SZTAKI dataset, the patch size is set to 784x448, which changes to 113x113 in the testing phase, however. But how can we adopt different sizes of images during training and testing?

I got a question in training bam model.AttributeError: 'Namespace' object has no attribute 'weighted'

Traceback (most recent call last):
File "./train.py", line 109, in
model = create_model(opt) # create a model given opt.model and other options
File "/home/louxiantuo/STANet/models/init.py", line 65, in create_model
instance = model(opt)
File "/home/louxiantuo/STANet/models/CDFA_model.py", line 53, in init
self.isweighted = opt.weighted
AttributeError: 'Namespace' object has no attribute 'weighted'

What should I do?

AttributeError: 'Namespace' object has no attribute 'weighted'

Traceback (most recent call last):
File "F:/STANet-master/train.py", line 109, in
model = create_model(opt) # create a model given opt.model and other options
File "F:\STANet-master\models_init_.py", line 65, in create_model
instance = model(opt)
File "F:\STANet-master\models\CDFA_model.py", line 53, in init
self.isweighted = opt.weighted
AttributeError: 'Namespace' object has no attribute 'weighted'

this caused: CDFA_model.py line 53
self.isweighted = opt.weighted
no attribute 'weighted' specified in base_options.py/train_options.py

image size in the testing phase

Hey, BUAAer@justchenhao

Great works! Thanks for sharing the LEVIR-CD dataset.

I wonder if all the results on the LEVIR-CD data(i.e Table 4 and Table 5 in the paper) are obtained from testing directly with input size 1024x1024? Or on 256x256 patches and then stitch these patches into a full size image?

And would you like to build a public leadbord with this dataset for Building Change Detection from Remote Sensing Images? e.g. on https://paperswithcode.com/?

about the loss functional

您好,我想问问关于loss函数,我在CDFA_model看到
self.L_s[self.L_s == 1] = -1 # change
self.L_s[self.L_s == 0] = 1 # no change
在loss.py里看到
class BCL(nn.Module):
"""
batch-balanced contrastive loss
no-change,1
change,-1
"""

def __init__(self, margin=2.0):
    super(BCL, self).__init__()
    self.margin = margin

def forward(self, distance, label):
    label[label == 255] = 1
    mask = (label != 255).float()
    distance = distance * mask
    pos_num = torch.sum((label == 1).float()) + 0.0001
    neg_num = torch.sum((label == -1).float()) + 0.0001

    loss_1 = torch.sum((1 + label) / 2 * torch.pow(distance, 2)) / pos_num
    loss_2 = torch.sum((1 - label) / 2 *
                       torch.pow(torch.clamp(self.margin - distance, min=0.0), 2)
                       ) / neg_num
    loss = loss_1 + loss_2
    return loss

为什么要这样写啊,或者说不改变label的值,就是原来的0和1,loss函数要怎么修改,margin的值怎么写;
还有loss函数forward下面第一句label[label == 255] = 1是不是没有用啊;
mask = (label != 255).float()
distance = distance * mask
这个好像也没用
@justchenhao

ImportError

from models.base_model import BaseModel
File "./STANet-master/models/base_model.py", line 4, in
from abc import ABC, abstractmethod
ImportError: cannot import name ABC

val.py

 tmp = np.array(Image.open(L_path), dtype=np.uint32)/255
 L_img = Image.fromarray(tmp)
 transform_L = get_transform(self.opt, transform_params, method=Image.NEAREST, normalize=False,
                                    test=self.istest)
 L = transform_L(L_img)

why L is not same as A and B, and it is an error:

TypeError: Cannot handle this data type

Thankyou for your answers.

RuntimeError: CUDA out of memory during running of val.py

Dear author,
Thank you so much for sharing a very useful code.

i found the following error during running your val.py file, using your testing dataset with provided pretrained model:

Runtime Error: CUDA out of memory. Tried to allocate 64.00 GiB (GPU 0; 10.92 GiB total capacity; 240.92 MiB already allocated; 10.11 GiB free; 43.08 MiB cached)

My system has pytorch 1.0 with CUDA Version: 10.0

I tried to find its solution. Generally solutions are: reduce batch size, reduce the size of input images, or use latest stable version of pytorch. For testing batch size is already 1, I reduced the size of input images upto 64x64. and also install new version of pytorch in anaconda environment with "conda install pytorch torchvision cudatoolkit=10.0 -c pytorch". But i am unable to fix this problem.

How can I fix this issue?
Kindly help. Thank you!

test problem

当我使用PAM和CDFA选项测试时,出现了错误,请问是什么问题?
image

I can't reproduce the results in the paper

Hi. I can't reproduce the results in the paper. I wonder if there is a problem with my training strategy or authors use selected slice images for training rather than slice images.
And I got a question that u use two independent optimizers. Is this for learning rate setting considerations or for faster convergence?

Images sizes

Hello!

I would like to know if the images feed to the neural network need to be in 1024x1024, like LEVIR-CD, or I have to create a folder and crop the A, B and label images in 256x256? Or your code already does this?

Thanks in advance!

metrics always 0.0

I use this repo to trian my own dataset.
I set the num_class = 2(change/unchange).
model converged normally.
but the precision_1/recall_1/F1_1 does not change, always 0.

val_log.txt:
(epoch: 1) Overall_Acc: 0.971 Mean_IoU: 0.486 0: 0.971 1: 0.000 precision_1: 0.000 recall_1: 0.000 F1_1: 0.000
================ val acc (Sun Jun 28 15:31:51 2020) ================
(epoch: 2) Overall_Acc: 0.977 Mean_IoU: 0.489 0: 0.977 1: 0.000 precision_1: 0.000 recall_1: 0.000 F1_1: 0.000
================ val acc (Sun Jun 28 15:32:57 2020) ================
(epoch: 3) Overall_Acc: 0.979 Mean_IoU: 0.490 0: 0.979 1: 0.000 precision_1: 0.000 recall_1: 0.000 F1_1: 0.000
================ val acc (Sun Jun 28 15:34:01 2020) ================
(epoch: 4) Overall_Acc: 0.983 Mean_IoU: 0.491 0: 0.983 1: 0.000 precision_1: 0.000 recall_1: 0.000 F1_1: 0.000
================ val acc (Sun Jun 28 15:35:06 2020) ================
(epoch: 5) Overall_Acc: 0.987 Mean_IoU: 0.494 0: 0.987 1: 0.000 precision_1: 0.000 recall_1: 0.000 F1_1: 0.000
================ val acc (Sun Jun 28 15:36:10 2020) ================
(epoch: 6) Overall_Acc: 0.990 Mean_IoU: 0.495 0: 0.990 1: 0.000 precision_1: 0.000 recall_1: 0.000 F1_1: 0.000
================ val acc (Sun Jun 28 15:37:16 2020) ================
(epoch: 7) Overall_Acc: 0.970 Mean_IoU: 0.485 0: 0.970 1: 0.000 precision_1: 0.000 recall_1: 0.000 F1_1: 0.000
================ val acc (Sun Jun 28 15:38:19 2020) ================
(epoch: 8) Overall_Acc: 0.986 Mean_IoU: 0.493 0: 0.986 1: 0.000 precision_1: 0.000 recall_1: 0.000 F1_1: 0.000
================ val acc (Sun Jun 28 15:39:24 2020) ================
(epoch: 9) Overall_Acc: 0.978 Mean_IoU: 0.489 0: 0.978 1: 0.000 precision_1: 0.000 recall_1: 0.000 F1_1: 0.000

my gt mask is binary image, 0 or 1.

Precision recall computation.

Hi,
I have my own implementation of precision and recall which is giving precision f1 score of 0.3 while the implementation in this repo is giving a f1 score of 0.8.
I saw that the score is implemented in a very unfamiliar way?
Could you check if your implementation is correct?

How to crop the val dataset?

Thanks for sharing the code, I have a question. How to crop the val data set to a size of 256×256? Is there a detailed code? Can you share it, thank you!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.