Skip to content

Commit 5ad5014

Browse files
committed
minor updates
1 parent adaad97 commit 5ad5014

11 files changed

+95
-93
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ conda create -n DAL-HERS python=3.8.5 anaconda
1616
1717
conda activate DAL-HERS
1818
```
19-
Then the user may need to install a few other Python packages, such as pytorch, torchvision, opencv, etc. These packages can be installed with pip in terminal.
19+
The user may need to install a few other Python packages, such as pytorch, torchvision, opencv, etc. These packages can be installed with pip in terminal.
2020

2121

2222
## Model set-up

analysis_multi_nC.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
parser.add_argument('--input_dir', default='./sample_imgs/input/', help='path to images folder')
4040
parser.add_argument('--output_dir', default='./sample_imgs/output/', help='path to output folder')
4141
parser.add_argument('--output_suff', default='', help='suffix to the output file')
42-
parser.add_argument('--edge', default=True, help='whether to incorporate edge information')
42+
parser.add_argument('--edge', default=False, help='whether to incorporate edge information')
4343
parser.add_argument('--device', default=torch.device("cuda:0" if torch.cuda.is_available() else "cpu"), help='default device (CPU / GPU)')
4444
args = parser.parse_args()
4545

@@ -125,4 +125,4 @@ def main():
125125

126126
if __name__ == '__main__':
127127

128-
main()
128+
main()

analysis_single_nC.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@
3636
parser = argparse.ArgumentParser(description='DAL-HERS Superpixel Segmentation on a folder of images',
3737
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
3838
parser.add_argument('--nC', default=200, type=int, help='the number of desired superpixels')
39-
parser.add_argument('--pretrained', default='./pretrained/DGSS_loss=bce-rgb_date=23Feb2021.tar', help='path to the pretrained model')
39+
parser.add_argument('--pretrained', default='./pretrained/DAL_loss=bce-rgb_date=23Feb2021.tar', help='path to the pretrained model')
4040
parser.add_argument('--input_dir', default='./sample_imgs/input/', help='path to images folder')
4141
parser.add_argument('--output_dir', default='./sample_imgs/output/', help='path to output folder')
4242
parser.add_argument('--output_suff', default='', help='suffix to the output file')
43-
parser.add_argument('--edge', default=True, help='whether to incorporate edge information')
43+
parser.add_argument('--edge', default=False, help='whether to incorporate edge information')
4444
parser.add_argument('--device', default=torch.device("cuda:0" if torch.cuda.is_available() else "cpu"), help='default device (CPU / GPU)')
4545
args = parser.parse_args()
4646

@@ -120,4 +120,4 @@ def main():
120120

121121
if __name__ == '__main__':
122122

123-
main()
123+
main()

pybuild/boruvka_superpixel.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -557,7 +557,8 @@ void BoruvkaSuperpixel::build_hierarchy()
557557
int label1 = label_[edge->v1];
558558

559559
double dist_feat = calc_dist(edge, boruvka_iter);
560-
double dist = edge->gain_ / dist_feat;
560+
double dist = edge->gain_ / dist_feat; // entropy rate and RGB info
561+
//double dist = edge->gain_; // entropy rate only
561562

562563
if (dist > min_pair[label0].value) {
563564
min_pair[label0].value = dist;

pybuild/boruvka_superpixel.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
}
2323

2424
#define PENALTY 1e-8
25-
#define MIN_VALUE 1e-20
25+
#define MIN_VALUE 1e-50
2626

2727
struct Edge {
2828
int v0; // vertex 0

pybuild/boruvka_superpixel_wrap.cpp

+83-83
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Binary file not shown.
Binary file not shown.
Binary file not shown.

src/boruvka_superpixel.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -557,7 +557,8 @@ void BoruvkaSuperpixel::build_hierarchy()
557557
int label1 = label_[edge->v1];
558558

559559
double dist_feat = calc_dist(edge, boruvka_iter);
560-
double dist = edge->gain_ / dist_feat;
560+
double dist = edge->gain_ / dist_feat; // entropy rate and RGB info
561+
//double dist = edge->gain_; // entropy rate only
561562

562563
if (dist > min_pair[label0].value) {
563564
min_pair[label0].value = dist;

src/boruvka_superpixel.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
}
2323

2424
#define PENALTY 1e-8
25-
#define MIN_VALUE 1e-20
25+
#define MIN_VALUE 1e-50
2626

2727
struct Edge {
2828
int v0; // vertex 0

0 commit comments

Comments
 (0)