Beispiel #1
0
 def test_unet_ks331_ns_cli(self):
     args = self.train_args + (f'-o {self.out_dir}/unet.mdl -na unet -ne 1 -nl 2 -cbp 1 -ps 16 16 16 -bs 2 -dm 3 '
                               f'-ocf {self.jsonfn} -ks 3 3 1 -ns -ic').split()
     retval = nn_train(args)
     self.assertEqual(retval, 0)
     self._modify_ocf(self.jsonfn)
     retval = nn_predict([self.jsonfn])
     self.assertEqual(retval, 0)
Beispiel #2
0
 def test_nconv_3d_var_cli(self):
     args = self.train_args + (f'-o {self.out_dir}/nconv.mdl -na nconv -ne 1 -nl 1 -cbp 1 -bs 1 -dm 3 '
                               f'-ocf {self.jsonfn}').split()
     retval = nn_train(args)
     self.assertEqual(retval, 0)
     self._modify_ocf(self.jsonfn, calc_var=True)
     retval = nn_predict([self.jsonfn])
     self.assertEqual(retval, 0)
Beispiel #3
0
 def test_unet_resblock_3d_cli(self):
     args = self.train_args + (f'-o {self.out_dir}/unet.mdl -na unet -ne 1 -nl 3 -cbp 1 -ps 16 16 16 -bs 2 -dm 3 '
                               f'-ocf {self.jsonfn} -acv -rb').split()
     retval = nn_train(args)
     self.assertEqual(retval, 0)
     self._modify_ocf(self.jsonfn)
     retval = nn_predict([self.jsonfn])
     self.assertEqual(retval, 0)
Beispiel #4
0
 def test_unet_cwattention_semi3d_cli(self):
     args = self.train_args + (f'-o {self.out_dir}/unet.mdl -na unet -ne 1 -nl 2 -cbp 4 -bs 4 -ps 8 8 8 -dm 3 '
                               f'-ocf {self.jsonfn} -at channel -ks 3 3 1 -ic -s3 2').split()
     retval = nn_train(args)
     self.assertEqual(retval, 0)
     self._modify_ocf(self.jsonfn)
     retval = nn_predict([self.jsonfn])
     self.assertEqual(retval, 0)
Beispiel #5
0
 def test_vae_3d_cli(self):
     args = self.train_args + (f'-o {self.out_dir}/vae.mdl -na vae -ne 1 -nl 3 -cbp 1 -ps 16 16 16 -bs 4 -dm 3 '
                               f'--img-dim 16 16 16 --latent-size 10 -ocf {self.jsonfn}').split()
     retval = nn_train(args)
     self.assertEqual(retval, 0)
     self._modify_ocf(self.jsonfn)
     retval = nn_predict([self.jsonfn])
     self.assertEqual(retval, 0)
Beispiel #6
0
 def test_nconv_restarts_cli(self):
     args = self.train_args + (f'-o {self.out_dir}/nconv_patch.mdl -na nconv -ne 3 -nl 1 -ps 16 16 '
                               f'-ocf {self.jsonfn} -bs 2 -lrs cosinerestarts -tm 2 -rp 2 -v').split()
     retval = nn_train(args)
     self.assertEqual(retval, 0)
     self._modify_ocf(self.jsonfn)
     retval = nn_predict([self.jsonfn])
     self.assertEqual(retval, 0)
Beispiel #7
0
 def test_nconv_whole_img_cli(self):
     args = self.train_args + (f'-o {self.out_dir}/nconv_patch.mdl -na nconv -ne 1 -nl 1 -dm 3 '
                               f'-ocf {self.jsonfn} -bs 1').split()
     retval = nn_train(args)
     self.assertEqual(retval, 0)
     self._modify_ocf(self.jsonfn)
     retval = nn_predict([self.jsonfn])
     self.assertEqual(retval, 0)
Beispiel #8
0
 def test_nconv_amsgrad_cli(self):
     args = self.train_args + (f'-o {self.out_dir}/nconv_patch.mdl -na nconv -ne 3 -nl 1 -ps 16 16 '
                               f'-ocf {self.jsonfn} -bs 2 -v -opt amsgrad').split()
     retval = nn_train(args)
     self.assertEqual(retval, 0)
     self._modify_ocf(self.jsonfn)
     retval = nn_predict([self.jsonfn])
     self.assertEqual(retval, 0)
Beispiel #9
0
 def test_unburn_3d_cli(self):
     args = self.train_args + (
         f'-o {self.out_dir}/unburnnet.mdl -na unburnnet -ne 1 -nl 1 -cbp 1 -ps 32 32 32 -bs 4 -dm 3 '
         f'-ocf {self.jsonfn} -ls 5 -dp 0.5').split()
     retval = nn_train(args)
     self.assertEqual(retval, 0)
     self._modify_ocf(self.jsonfn, mc=2)
     retval = nn_predict([self.jsonfn])
     self.assertEqual(retval, 0)
Beispiel #10
0
 def test_nconv_nopatch_cli(self):
     args = self.train_args + (f'-o {self.out_dir}/nconv_nopatch.mdl -na nconv -ne 1 -nl 2 -bs 2 -dm 3 '
                               f'--plot-loss {self.out_dir}/loss.png -ocf {self.jsonfn} '
                               f'-vsd {self.train_dir} -vtd {self.train_dir} -v').split()
     retval = nn_train(args)
     self.assertEqual(retval, 0)
     self._modify_ocf(self.jsonfn)
     retval = nn_predict([self.jsonfn])
     self.assertEqual(retval, 0)
Beispiel #11
0
 def test_nconv_tif_predict_cli(self):
     train_args = f'-s {self.train_dir}/tif/ -t {self.train_dir}/tif/'.split()
     args = train_args + (f'-o {self.out_dir}/nconv.mdl -na nconv -ne 1 -nl 1 -cbp 1 -bs 2 -e tif '
                          f'-ocf {self.jsonfn}').split()
     retval = nn_train(args)
     self.assertEqual(retval, 0)
     self._modify_ocf(self.jsonfn, calc_var=True, tif_out=True)
     retval = nn_predict([self.jsonfn])
     self.assertEqual(retval, 0)
Beispiel #12
0
 def test_nconv_color_tb_cli(self):
     train_args = f'-s {self.train_dir}/color/ -t {self.train_dir}/color/'.split()
     args = train_args + (f'-o {self.out_dir}/nconv.mdl -na nconv -ne 1 -nl 1 -cbp 1 -bs 2 -e png -co -dm 2 '
                          f'-ocf {self.jsonfn} -tb').split()
     retval = nn_train(args)
     self.assertEqual(retval, 0)
     self._modify_ocf(self.jsonfn, color_out=True, bs=1)
     retval = nn_predict([self.jsonfn])
     self.assertEqual(retval, 0)
Beispiel #13
0
 def test_unet_cwattention_2d_cli(self):
     train_args = f'-s {self.train_dir}/tif/ -t {self.train_dir}/tif/'.split()
     args = train_args + (f'-o {self.out_dir}/unet.mdl -na unet -ne 1 -nl 2 -cbp 4 -bs 4 -e tif -ps 8 8 '
                          f'-ocf {self.jsonfn} -at channel').split()
     retval = nn_train(args)
     self.assertEqual(retval, 0)
     self._modify_ocf(self.jsonfn)
     retval = nn_predict([self.jsonfn])
     self.assertEqual(retval, 0)
Beispiel #14
0
 def test_ord_3d_cli(self):
     args = self.train_args + (
         f'-o {self.out_dir}/ordnet.mdl -na ordnet -ne 2 -nl 3 -cbp 1 -bs 4 -ps 16 16 16 -dm 3 '
         f'-ocf {self.jsonfn} -ord 1 10 2 -vs 0.5 -ns -dp 0.5').split()
     retval = nn_train(args)
     self.assertEqual(retval, 0)
     self._modify_ocf(self.jsonfn)
     retval = nn_predict([self.jsonfn])
     self.assertEqual(retval, 0)
Beispiel #15
0
 def test_unet_resblock_2d_no_skip_cli(self):
     train_args = f'-s {self.train_dir}/tif/ -t {self.train_dir}/tif/'.split()
     args = train_args + (f'-o {self.out_dir}/unet.mdl -na unet -ne 1 -nl 3 -cbp 1 -bs 2 -e tif -ps 16 16 '
                          f'-ocf {self.jsonfn} -acv -rb -ns').split()
     retval = nn_train(args)
     self.assertEqual(retval, 0)
     self._modify_ocf(self.jsonfn)
     retval = nn_predict([self.jsonfn])
     self.assertEqual(retval, 0)
Beispiel #16
0
 def test_unet_multimodal_cli(self):
     train_args = f'-s {self.train_dir}/tif/ {self.train_dir}/tif/ -t {self.train_dir}/tif/ {self.train_dir}/tif/'.split()
     args = train_args + (f'-o {self.out_dir}/unet.mdl -na unet -ne 1 -nl 3 -cbp 1 -ps 16 16 -bs 2 -e tif '
                          f'-ocf {self.jsonfn}').split()
     retval = nn_train(args)
     self.assertEqual(retval, 0)
     self._modify_ocf(self.jsonfn, multi=2)
     retval = nn_predict([self.jsonfn])
     self.assertEqual(retval, 0)
Beispiel #17
0
 def test_unet_color_2d_cli(self):
     train_args = f'-s {self.train_dir}/color/ -t {self.train_dir}/color/'.split()
     args = train_args + (f'-o {self.out_dir}/unet.mdl -na unet -ne 1 -nl 3 -cbp 1 -bs 2 -e png -dm 2 '
                          f'-ocf {self.jsonfn} -co').split()
     retval = nn_train(args)
     self.assertEqual(retval, 0)
     self._modify_ocf(self.jsonfn, color_out=True, bs=1)
     retval = nn_predict([self.jsonfn])
     self.assertEqual(retval, 0)
Beispiel #18
0
 def test_unet_bce_cli(self):
     train_args = f'-s {self.train_dir} -t {self.train_dir}/mask/'.split()
     args = train_args + (f'-o {self.out_dir}/unet.mdl -na unet -ne 1 -nl 1 -cbp 1 -ps 16 16 16 -bs 2 -dm 3 '
                          f'-ocf {self.jsonfn} -l bce').split()
     retval = nn_train(args)
     self.assertEqual(retval, 0)
     self._modify_ocf(self.jsonfn)
     retval = nn_predict([self.jsonfn])
     self.assertEqual(retval, 0)
Beispiel #19
0
 def test_unet_softmax_cli(self):
     train_args = f'-s {self.train_dir}/tif/ -t {self.train_dir}/tif/'.split()
     args = train_args + (f'-o {self.out_dir}/unet.mdl -na unet -ne 1 -nl 2 -cbp 3 -bs 2 -e tif -ps 8 8 '
                          f'-ocf {self.jsonfn} -sx').split()
     retval = nn_train(args)
     self.assertEqual(retval, 0)
     self._modify_ocf(self.jsonfn)
     retval = nn_predict([self.jsonfn])
     self.assertEqual(retval, 0)
Beispiel #20
0
 def test_nconv_2d_crop_cli(self):
     train_args = f'-s {self.train_dir}/tif/ -t {self.train_dir}/tif/'.split()
     args = train_args + (f'-o {self.out_dir}/nconv.mdl -na nconv -ne 1 -nl 1 -cbp 1 -bs 2 -e tif -ps 8 8 '
                          f'-ocf {self.jsonfn}').split()
     retval = nn_train(args)
     self.assertEqual(retval, 0)
     self._modify_ocf(self.jsonfn)
     retval = nn_predict([self.jsonfn])
     self.assertEqual(retval, 0)
Beispiel #21
0
 def test_densenet_cli(self):
     train_args = f'-s {self.train_dir}/tif/ -t {self.train_dir}/tif/'.split()
     args = train_args + (f'-o {self.out_dir}/densenet.mdl -na densenet -ne 1 -bs 2 -e tif '
                          f'-ocf {self.jsonfn}').split()
     retval = nn_train(args)
     self.assertEqual(retval, 0)
     self._modify_ocf(self.jsonfn)
     retval = nn_predict([self.jsonfn])
     self.assertEqual(retval, 0)
Beispiel #22
0
 def test_nconv_multimodal_tiff_cli(self):
     train_args = f'-s {self.train_dir}/tif/ {self.train_dir}/tif/ -t {self.train_dir}/tif/ {self.train_dir}/tif/'.split()
     args = train_args + (f'-o {self.out_dir}/nconv_patch.mdl -na nconv -ne 1 -nl 1 -ps 16 16 '
                          f'-ocf {self.jsonfn} -bs 2 -e tif -th 0').split()
     retval = nn_train(args)
     self.assertEqual(retval, 0)
     self._modify_ocf(self.jsonfn, multi=2)
     retval = nn_predict([self.jsonfn])
     self.assertEqual(retval, 0)
Beispiel #23
0
 def test_lrsd_cli(self):
     args = self.train_args + (
         f'-o {self.out_dir}/lrsdnet.mdl -na lrsdnet -ne 1 -nl 2 -cbp 2 -ps 32 32 32 -bs 4 -dm 3 '
         f'-ocf {self.jsonfn}').split()
     retval = nn_train(args)
     self.assertEqual(retval, 0)
     self._modify_ocf(self.jsonfn)
     retval = nn_predict([self.jsonfn])
     self.assertEqual(retval, 0)
Beispiel #24
0
 def test_nconv_data_aug_3d_cli(self):
     args = self.train_args + (f'-o {self.out_dir}/nconv_nopatch.mdl -na nconv -ne 1 -nl 2 -bs 2 '
                               f'--plot-loss {self.out_dir}/loss.png -ocf {self.jsonfn} -dm 3 '
                               f'-vsd {self.train_dir} -vtd {self.train_dir} -p 0 0 1 1 1 '
                               f'-g 0.01 -gn 0 -pwr 1 -tx -ty -blk 5 10 -mean 1 -std 1').split()
     retval = nn_train(args)
     self.assertEqual(retval, 0)
     self._modify_ocf(self.jsonfn)
     retval = nn_predict([self.jsonfn])
     self.assertEqual(retval, 0)
Beispiel #25
0
 def test_unburn2_2d_resblock_cli(self):
     train_args = f'-s {self.train_dir}/png/ {self.train_dir}/png/ -t {self.train_dir}/png/ {self.train_dir}/png/'.split(
     )
     args = train_args + (
         f'-o {self.out_dir}/unburn2net.mdl -na unburn2net -ne 1 -nl 2 -cbp 1 -ps 32 32 -bs 4 -e png '
         f'-ocf {self.jsonfn} -acv -rb -ls 5 -dp 0.5').split()
     retval = nn_train(args)
     self.assertEqual(retval, 0)
     self._modify_ocf(self.jsonfn, mc=2, multi=2)
     retval = nn_predict([self.jsonfn])
     self.assertEqual(retval, 0)
Beispiel #26
0
 def test_unburn2_2d_freeze_cli(self):
     train_args = f'-s {self.train_dir}/tif/ {self.train_dir}/tif/ -t {self.train_dir}/tif/ {self.train_dir}/tif/'.split(
     )
     args = train_args + (
         f'-o {self.out_dir}/unburn2net.mdl -na unburn2net -ne 1 -nl 1 -cbp 1 -ps 32 32 -bs 4 -e tif '
         f'-ocf {self.jsonfn} -fr -ls 5 -dp 0.5').split()
     retval = nn_train(args)
     self.assertEqual(retval, 0)
     self._modify_ocf(self.jsonfn, mc=2, multi=2)
     retval = nn_predict([self.jsonfn])
     self.assertEqual(retval, 0)
Beispiel #27
0
 def test_burn2_2d_png_cli(self):
     train_args = f'-s {self.train_dir}/png/ {self.train_dir}/png/ -t {self.train_dir}/png/ {self.train_dir}/png/'.split(
     )
     args = train_args + (
         f'-o {self.out_dir}/burn2net.mdl -na burn2net -ne 1 -nl 2 -cbp 1 -ps 32 32 -bs 4 -e png '
         f'-ocf {self.jsonfn} -ic -b1 1 -ls 5').split()
     retval = nn_train(args)
     self.assertEqual(retval, 0)
     self._modify_ocf(self.jsonfn, multi=2)
     retval = nn_predict([self.jsonfn])
     self.assertEqual(retval, 0)
Beispiel #28
0
 def test_burn2_3d_cli(self):
     train_args = f'-s {self.train_dir} {self.train_dir} -t {self.train_dir} {self.train_dir}'.split(
     )
     args = train_args + (
         f'-o {self.out_dir}/burn2net.mdl -na burn2net -ne 1 -nl 1 -cbp 1 -ps 32 32 32 -bs 4 -dm 3 '
         f'-ocf {self.jsonfn} -ls 5').split()
     retval = nn_train(args)
     self.assertEqual(retval, 0)
     self._modify_ocf(self.jsonfn, multi=2)
     retval = nn_predict([self.jsonfn])
     self.assertEqual(retval, 0)
Beispiel #29
0
 def test_burn2p21_2d_cli(self):
     train_args = f'-s {self.train_dir}/tif/ {self.train_dir}/tif/ -t {self.train_dir}/tif/ {self.train_dir}/tif/'.split(
     )
     args = train_args + (
         f'-o {self.out_dir}/burn2net.mdl -na burn2net -ne 1 -nl 1 -cbp 1 -ps 32 32 -bs 4 -e tif '
         f'-ocf {self.jsonfn} -ls 5').split()
     retval = nn_train(args)
     self.assertEqual(retval, 0)
     self._modify_ocf(self.jsonfn, model='burn2netp21')
     retval = nn_predict([self.jsonfn])
     self.assertEqual(retval, 0)
Beispiel #30
0
 def test_nconv_data_aug_2d_cli(self):
     train_args = f'-s {self.train_dir}/tif/ -t {self.train_dir}/tif/'.split()
     args = train_args + (f'-o {self.out_dir}/nconv_nopatch.mdl -na nconv -ne 1 -nl 2 -bs 2 '
                          f'--plot-loss {self.out_dir}/loss.png -ocf {self.jsonfn} -e tif '
                          f'-p 1 1 1 1 1 -r 10 -ts 0.5 -sc 0.1 -mean 1 -std 1 '
                          f'-hf -vf -g 0.1 -gn 0.2 -pwr 1 -tx -ty -blk 5 6 -th 0').split()
     retval = nn_train(args)
     self.assertEqual(retval, 0)
     self._modify_ocf(self.jsonfn)
     retval = nn_predict([self.jsonfn])
     self.assertEqual(retval, 0)