Ejemplo n.º 1
0
    def test_finds_no_small_objects_sequence_in_a_tar_file(self):
        environment = 'scandinavian_house'
        trajectory_id = 'rgbd_dataset_freiburg1_360'
        sequence_name, sequence_data = self.make_sequence_json(
            trajectory_id=trajectory_id,
            map_name=environment,
            min_object_volume=0.015)
        sequence_zip = self.temp_folder / (sequence_name + '.tar.gz')
        with self.sequences_file.open('w') as fp:
            json.dump({sequence_name: sequence_data}, fp)
        sequence_zip.touch(exist_ok=True)

        results = ndds.load_sequences(self.temp_folder)
        self.assertEqual(1, len(results))
        self.assertEqual(trajectory_id, results[0].trajectory_id)
        self.assertEqual(environment, results[0].environment)
        self.assertEqual(TimeOfDay.DAY, results[0].time_of_day)
        self.assertEqual(ndds.QualityLevel.NO_SMALL_OBJECTS,
                         results[0].quality_level)
        self.assertEqual(sequence_name, results[0].sequence_name)
        self.assertEqual(self.temp_folder, results[0].path)

        # clean up
        self.sequences_file.unlink()
        sequence_zip.unlink()
Ejemplo n.º 2
0
    def test_finds_min_quality_sequence_in_a_tar_file(self):
        environment = 'scandinavian_house'
        trajectory_id = 'rgbd_dataset_freiburg1_360'
        sequence_name, sequence_data = self.make_sequence_json(
            trajectory_id=trajectory_id,
            map_name=environment,
            # All 3 settings should be reduced
            texture_bias=15,
            disable_reflections=True,
            min_object_volume=0.015)
        sequence_zip = self.temp_folder / (sequence_name + '.tar.gz')
        with self.sequences_file.open('w') as fp:
            json.dump({sequence_name: sequence_data}, fp)
        sequence_zip.touch(exist_ok=True)

        results = ndds.load_sequences(self.temp_folder)
        self.assertEqual(1, len(results))
        self.assertEqual(trajectory_id, results[0].trajectory_id)
        self.assertEqual(environment, results[0].environment)
        self.assertEqual(TimeOfDay.DAY, results[0].time_of_day)
        self.assertEqual(ndds.QualityLevel.MIN_QUALITY,
                         results[0].quality_level)
        self.assertEqual(sequence_name, results[0].sequence_name)
        self.assertEqual(self.temp_folder, results[0].path)

        # clean up
        self.sequences_file.unlink()
        sequence_zip.unlink()
Ejemplo n.º 3
0
    def test_finds_sequence_without_quality_settings_as_max(self):
        environment = 'scandinavian_house'
        trajectory_id = 'rgbd_dataset_freiburg1_360'
        sequence_name, sequence_data = self.make_sequence_json(
            trajectory_id=trajectory_id, map_name=environment)
        # Remove keys for the quality settings from the sequence data. Maximum quality should be assumed.
        del sequence_data['texture_bias']
        del sequence_data['disable_reflections']
        del sequence_data['min_object_volume']
        sequence_zip = self.temp_folder / (sequence_name + '.tar.gz')
        with self.sequences_file.open('w') as fp:
            json.dump({sequence_name: sequence_data}, fp)
        sequence_zip.touch(exist_ok=True)

        results = ndds.load_sequences(self.temp_folder)
        self.assertEqual(1, len(results))
        self.assertEqual(trajectory_id, results[0].trajectory_id)
        self.assertEqual(environment, results[0].environment)
        self.assertEqual(TimeOfDay.DAY, results[0].time_of_day)
        self.assertEqual(ndds.QualityLevel.MAX_QUALITY,
                         results[0].quality_level)
        self.assertEqual(sequence_name, results[0].sequence_name)
        self.assertEqual(self.temp_folder, results[0].path)

        # clean up
        self.sequences_file.unlink()
        sequence_zip.unlink()
Ejemplo n.º 4
0
    def test_skips_sequence_with_unknown_trajectory(self):
        environment = 'scandinavian_house'
        trajectory_id = 'rgbd_dataset_freiburg1_360'
        sequence_name_1, sequence_data_1 = self.make_sequence_json(
            trajectory_id=trajectory_id, map_name=environment)
        sequence_name_2, sequence_data_2 = self.make_sequence_json(
            trajectory_id='MH_04_404', map_name=environment)
        sequence_1_zip = self.temp_folder / (sequence_name_1 + '.tar.gz')
        sequence_2_zip = self.temp_folder / (sequence_name_2 + '.tar.gz')
        with self.sequences_file.open('w') as fp:
            json.dump(
                {
                    sequence_name_1: sequence_data_1,
                    sequence_name_2: sequence_data_2
                }, fp)
        sequence_1_zip.touch(exist_ok=True)
        sequence_2_zip.touch(exist_ok=True)

        results = ndds.load_sequences(self.temp_folder)
        self.assertEqual(1, len(results))
        self.assertEqual(trajectory_id, results[0].trajectory_id)
        self.assertEqual(environment, results[0].environment)
        self.assertEqual(TimeOfDay.DAY, results[0].time_of_day)
        self.assertEqual(ndds.QualityLevel.MAX_QUALITY,
                         results[0].quality_level)
        self.assertEqual(sequence_name_1, results[0].sequence_name)
        self.assertEqual(self.temp_folder, results[0].path)

        # clean up
        self.sequences_file.unlink()
        sequence_1_zip.unlink()
        sequence_2_zip.unlink()
Ejemplo n.º 5
0
    def test_finds_max_quality_sequence_in_a_folder(self):
        environment = 'scandinavian_house'
        trajectory_id = 'rgbd_dataset_freiburg1_360'
        sequence_name, sequence_data = self.make_sequence_json(
            trajectory_id=trajectory_id, map_name=environment)
        sequence_path = self.temp_folder / sequence_name
        with self.sequences_file.open('w') as fp:
            json.dump({sequence_name: sequence_data}, fp)
        sequence_path.mkdir(exist_ok=True)

        results = ndds.load_sequences(self.temp_folder)
        self.assertEqual(1, len(results))
        self.assertEqual(trajectory_id, results[0].trajectory_id)
        self.assertEqual(environment, results[0].environment)
        self.assertEqual(TimeOfDay.DAY, results[0].time_of_day)
        self.assertEqual(ndds.QualityLevel.MAX_QUALITY,
                         results[0].quality_level)
        self.assertEqual(sequence_name, results[0].sequence_name)
        self.assertEqual(self.temp_folder, results[0].path)

        # clean up
        self.sequences_file.unlink()
        shutil.rmtree(sequence_path)
Ejemplo n.º 6
0
 def test_raises_exception_if_no_sequences_file(self):
     if self.sequences_file.exists():
         self.sequences_file.unlink()
     with self.assertRaises(FileNotFoundError):
         ndds.load_sequences(self.temp_folder)