def test_heat_map_analysis(self):
    if (self.data_dir is None):
        unittest.TestCase.skipTest(self, 'DLPY_DATA_DIR is not set in the environment variables')
    if (not file_exist_on_server(self.s, (self.data_dir + 'ResNet-50-model.caffemodel.h5'))):
        unittest.TestCase.skipTest(self, 'File, {}, not found.'.format((self.data_dir + 'ResNet-50-model.caffemodel.h5')))
    from dlpy.applications import ResNet50_Caffe
    from dlpy.images import ImageTable
    pre_train_weight_file = os.path.join(self.data_dir, 'ResNet-50-model.caffemodel.h5')
    my_im = ImageTable.load_files(self.s, (self.data_dir + 'giraffe_dolphin_small'))
    my_im_r = my_im.resize(width=224, inplace=False)
    model = ResNet50_Caffe(self.s, model_table='ResNet50_Caffe', n_classes=2, n_channels=3, width=224, height=224, scale=1, random_flip='none', random_crop='none', offsets=my_im_r.channel_means, pre_trained_weights=True, pre_trained_weights_file=pre_train_weight_file, include_top=False)
    model.fit(data=my_im_r, mini_batch_size=1, max_epochs=1)
    model.heat_map_analysis(data=my_im_r, mask_width=None, mask_height=None, step_size=None, max_display=1)
    self.assertRaises(ValueError, (lambda : model.heat_map_analysis(mask_width=56, mask_height=56, step_size=8, display=False)))
    self.assertRaises(ValueError, (lambda : model.heat_map_analysis(data=my_im, mask_width=56, mask_height=56, step_size=8, display=False)))
    try:
        from numpy import array
    except:
        unittest.TestCase.skipTest(self, 'numpy is not installed')
    self.assertRaises(ValueError, (lambda : model.heat_map_analysis(data=array([]), mask_width=56, mask_height=56, step_size=8, display=False)))
def test_heat_map_analysis(self):
    if (self.data_dir is None):
        unittest.TestCase.skipTest(self, 'DLPY_DATA_DIR is not set in the environment variables')
    if (not file_exist_on_server(self.s, (self.data_dir + 'ResNet-50-model.caffemodel.h5'))):
        unittest.TestCase.skipTest(self, 'File, {}, not found.'.format((self.data_dir + 'ResNet-50-model.caffemodel.h5')))
    from dlpy.applications import ResNet50_Caffe
    from dlpy.images import ImageTable
    pre_train_weight_file = os.path.join(self.data_dir, 'ResNet-50-model.caffemodel.h5')
    my_im = ImageTable.load_files(self.s, (self.data_dir + 'giraffe_dolphin_small'))
    my_im_r = my_im.resize(width=224, inplace=False)
    model = ResNet50_Caffe(self.s, model_table='ResNet50_Caffe', n_classes=2, n_channels=3, width=224, height=224, scale=1, random_flip='none', random_crop='none', offsets=my_im_r.channel_means, pre_trained_weights=True, pre_trained_weights_file=pre_train_weight_file, include_top=False)
    model.fit(data=my_im_r, mini_batch_size=1, max_epochs=1)
    model.heat_map_analysis(data=my_im_r, mask_width=None, mask_height=None, step_size=None, max_display=1)
    self.assertRaises(ValueError, (lambda : model.heat_map_analysis(mask_width=56, mask_height=56, step_size=8, display=False)))
    self.assertRaises(ValueError, (lambda : model.heat_map_analysis(data=my_im, mask_width=56, mask_height=56, step_size=8, display=False)))
    try:
        from numpy import array
    except:
        unittest.TestCase.skipTest(self, 'numpy is not installed')
    self.assertRaises(ValueError, (lambda : model.heat_map_analysis(data=array([]), mask_width=56, mask_height=56, step_size=8, display=False)))