Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

compute_stats.py [for type mode] #133

Closed
MTalhaAbdullah opened this issue Jun 20, 2021 · 5 comments
Closed

compute_stats.py [for type mode] #133

MTalhaAbdullah opened this issue Jun 20, 2021 · 5 comments

Comments

@MTalhaAbdullah
Copy link

I failed to get compute_stats output using this command:

python compute_stats.py --mode=type --pred_dir=/home/hovernet/mydrive/HoverNet/hover_net/logs/infer_output/mat --true_dir=/home/hovernet/mydrive/HoverNet/hover_net/dataset/CoNSeP/Test/Labels

Traceback (most recent call last):
File "compute_stats.py", line 248, in
run_nuclei_type_stat(args.pred_dir, args.true_dir)
File "compute_stats.py", line 104, in run_nuclei_type_stat
paired_all = np.concatenate(paired_all, axis=0)
File "<array_function internals>", line 6, in concatenate
ValueError: need at least one array to concatenate

Apparently, the code failed to get the correct .mat files in the predictions folder. After opening the prediction .mat file, I only got "inst_map" and inst_type. I wonder there is no "inst_centroid" in the prediction folder got through inference.

@MTalhaAbdullah
Copy link
Author

Please guide what am I doing wrong?

python run_infer.py --nr_types=5 --type_info_path=/home/hovernet/mydrive/HoverNet/hover_net/type_info.json --model_path=logs/01/net_epoch=50.tar --model_mode=original tile --input_dir=/home/hovernet/mydrive/HoverNet/hover_net/dataset/CoNSeP/Test/Images --output_dir=/home/hovernet/mydrive/HoverNet/hover_net/logs/infer_output
I am using this command for inference

vqdang added a commit that referenced this issue Jun 20, 2021
@vqdang
Copy link
Owner

vqdang commented Jun 20, 2021

You are not doing anything wrong. The current saving format for .mat is infact quite different compared to the format expected by the old stat code. Rerun inference should now have format as expected by metric code. Still, for consep you need to uncomment

# * for converting the GT type in CoNSeP
# true_inst_type[(true_inst_type == 3) | (true_inst_type == 4)] = 3
# true_inst_type[(true_inst_type == 5) | (true_inst_type == 6) | (true_inst_type == 7)] = 4

@MTalhaAbdullah
Copy link
Author

You are not doing anything wrong. The current saving format for .mat is infact quite different compared to the format expected by the old stat code. Rerun inference should now have format as expected by metric code. Still, for consep you need to uncomment

# * for converting the GT type in CoNSeP
# true_inst_type[(true_inst_type == 3) | (true_inst_type == 4)] = 3
# true_inst_type[(true_inst_type == 5) | (true_inst_type == 6) | (true_inst_type == 7)] = 4

Still same error, compute_stats.py is not working for type mode.

@MTalhaAbdullah
Copy link
Author

MTalhaAbdullah commented Jul 1, 2021

I failed to get compute_stats output using this command:

python compute_stats.py --mode=type --pred_dir=/home/hovernet/mydrive/HoverNet/hover_net/logs/infer_output/mat --true_dir=/home/hovernet/mydrive/HoverNet/hover_net/dataset/CoNSeP/Test/Labels

Traceback (most recent call last):
File "compute_stats.py", line 248, in
run_nuclei_type_stat(args.pred_dir, args.true_dir)
File "compute_stats.py", line 104, in run_nuclei_type_stat
paired_all = np.concatenate(paired_all, axis=0)
File "<array_function internals>", line 6, in concatenate
ValueError: need at least one array to concatenate

Apparently, the code failed to get the correct .mat files in the predictions folder. After opening the prediction .mat file, I only got "inst_map" and inst_type. I wonder there is no "inst_centroid" in the prediction folder got through inference.

Same issue as earlier, maybe the order of dictionary keys in prediction .mat files causing error. Shouldn't the order of inst_uid and inst_type be the same as GT ?

@MTalhaAbdullah
Copy link
Author

@vqdang Thank you so much, now it's working. I just had to add "/" at the end of the path to make it run.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants