Example #1
0
    def test_csv_exporter(self):
        tool = AnnotationTool()
        tool.load_app(True)

        # Annotation added
        tool.annotations = []
        tool.file_list = []
        tool.class_list = ['winston', 'prince', 'duckie']
        tool.colorspace = ['#0000FF', '#FF0000', '#00FF00']
        tool.current_file = 0
        tool.img = MockImg()

        for i in range(5):
            a = Annotation()
            a.rotation = 3
            tool.file_list.append('file%d.jpg' % i)
            for p in range(3):
                roi = ROI()
                roi.push(0, 0)
                roi.push(100.0, 100.0)
                a.push(roi, i % len(tool.class_list))
            tool.annotations.append(a)

        appMenu = AppMenu(tool)
        complete = appMenu._csv_exporter('test')
        self.assertTrue(complete)

        appMenu = AppMenu(tool)
        complete = appMenu._csv_exporter('test.csv')
        self.assertTrue(complete)

        appMenu = AppMenu(tool)
        complete = appMenu._csv_exporter('')
        self.assertFalse(complete)
    def test_delete_from_project_button(self):
        tool = AnnotationTool()
        tool.load_app(True) 

        # Annotation added
        tool.annotations = []
        tool.file_list = []
        tool.class_list = ['winston', 'prince', 'duckie']
        tool.colorspace = ['#0000FF', '#FF0000', '#00FF00']
        tool.current_file = 0        
        tool.num_pages = 1
        
        for i in range(5):
            a = Annotation()
            a.rotation = 3
            tool.file_list.append('file%d.jpg' % i)
            for p in range(3):
                roi = ROI()
                roi.push(0,0)
                roi.push(100.0,100.0)
                a.push(roi, i%len(tool.class_list))
            tool.annotations.append(a) 
            
        toolbar = Toolbar(tool)
        button = toolbar.toolbar_frame.winfo_children()[1]
        
        self.assertEqual(button.cget('text'), '')        
        self.assertEqual(button.cget('width'), 40)        
        self.assertEqual(button.cget('height'), 40)        
Example #3
0
    def test_open(self):
        tool = AnnotationTool()
        tool.load_app(True)

        # Annotation added
        tool.annotations = []
        tool.file_list = []
        tool.class_list = ['winston', 'prince', 'duckie']
        tool.colorspace = ['#0000FF', '#FF0000', '#00FF00']
        tool.current_file = 0
        tool.img = MockImg()

        for i in range(5):
            a = Annotation()
            a.rotation = 3
            tool.file_list.append('file%d.jpg' % i)
            for p in range(3):
                roi = ROI()
                roi.push(0, 0)
                roi.push(100.0, 100.0)
                a.push(roi, i % len(tool.class_list))
            tool.annotations.append(a)

        appMenu = AppMenu(tool)
        complete = appMenu._open('file.oaf')
        self.assertTrue(complete)
        self.assertEqual(tool.class_count, [6, 6, 3])
        self.assertTrue(tool.project_open)
        self.assertTrue(tool.saved)
        self.assertEqual(tool.top_colors_used, tool.colorspace)
        self.assertEqual(tool.top_colors_free, tool.top_colors[3:])

        appMenu = AppMenu(tool)
        complete = appMenu._open('')
        self.assertFalse(complete)
    def test_next_image(self):
        tool = AnnotationTool()
        tool.load_app(True) 

        # Annotation added
        tool.annotations = []
        tool.file_list = []
        tool.class_list = ['winston', 'prince', 'duckie']
        tool.colorspace = ['#0000FF', '#FF0000', '#00FF00']
        tool.current_file = 0        
        tool.num_pages = 1
        
        for i in range(5):
            a = Annotation()
            a.rotation = 3
            tool.file_list.append('file%d.jpg' % i)
            for p in range(3):
                roi = ROI()
                roi.push(0,0)
                roi.push(100.0,100.0)
                a.push(roi, i%len(tool.class_list))
            tool.annotations.append(a) 
            
        toolbar = Toolbar(tool)
        self.assertEqual(tool.current_file, 0)
        
        truth = [1, 2, 3, 4, 4]
        for i in range(5):
            toolbar._next_image()
            self.assertEqual(tool.current_file, truth[i])
Example #5
0
    def test_reset_image(self):

        tool = AnnotationTool()
        tool.load_app(True)

        # Annotation added
        tool.annotations = []
        tool.file_list = []
        tool.class_list = ['winston', 'prince', 'duckie']
        tool.colorspace = ['blue', 'green', 'red']
        tool.current_file = 0
        tool.class_count = [0, 15, 0]
        tool.img = MockImg()

        for i in range(5):
            a = Annotation()
            a.rotation = 3
            tool.file_list.append('file%d.jpg' % i)
            for p in range(3):
                roi = ROI()
                roi.push(0, 0)
                roi.push(100.0, 100.0)
                a.push(roi, 1)
            tool.annotations.append(a)

        tool._draw_workspace()

        self.assertEqual(tool.annotations[tool.current_file].size(), 3)
        complete = tool._reset_image()
        self.assertEqual(tool.annotations[tool.current_file].size(), 0)

        self.assertTrue(complete)

        tool.window.destroy()
Example #6
0
    def test_change_image(self):
        tool = AnnotationTool()
        tool.load_app(True) 
        tool.file_list = []
        tool.annotations = []
        tool.current_file = 0
        tool.class_list = ['winston', 'prince', 'duckie']
        tool.colorspace = ['#0000FF', '#FF0000', '#00FF00']
        tool.num_pages = 1
        tool.class_count = [5, 5, 5]        
       
        for i in range(5):
            a = Annotation()
            a.rotation = 3
            tool.file_list.append('file%d.jpg' % i)
            for p in range(3):
                roi = ROI()
                roi.push(0,0)
                roi.push(100.0,100.0)
                a.push(roi, p%len(tool.class_list))
            tool.annotations.append(a) 
            
        tool.img = MockImg()            
        tool._draw_workspace()

        navigator = Navigator(tool)

        self.assertEqual(tool.current_file, 0)  
        navigator.change_image(1)
        self.assertEqual(tool.current_file, 1)  
    def test_draw_image_navigator(self):
        tool = AnnotationTool()
        tool.load_app(True) 

        # Annotation added
        tool.annotations = []
        tool.file_list = []
        tool.class_list = ['winston', 'prince', 'duckie']
        tool.colorspace = ['#0000FF', '#FF0000', '#00FF00']
        tool.current_file = 0        
        tool.num_pages = 1
        
        for i in range(5):
            a = Annotation()
            a.rotation = 3
            tool.file_list.append('file%d.jpg' % i)
            for p in range(3):
                roi = ROI()
                roi.push(0,0)
                roi.push(100.0,100.0)
                a.push(roi, i%len(tool.class_list))
            tool.annotations.append(a) 
            
        toolbar = Toolbar(tool)
        nav_frame = toolbar.toolbar_frame.winfo_children()[0]
        nav_frame_children = nav_frame.winfo_children()
        
        self.assertEqual(len(nav_frame_children), 3)
        self.assertEqual(nav_frame_children[0].cget('text'), "Page 1/2")
    def test_draw_class_selection_menu(self):
        
        tool = AnnotationTool()
        tool.load_app(True) 

        # Annotation added
        tool.annotations = []
        tool.file_list = []
        tool.class_list = ['winston', 'prince', 'duckie']
        tool.colorspace = ['#0000FF', '#FF0000', '#00FF00']
        tool.current_file = 0
        tool.num_pages = 1
        tool.class_count = [5, 5, 5]        
       
        for i in range(5):
            a = Annotation()
            a.rotation = 3
            tool.file_list.append('file%d.jpg' % i)
            for p in range(3):
                roi = ROI()
                roi.push(0,0)
                roi.push(100.0,100.0)
                a.push(roi, p%len(tool.class_list))
            tool.annotations.append(a) 
            
        toolbar = Toolbar(tool)        
        option_menu = toolbar.toolbar_frame.winfo_children()[2]
        self.assertEqual(option_menu.winfo_name(), '!optionmenu')
    def test_delete_from_project(self):

        tool = AnnotationTool()
        tool.load_app(True) 

        # Annotation added
        tool.annotations = []
        tool.file_list = []
        tool.class_list = ['winston', 'prince', 'duckie']
        tool.colorspace = ['#0000FF', '#FF0000', '#00FF00']
        tool.current_file = 0
        tool.num_pages = 1
        tool.class_count = [5, 5, 5]        
       
        for i in range(5):
            a = Annotation()
            a.rotation = 3
            tool.file_list.append('file%d.jpg' % i)
            for p in range(3):
                roi = ROI()
                roi.push(0,0)
                roi.push(100.0,100.0)
                a.push(roi, p%len(tool.class_list))
            tool.annotations.append(a) 
            
        toolbar = Toolbar(tool)
        
        self.assertEqual(len(tool.annotations) , 5)
        self.assertEqual(len(tool.file_list) , 5)
        self.assertListEqual(tool.class_count, [5,5,5])
        toolbar._delete_from_project()
        self.assertEqual(len(tool.annotations) , 4)
        self.assertEqual(len(tool.file_list) , 4)
        self.assertListEqual(tool.class_count, [4,4,4])
Example #10
0
    def _on_release(self, event):
        '''
        This handles when the mouse left-button has been released, which adds
        a new bounding box or resizes an existing box.
        
        Parameters
        ----------
        event : tkinter Event
            Event that handles the mouse being clicked, creating the first of
            two bounding box corners
    
        Attributes
        ----------
        None
            
        Raises
        ------
        None
    
        Returns
        -------
        complete : bool
            Returns True for unittesting
    
        '''            
        if self.box_resize_mode == 'NEW':

            top = min(self.clicked[1], event.y)
            bottom = max(self.clicked[1], event.y)
            left = min(self.clicked[0], event.x)
            right = max(self.clicked[0], event.x)
            label = self.class_list.index(self.selected_class.get())
            color = self.colorspace[label]
            
            box = InteractiveBox(self, left, top, right, bottom, color)
            
            self.canvas.delete(self.rect)
            del self.rect
            box.draw_box(len(self.annotations[self.current_file].roi))
            
            top = self.aspect_ratio * top
            bottom = self.aspect_ratio * bottom
            left = self.aspect_ratio * left
            right = self.aspect_ratio * right
            
            roi = ROI()
            roi.push(left, top)
            roi.push(right, bottom)
            self.annotations[self.current_file].push(roi,label)
            
            self.class_count[label] = self.class_count[label] + 1
        self.draw_canvas()
        self.saved = False
        self.box_resize_mode = 'NEW'
        return True
Example #11
0
    def test_on_click(self):

        tool = AnnotationTool()
        tool.load_app(True)

        # Annotation added
        tool.annotations = []
        tool.file_list = []
        tool.class_list = ['winston', 'prince', 'duckie']
        tool.colorspace = ['blue', 'green', 'red']
        tool.current_file = 0
        tool.img = MockImg()

        for i in range(5):
            a = Annotation()
            a.rotation = 3
            tool.file_list.append('file%d.jpg' % i)
            for p in range(3):
                roi = ROI()
                roi.push(0, 0)
                roi.push(100.0, 100.0)
                a.push(roi, random.randint(0, 2))
            tool.annotations.append(a)

        tool._draw_workspace()

        # Click Top
        complete = tool._on_click(Event(10, 0))
        self.assertTrue(complete)
        self.assertEqual('TOP', tool.box_resize_mode)
        self.assertEqual(0, tool.resize_box_id)

        # Click Bottom
        complete = tool._on_click(Event(10, 100 / tool.aspect_ratio))
        self.assertTrue(complete)
        self.assertEqual('BOTTOM', tool.box_resize_mode)
        self.assertEqual(0, tool.resize_box_id)

        # Click Left
        complete = tool._on_click(Event(0, 60))
        self.assertTrue(complete)
        self.assertEqual('LEFT', tool.box_resize_mode)
        self.assertEqual(0, tool.resize_box_id)

        # Click Right
        complete = tool._on_click(Event(100 / tool.aspect_ratio, 60))
        self.assertTrue(complete)
        self.assertEqual('RIGHT', tool.box_resize_mode)
        self.assertEqual(0, tool.resize_box_id)

        # Click elsewhere to create a new box
        complete = tool._on_click(Event(60, 60))
        self.assertTrue(complete)
        self.assertEqual('NEW', tool.box_resize_mode)
        tool.window.destroy()
Example #12
0
    def test_draw_canvas(self):
        class MockImg(object):
            def __init__(self):
                self.size = [640, 480]

        tool = AnnotationTool()
        tool.load_app(True)
        tool.annotations = []
        tool.class_list = []

        # Empty Project
        complete = tool.draw_canvas()
        self.assertTrue(complete)
        self.assertTrue(hasattr(tool, 'canvas'))
        self.assertFalse(hasattr(tool, 'aspect_ratio'))
        self.assertFalse(hasattr(tool, 'boxes'))

        # Annotation added
        tool.annotations = []
        tool.file_list = []
        tool.class_list = ['winston', 'prince', 'duckie']
        tool.colorspace = ['blue', 'green', 'red']
        tool.current_file = 0
        tool.img = MockImg()

        for i in range(5):
            a = Annotation()
            a.rotation = 3
            tool.file_list.append('file%d.jpg' % i)
            for p in range(3):
                roi = ROI()
                roi.push(0, 0)
                roi.push(100.0, 100.0)
                a.push(roi, random.randint(0, 2))
            tool.annotations.append(a)

        complete = tool.draw_canvas()
        self.assertTrue(complete)
        self.assertTrue(hasattr(tool, 'canvas'))
        self.assertTrue(hasattr(tool, 'aspect_ratio'))
        self.assertTrue(hasattr(tool, 'boxes'))
        self.assertEqual(tool.aspect_ratio, 640 / (1024 - 200))
        self.assertEqual(3, len(tool.boxes))
        tool.window.destroy()
Example #13
0
    def test_Annotation(self):

        a = Annotation()
        self.assertTrue(hasattr(a, 'roi'))
        self.assertEqual(len(a.roi), 0)
        self.assertTrue(hasattr(a, 'label'))
        self.assertEqual(len(a.label), 0)
        self.assertTrue(hasattr(a, 'rotation'))

        a.rotation = 3
        self.assertEqual(a.rotation, 3)
        for p in range(5):
            roi = ROI()
            roi.push(0, 1)
            roi.push(50.0, 51.0)
            roi.push(100, 101.0)
            a.push(roi, p % 3)

        bytes_arr = a.to_bytes()
        self.assertListEqual(bytes_arr, [
            b'\x05', b'\n', b'\x03', b'\n', b'\x00\x03', b'\n',
            b'\x00\x00\x00\x00', b'\n', b'\x00\x00\x80?', b'\n', b'\x00\x00HB',
            b'\n', b'\x00\x00LB', b'\n', b'\x00\x00\xc8B', b'\n',
            b'\x00\x00\xcaB', b'\n', b'\x00\x00', b'\n', b'\x00\x03', b'\n',
            b'\x00\x00\x00\x00', b'\n', b'\x00\x00\x80?', b'\n', b'\x00\x00HB',
            b'\n', b'\x00\x00LB', b'\n', b'\x00\x00\xc8B', b'\n',
            b'\x00\x00\xcaB', b'\n', b'\x00\x01', b'\n', b'\x00\x03', b'\n',
            b'\x00\x00\x00\x00', b'\n', b'\x00\x00\x80?', b'\n', b'\x00\x00HB',
            b'\n', b'\x00\x00LB', b'\n', b'\x00\x00\xc8B', b'\n',
            b'\x00\x00\xcaB', b'\n', b'\x00\x02', b'\n', b'\x00\x03', b'\n',
            b'\x00\x00\x00\x00', b'\n', b'\x00\x00\x80?', b'\n', b'\x00\x00HB',
            b'\n', b'\x00\x00LB', b'\n', b'\x00\x00\xc8B', b'\n',
            b'\x00\x00\xcaB', b'\n', b'\x00\x00', b'\n', b'\x00\x03', b'\n',
            b'\x00\x00\x00\x00', b'\n', b'\x00\x00\x80?', b'\n', b'\x00\x00HB',
            b'\n', b'\x00\x00LB', b'\n', b'\x00\x00\xc8B', b'\n',
            b'\x00\x00\xcaB', b'\n', b'\x00\x01', b'\n'
        ])

        for i in range(5):
            self.assertEqual(len(a.roi[0].points), 3)
            self.assertEqual(a.label[0], i % 3)
            a.pop()
            self.assertEqual(len(a.roi), 4 - i)
            self.assertEqual(len(a.label), 4 - i)
Example #14
0
    def test_new(self):

        tool = AnnotationTool()
        tool.load_app(True)

        # Annotation added
        tool.annotations = []
        tool.file_list = []
        tool.class_list = ['winston', 'prince', 'duckie']
        tool.colorspace = ['#0000FF', '#FF0000', '#00FF00']
        tool.current_file = 0
        tool.class_count = [0, 15, 0]
        tool.img = MockImg()

        for i in range(5):
            a = Annotation()
            a.rotation = 3
            tool.file_list.append('file%d.jpg' % i)
            for p in range(3):
                roi = ROI()
                roi.push(0, 0)
                roi.push(100.0, 100.0)
                a.push(roi, 1)
            tool.annotations.append(a)

        tool._draw_workspace()

        appMenu = AppMenu(tool)
        complete = appMenu._new()

        self.assertTrue(complete)
        self.assertEqual(tool.file_list, [])
        self.assertTrue(tool.project_open)
        self.assertEqual(tool.annotations, [])
        self.assertEqual(tool.top_colors_free, tool.top_colors)
        self.assertEqual(tool.top_colors_used, [])
        self.assertEqual(tool.class_count, [])
        self.assertEqual(tool.current_file, 0)
        self.assertEqual(tool.class_list, [])
        self.assertEqual(tool.colorspace, [])
Example #15
0
    def test_draw_workspace(self):
        class MockImg(object):
            def __init__(self):
                self.size = [640, 480]

        tool = AnnotationTool()
        tool.load_app(True)
        tool.annotations = []
        tool.class_list = []

        # Empty Project
        complete = tool._draw_workspace()
        self.assertTrue(complete)
        self.assertTrue(hasattr(tool, 'background'))
        self.assertTrue(hasattr(tool, 'app_menu'))

        # Annotation added
        tool.annotations = []
        tool.file_list = []
        tool.class_list = ['winston', 'prince', 'duckie']
        tool.colorspace = ['blue', 'green', 'red']
        tool.current_file = 0
        tool.img = MockImg()

        for i in range(5):
            a = Annotation()
            a.rotation = 3
            tool.file_list.append('file%d.jpg' % i)
            for p in range(3):
                roi = ROI()
                roi.push(0, 0)
                roi.push(100.0, 100.0)
                a.push(roi, random.randint(0, 2))
            tool.annotations.append(a)

        complete = tool._draw_workspace()
        self.assertTrue(complete)
        self.assertTrue(hasattr(tool, 'background'))
        self.assertTrue(hasattr(tool, 'app_menu'))
        tool.window.destroy()
    def test_draw_box(self):

        tool = AnnotationTool()
        tool.load_app(True)

        # Annotation added
        tool.annotations = []
        tool.file_list = []
        tool.class_list = ['winston', 'prince', 'duckie']
        tool.colorspace = ['#0000FF', '#FF0000', '#00FF00']
        tool.current_file = 0
        tool.class_count = [5, 5, 5]

        for i in range(5):
            a = Annotation()
            a.rotation = 3
            tool.file_list.append('file%d.jpg' % i)
            for p in range(3):
                roi = ROI()
                roi.push(0, 0)
                roi.push(100.0, 100.0)
                a.push(roi, p % len(tool.class_list))
            tool.annotations.append(a)

        tool.top_colors_free = ['#00FFFF', '#FF00FF', '#FFFF00']
        tool.top_colors_used = ['#0000FF', '#FF0000', '#00FF00']
        tool.img = MockImg()

        tool._draw_workspace()
        canvas_children = tool.canvas.winfo_children()
        ibox = InteractiveBox(tool, 10, 10, 200, 200, tool.colorspace[0])
        self.assertEqual(len(canvas_children), 3)

        ibox.draw_box(0)

        canvas_children = tool.canvas.winfo_children()
        self.assertTrue(hasattr(ibox, 'rect'))
        self.assertTrue(hasattr(ibox, 'close_button'))
        self.assertEqual(len(canvas_children), 4)
Example #17
0
    def test_init(self):
        tool = AnnotationTool()
        tool.load_app(True) 


        # Annotation added
        tool.annotations = []
        tool.file_list = []
        tool.class_list = ['winston', 'prince', 'duckie']
        tool.colorspace = ['#0000FF', '#FF0000', '#00FF00']
        tool.current_file = 0  
        tool.num_pages = 1
        toolbar = Toolbar(tool)

        self.assertEqual(toolbar.root_app, tool)
        self.assertEqual(toolbar.toolbar_width, tool.window_width)
        self.assertEqual(toolbar.toolbar_height, tool.toolbar_height)
        self.assertEqual(len(toolbar.toolbar_frame.winfo_children()), 0)
        
        
        for i in range(5):
            a = Annotation()
            a.rotation = 3
            tool.file_list.append('file%d.jpg' % i)
            for p in range(3):
                roi = ROI()
                roi.push(0,0)
                roi.push(100.0,100.0)
                a.push(roi, i%len(tool.class_list))
            tool.annotations.append(a) 
            
        toolbar = Toolbar(tool)
        self.assertEqual(toolbar.root_app, tool)
        self.assertEqual(toolbar.toolbar_width, tool.window_width)
        self.assertEqual(toolbar.toolbar_height, tool.toolbar_height)
        self.assertEqual(len(toolbar.toolbar_frame.winfo_children()), 3)
Example #18
0
 def test_ROI(self):
     roi = ROI()
     self.assertTrue(hasattr(roi, 'points'))
     self.assertEqual(roi.size(), 0)
     roi.push(10, 11)
     self.assertEqual(roi.size(), 1)
     roi.push(100, 101)
     self.assertEqual(roi.size(), 2)
     left, top, right, bottom = roi.getBox()
     self.assertEqual(left, 10)
     self.assertEqual(top, 11)
     self.assertEqual(right, 100)
     self.assertEqual(bottom, 101)
     roi.push(50, 51)
     self.assertEqual(roi.size(), 3)
     self.assertRaises(ValueError, roi.getBox)
     bytes_arr = roi.to_bytes()
     self.assertListEqual(bytes_arr, [
         b'\x00\x03', b'\n', b'\x00\x00 A', b'\n', b'\x00\x000A', b'\n',
         b'\x00\x00\xc8B', b'\n', b'\x00\x00\xcaB', b'\n', b'\x00\x00HB',
         b'\n', b'\x00\x00LB', b'\n'
     ])
Example #19
0
    def test_SaveOAF(self):
        annotations = []
        file_list = []
        class_list = ['winston', 'prince', 'duckie']
        colorspace = ['#0000FF', '#FF0000', '#00FF00']
        current_file = 4
        filename = 'tempfile.oaf'

        for i in range(5):
            a = Annotation()
            a.rotation = 3
            file_list.append('file%d.jpg' % i)
            for p in range(3):
                roi = ROI()
                roi.push(0, 1)
                roi.push(50.0, 51.0)
                roi.push(100, 101.0)
                a.push(roi, p % 3)
            annotations.append(a)

        byte_arr = SaveOAF(filename,
                           annotations,
                           file_list,
                           class_list,
                           colorspace,
                           current_file,
                           testing=True)

        byte_arr_copy = []
        while len(byte_arr):
            byte_arr_copy.append(byte_arr.pop(0) + byte_arr.pop(0))
        byte_arr = byte_arr_copy
        del byte_arr_copy

        byte_truth = [
            b'\x01\n', b'\x04\n', b'\x05\n', b'file0.jpg\n', b'\x03\n',
            b'\x03\n', b'\x00\x03\n', b'\x00\x00\x00\x00\n',
            b'\x00\x00\x80?\n', b'\x00\x00HB\n', b'\x00\x00LB\n',
            b'\x00\x00\xc8B\n', b'\x00\x00\xcaB\n', b'\x00\x00\n',
            b'\x00\x03\n', b'\x00\x00\x00\x00\n', b'\x00\x00\x80?\n',
            b'\x00\x00HB\n', b'\x00\x00LB\n', b'\x00\x00\xc8B\n',
            b'\x00\x00\xcaB\n', b'\x00\x01\n', b'\x00\x03\n',
            b'\x00\x00\x00\x00\n', b'\x00\x00\x80?\n', b'\x00\x00HB\n',
            b'\x00\x00LB\n', b'\x00\x00\xc8B\n', b'\x00\x00\xcaB\n',
            b'\x00\x02\n', b'file1.jpg\n', b'\x03\n', b'\x03\n', b'\x00\x03\n',
            b'\x00\x00\x00\x00\n', b'\x00\x00\x80?\n', b'\x00\x00HB\n',
            b'\x00\x00LB\n', b'\x00\x00\xc8B\n', b'\x00\x00\xcaB\n',
            b'\x00\x00\n', b'\x00\x03\n', b'\x00\x00\x00\x00\n',
            b'\x00\x00\x80?\n', b'\x00\x00HB\n', b'\x00\x00LB\n',
            b'\x00\x00\xc8B\n', b'\x00\x00\xcaB\n', b'\x00\x01\n',
            b'\x00\x03\n', b'\x00\x00\x00\x00\n', b'\x00\x00\x80?\n',
            b'\x00\x00HB\n', b'\x00\x00LB\n', b'\x00\x00\xc8B\n',
            b'\x00\x00\xcaB\n', b'\x00\x02\n', b'file2.jpg\n', b'\x03\n',
            b'\x03\n', b'\x00\x03\n', b'\x00\x00\x00\x00\n',
            b'\x00\x00\x80?\n', b'\x00\x00HB\n', b'\x00\x00LB\n',
            b'\x00\x00\xc8B\n', b'\x00\x00\xcaB\n', b'\x00\x00\n',
            b'\x00\x03\n', b'\x00\x00\x00\x00\n', b'\x00\x00\x80?\n',
            b'\x00\x00HB\n', b'\x00\x00LB\n', b'\x00\x00\xc8B\n',
            b'\x00\x00\xcaB\n', b'\x00\x01\n', b'\x00\x03\n',
            b'\x00\x00\x00\x00\n', b'\x00\x00\x80?\n', b'\x00\x00HB\n',
            b'\x00\x00LB\n', b'\x00\x00\xc8B\n', b'\x00\x00\xcaB\n',
            b'\x00\x02\n', b'file3.jpg\n', b'\x03\n', b'\x03\n', b'\x00\x03\n',
            b'\x00\x00\x00\x00\n', b'\x00\x00\x80?\n', b'\x00\x00HB\n',
            b'\x00\x00LB\n', b'\x00\x00\xc8B\n', b'\x00\x00\xcaB\n',
            b'\x00\x00\n', b'\x00\x03\n', b'\x00\x00\x00\x00\n',
            b'\x00\x00\x80?\n', b'\x00\x00HB\n', b'\x00\x00LB\n',
            b'\x00\x00\xc8B\n', b'\x00\x00\xcaB\n', b'\x00\x01\n',
            b'\x00\x03\n', b'\x00\x00\x00\x00\n', b'\x00\x00\x80?\n',
            b'\x00\x00HB\n', b'\x00\x00LB\n', b'\x00\x00\xc8B\n',
            b'\x00\x00\xcaB\n', b'\x00\x02\n', b'file4.jpg\n', b'\x03\n',
            b'\x03\n', b'\x00\x03\n', b'\x00\x00\x00\x00\n',
            b'\x00\x00\x80?\n', b'\x00\x00HB\n', b'\x00\x00LB\n',
            b'\x00\x00\xc8B\n', b'\x00\x00\xcaB\n', b'\x00\x00\n',
            b'\x00\x03\n', b'\x00\x00\x00\x00\n', b'\x00\x00\x80?\n',
            b'\x00\x00HB\n', b'\x00\x00LB\n', b'\x00\x00\xc8B\n',
            b'\x00\x00\xcaB\n', b'\x00\x01\n', b'\x00\x03\n',
            b'\x00\x00\x00\x00\n', b'\x00\x00\x80?\n', b'\x00\x00HB\n',
            b'\x00\x00LB\n', b'\x00\x00\xc8B\n', b'\x00\x00\xcaB\n',
            b'\x00\x02\n', b'\x03\n', b'winston\n', b'#0000FF\n', b'prince\n',
            b'#FF0000\n', b'duckie\n', b'#00FF00\n'
        ]

        self.assertListEqual(byte_arr, byte_truth)

        annotations0, file_list0, class_list0, colorspace0, current_file0 =\
        LoadOAF(filename, byte_truth)

        self.assertListEqual(file_list, file_list0)
        self.assertListEqual(class_list, class_list0)
        self.assertListEqual(colorspace, colorspace0)
        self.assertEqual(current_file, current_file0)