wgcban/ChangeFormer

While multiclass, ValueError: cannot reshape array of size 10 into shape (2,2)@wangqingl If you have 10 classes you need to write separate visualizer to visualize all the classes. Since, you removed `pred * 255` your values the `output.png` will be between 0 and 9 - hence you see dark (or black) output. You need to write the visualizer such that it will assign different color values for each predicted output class.

StorywithLove opened this issue · 3 comments

When I made modifications according to the above method, the following error occurred during training. How to solve it? @wangqingl If you have 10 classes you need to write separate visualizer to visualize all the classes. Since, you removed pred * 255 your values the output.png will be between 0 and 9 - hence you see dark (or black) output. You need to write the visualizer such that it will assign different color values for each predicted output class.

Originally posted by @wgcban in #88 (comment)

So far it's been found that it's due to hyperparameters not being passed into the function correctly, and the solution is as follows:

image

Summary of the changes needed to modify binary change detection to multi-class change detection:

(1) run_ChangeFormer_cj.sh
n_class=8 and make it a hyperparameter to python main.py

(2) models/networks.py
net = ChangeFormerV6(embed_dim=args.embed_dim, output_nc=args.n_class)

(3) models/basic_model.py
Comment out: pred_vis = pred * 255, i.e., modifications to visualisation processing

(4) models/trainer.py
Modify: ConfuseMatrixMeter(n_class=self.n_class)

wgcban commented

@Programming-Music Thank you for summarizing all these steps! It will be really helpful for those who wish to use ChangeFormer for multi-class change detection.