prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  FileNotFoundError: [Errno 2] No such file or directory: 'VOCdevkit/VOCaug/dataset/trainval.txt'
  https://github.com/open-mmlab/mmsegmentation/blob/1c3f54765981ba352d4cf6582edb1c8915e51d71/tools/convert_datasets/voc_aug.py#L53
  
  Directory `VOCdevkit/VOCaug/dataset` does not exist `trainval.txt`, `trainval.txt` is the merger of `train.txt` and `val.txt`?
  
  </issue>
  <code>
  [start of tools/convert_datasets/voc_aug.py]
  1 import argparse
  2 import os.path as osp
  3 from functools import partial
  4 
  5 import mmcv
  6 import numpy as np
  7 from PIL import Image
  8 from scipy.io import loadmat
  9 
  10 AUG_LEN = 10582
  11 
  12 
  13 def convert_mat(mat_file, in_dir, out_dir):
  14     data = loadmat(osp.join(in_dir, mat_file))
  15     mask = data['GTcls'][0]['Segmentation'][0].astype(np.uint8)
  16     seg_filename = osp.join(out_dir, mat_file.replace('.mat', '.png'))
  17     Image.fromarray(mask).save(seg_filename, 'PNG')
  18 
  19 
  20 def generate_aug_list(merged_list, excluded_list):
  21     return list(set(merged_list) - set(excluded_list))
  22 
  23 
  24 def parse_args():
  25     parser = argparse.ArgumentParser(
  26         description='Convert PASCAL VOC annotations to mmsegmentation format')
  27     parser.add_argument('devkit_path', help='pascal voc devkit path')
  28     parser.add_argument('aug_path', help='pascal voc aug path')
  29     parser.add_argument('-o', '--out_dir', help='output path')
  30     parser.add_argument(
  31         '--nproc', default=1, type=int, help='number of process')
  32     args = parser.parse_args()
  33     return args
  34 
  35 
  36 def main():
  37     args = parse_args()
  38     devkit_path = args.devkit_path
  39     aug_path = args.aug_path
  40     nproc = args.nproc
  41     if args.out_dir is None:
  42         out_dir = osp.join(devkit_path, 'VOC2012', 'SegmentationClassAug')
  43     else:
  44         out_dir = args.out_dir
  45     mmcv.mkdir_or_exist(out_dir)
  46     in_dir = osp.join(aug_path, 'dataset', 'cls')
  47 
  48     mmcv.track_parallel_progress(
  49         partial(convert_mat, in_dir=in_dir, out_dir=out_dir),
  50         list(mmcv.scandir(in_dir, suffix='.mat')),
  51         nproc=nproc)
  52 
  53     with open(osp.join(aug_path, 'dataset', 'trainval.txt')) as f:
  54         full_aug_list = [line.strip() for line in f]
  55     with open(
  56             osp.join(devkit_path, 'VOC2012/ImageSets/Segmentation',
  57                      'train.txt')) as f:
  58         ori_train_list = [line.strip() for line in f]
  59     with open(
  60             osp.join(devkit_path, 'VOC2012/ImageSets/Segmentation',
  61                      'val.txt')) as f:
  62         val_list = [line.strip() for line in f]
  63 
  64     aug_train_list = generate_aug_list(ori_train_list + full_aug_list,
  65                                        val_list)
  66     assert len(aug_train_list) == AUG_LEN, 'len(aug_train_list) != {}'.format(
  67         AUG_LEN)
  68 
  69     with open(
  70             osp.join(devkit_path, 'VOC2012/ImageSets/Segmentation',
  71                      'trainaug.txt'), 'w') as f:
  72         f.writelines(line + '\n' for line in aug_train_list)
  73 
  74     aug_list = generate_aug_list(full_aug_list, ori_train_list + val_list)
  75     assert len(aug_list) == AUG_LEN - len(
  76         ori_train_list), 'len(aug_list) != {}'.format(AUG_LEN -
  77                                                       len(ori_train_list))
  78     with open(
  79             osp.join(devkit_path, 'VOC2012/ImageSets/Segmentation', 'aug.txt'),
  80             'w') as f:
  81         f.writelines(line + '\n' for line in aug_list)
  82 
  83     print('Done!')
  84 
  85 
  86 if __name__ == '__main__':
  87     main()
  88
  [end of tools/convert_datasets/voc_aug.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/tools/convert_datasets/voc_aug.py b/tools/convert_datasets/voc_aug.py
  --- a/tools/convert_datasets/voc_aug.py
  +++ b/tools/convert_datasets/voc_aug.py
  @@ -50,8 +50,12 @@
           list(mmcv.scandir(in_dir, suffix='.mat')),
           nproc=nproc)
   
  -    with open(osp.join(aug_path, 'dataset', 'trainval.txt')) as f:
  -        full_aug_list = [line.strip() for line in f]
  +    full_aug_list = []
  +    with open(osp.join(aug_path, 'dataset', 'train.txt')) as f:
  +        full_aug_list += [line.strip() for line in f]
  +    with open(osp.join(aug_path, 'dataset', 'val.txt')) as f:
  +        full_aug_list += [line.strip() for line in f]
  +
       with open(
               osp.join(devkit_path, 'VOC2012/ImageSets/Segmentation',
                        'train.txt')) as f:
  
verification_info: {"golden_diff": "diff --git a/tools/convert_datasets/voc_aug.py b/tools/convert_datasets/voc_aug.py\n--- a/tools/convert_datasets/voc_aug.py\n+++ b/tools/convert_datasets/voc_aug.py\n@@ -50,8 +50,12 @@\n         list(mmcv.scandir(in_dir, suffix='.mat')),\n         nproc=nproc)\n \n-    with open(osp.join(aug_path, 'dataset', 'trainval.txt')) as f:\n-        full_aug_list = [line.strip() for line in f]\n+    full_aug_list = []\n+    with open(osp.join(aug_path, 'dataset', 'train.txt')) as f:\n+        full_aug_list += [line.strip() for line in f]\n+    with open(osp.join(aug_path, 'dataset', 'val.txt')) as f:\n+        full_aug_list += [line.strip() for line in f]\n+\n     with open(\n             osp.join(devkit_path, 'VOC2012/ImageSets/Segmentation',\n                      'train.txt')) as f:\n", "issue": "FileNotFoundError: [Errno 2] No such file or directory: 'VOCdevkit/VOCaug/dataset/trainval.txt'\nhttps://github.com/open-mmlab/mmsegmentation/blob/1c3f54765981ba352d4cf6582edb1c8915e51d71/tools/convert_datasets/voc_aug.py#L53\r\n\r\nDirectory `VOCdevkit/VOCaug/dataset` does not exist `trainval.txt`, `trainval.txt` is the merger of `train.txt` and `val.txt`?\n", "before_files": [{"content": "import argparse\nimport os.path as osp\nfrom functools import partial\n\nimport mmcv\nimport numpy as np\nfrom PIL import Image\nfrom scipy.io import loadmat\n\nAUG_LEN = 10582\n\n\ndef convert_mat(mat_file, in_dir, out_dir):\n    data = loadmat(osp.join(in_dir, mat_file))\n    mask = data['GTcls'][0]['Segmentation'][0].astype(np.uint8)\n    seg_filename = osp.join(out_dir, mat_file.replace('.mat', '.png'))\n    Image.fromarray(mask).save(seg_filename, 'PNG')\n\n\ndef generate_aug_list(merged_list, excluded_list):\n    return list(set(merged_list) - set(excluded_list))\n\n\ndef parse_args():\n    parser = argparse.ArgumentParser(\n        description='Convert PASCAL VOC annotations to mmsegmentation format')\n    parser.add_argument('devkit_path', help='pascal voc devkit path')\n    parser.add_argument('aug_path', help='pascal voc aug path')\n    parser.add_argument('-o', '--out_dir', help='output path')\n    parser.add_argument(\n        '--nproc', default=1, type=int, help='number of process')\n    args = parser.parse_args()\n    return args\n\n\ndef main():\n    args = parse_args()\n    devkit_path = args.devkit_path\n    aug_path = args.aug_path\n    nproc = args.nproc\n    if args.out_dir is None:\n        out_dir = osp.join(devkit_path, 'VOC2012', 'SegmentationClassAug')\n    else:\n        out_dir = args.out_dir\n    mmcv.mkdir_or_exist(out_dir)\n    in_dir = osp.join(aug_path, 'dataset', 'cls')\n\n    mmcv.track_parallel_progress(\n        partial(convert_mat, in_dir=in_dir, out_dir=out_dir),\n        list(mmcv.scandir(in_dir, suffix='.mat')),\n        nproc=nproc)\n\n    with open(osp.join(aug_path, 'dataset', 'trainval.txt')) as f:\n        full_aug_list = [line.strip() for line in f]\n    with open(\n            osp.join(devkit_path, 'VOC2012/ImageSets/Segmentation',\n                     'train.txt')) as f:\n        ori_train_list = [line.strip() for line in f]\n    with open(\n            osp.join(devkit_path, 'VOC2012/ImageSets/Segmentation',\n                     'val.txt')) as f:\n        val_list = [line.strip() for line in f]\n\n    aug_train_list = generate_aug_list(ori_train_list + full_aug_list,\n                                       val_list)\n    assert len(aug_train_list) == AUG_LEN, 'len(aug_train_list) != {}'.format(\n        AUG_LEN)\n\n    with open(\n            osp.join(devkit_path, 'VOC2012/ImageSets/Segmentation',\n                     'trainaug.txt'), 'w') as f:\n        f.writelines(line + '\\n' for line in aug_train_list)\n\n    aug_list = generate_aug_list(full_aug_list, ori_train_list + val_list)\n    assert len(aug_list) == AUG_LEN - len(\n        ori_train_list), 'len(aug_list) != {}'.format(AUG_LEN -\n                                                      len(ori_train_list))\n    with open(\n            osp.join(devkit_path, 'VOC2012/ImageSets/Segmentation', 'aug.txt'),\n            'w') as f:\n        f.writelines(line + '\\n' for line in aug_list)\n\n    print('Done!')\n\n\nif __name__ == '__main__':\n    main()\n", "path": "tools/convert_datasets/voc_aug.py"}]}