Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
gaoyi committed Oct 18, 2023
1 parent 1f98148 commit ce241aa
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 11 deletions.
4 changes: 2 additions & 2 deletions Config/axera_roadMarking_trafficLight_trafficSign.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
0 背景 background
1 路面箭头 Arrow
1 路面箭头 Road_Arrow
2 人行横道 Crosswalk
3 停止线 Stop-line
3 停止线 Stopline
24 changes: 18 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,27 @@ None. Since swift package [SwiftyJson](https://swiftpackageindex.com/SwiftyJSON/

## TODO

- [ ] Since image `id` filed is mapped to it's index on the `images` fileds, mergeing with other source annotated `.json` file is not checked

- [ ] fixed id2category mapping
- [ ] Image `id` filed is mapped to it's index on the `images` fileds, so mergeing with other source annotated `.json` file may cause conflict
- [ ] `file_name` in the image name is named as absolute path since images can locate at different directories.
- [ ] split train/val/test :
- [x] For the purpose of continue training of models with new data, fix categoryid2name mapping by an config `.txt` file

## Notice

coco format set category id=0 as `background` class. When training with [detectron2](https://github.com/facebookresearch/detectron2) framework, the totoal class param in your config should be set to total_class_num + 1(background class)
1. coco format set category id=0 as `background` class. When training with [detectron2](https://github.com/facebookresearch/detectron2) framework, the totoal class param in your config should be set to total_class_num + 1(background class)
1. totoal number of class is determined at run time, according to the given axera anno json file. So if an category is not present in original axera anno, it will not present in coco anno.(TODO: fixed id2category mapping)
1. id to name mapping format in the .txt file:
`A B C`, A is the categoryID, B is the `categoryName` field in the axera anno(为中文字符), C is the uft8 string that represent the category used by coco anno.
e.g.
```txt
0 背景 background
1 路面箭头 Road_Arrow
2 人行横道 Crosswalk
3 停止线 Stop-line
```

## Structure of coco format
## Reference: Structure of coco format
```json
{
"info": {
Expand Down Expand Up @@ -60,9 +72,9 @@ coco format set category id=0 as `background` class. When training with [detectr
"id": 0,
"image_id": 0,
"category_id": 2,
"bbox": [260, 177, 231, 199],
"bbox": [260, 177, 231, 199], //[left_top_x, left_top_y, width, height]
"segmentation": [...],
"area": 45969,
"area": 45969, // bbox width * height
"iscrowd": 0
},
...
Expand Down
6 changes: 3 additions & 3 deletions Sources/main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ import Foundation
// define the path to input json files
let jsonsURL = URL(fileURLWithPath: "/data/dataset/aXcellent/manu-label/obstacle/ANNOTATION_roadmark/FRONT_rect/")
let jsons = try FileManager.default.contentsOfDirectory(at: jsonsURL, includingPropertiesForKeys: nil, options: .skipsSubdirectoryDescendants)
let sortedJSONs = jsons.sorted { url1, url2 -> Bool in
url1.lastPathComponent < url2.lastPathComponent
}
let decoder = JSONDecoder()

let imageURL = URL(fileURLWithPath: "/data/dataset/aXcellent/manu-label/obstacle/IMAGE/FRONT_rect")
Expand All @@ -24,9 +27,6 @@ do {
print("Error creating parent directory: \(error)")
}

let sortedJSONs = jsons.sorted { url1, url2 -> Bool in
url1.lastPathComponent < url2.lastPathComponent
}

let total = sortedJSONs.count
var categoryCounter = [String: Int]()
Expand Down

0 comments on commit ce241aa

Please sign in to comment.