We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN 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`?

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `tools/convert_datasets/voc_aug.py`
Content:
```
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 FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

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:

{"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"}], "after_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    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        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"}]}