-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to run the manhattan data? #14
Comments
Hello, I am also facing the same problem. Could you please tell me if you have solved it? Thank you very much. |
Same problem |
Same problem,has anyone solve it? |
I have read the json files of Manhattan in deatails, and the traffic network is not a regular pattern. Additionally, the intersections under Manhattan also different from each other, rather than a 4-way 4-phase intersection. In summary, it is impossible to train and test models under Manhattan, unless you design a unified neural network like AttendLight. |
Thank you for your answer! |
hello, guys. intersection number in MPLight/data/manhattan/manhattan.json just 1 while tsc says "The road network contains 2510 intersections in Manhattan". other files like manhattan_*.json are just flowFile not roadnetFile. so why the roadnetFile just contain 1 intersection? |
my mistake. 1 intersections can contains all intersection. I got it. sorry to borther you guys. |
|
I count the different intersection with diff phase and got some wired data: {1: 1421, 2: 1459, 3: 16, 4: 6, 8: 678, 9: 182, 10: 1}. The amount of them is 3763. If the time of lightphases is 0, I just cut it off when counting
def parse_roadnet(roadnetFile):
roadnet = json.load(open(roadnetFile))
lane_phase_info_dict ={}
# many intersections exist in the roadnet and virtual intersection is controlled by signal
for intersection in roadnet["intersections"]:
if intersection['virtual']:
continue
lane_phase_info_dict[intersection['id']] = {"location": {
"x": float(intersection["point"]["x"]),
"y": float(intersection["point"]["y"]),},
"start_lane": [],
"end_lane": [],
"phase": [],
"phase_startLane_mapping": {},
"phase_roadLink_mapping": {},
}
road_links = intersection["roadLinks"]
start_lane = []
end_lane = []
roadLink_lane_pair = {ri: [] for ri in
range(len(road_links))} # roadLink includes some lane_pair: (start_lane, end_lane)
for ri in range(len(road_links)):
road_link = road_links[ri]
for lane_link in road_link["laneLinks"]:
sl = road_link['startRoad'] + "_" + str(lane_link["startLaneIndex"])
el = road_link['endRoad'] + "_" + str(lane_link["endLaneIndex"])
start_lane.append(sl)
end_lane.append(el)
roadLink_lane_pair[ri].append((sl, el))
lane_phase_info_dict[intersection['id']]["start_lane"] = sorted(list(set(start_lane)))
lane_phase_info_dict[intersection['id']]["end_lane"] = sorted(list(set(end_lane)))
# ["trafficLight"]["lightphases"] 中的长度并不一定等于红绿灯的全部相位,比如生成脚本的第一个相位就是全红,只允许右转,还有的是该相位的时间为0,manhattan中就有不少是availableRoadLinks和time都是0的情况
phase_i = 0
start_index= 0 # 设置为1来跳过第一个红灯相位
for _ in range(start_index, len(intersection["trafficLight"]["lightphases"])):
p = intersection["trafficLight"]["lightphases"][phase_i]
if p['time']<=0:
continue
lane_pair = []
start_lane = []
for ri in p["availableRoadLinks"]:
lane_pair.extend(roadLink_lane_pair[ri])
if roadLink_lane_pair[ri][0][0] not in start_lane:
start_lane.append(roadLink_lane_pair[ri][0][0])
lane_phase_info_dict[intersection['id']]["phase"].append(phase_i)
lane_phase_info_dict[intersection['id']]["phase_startLane_mapping"][phase_i] = start_lane
lane_phase_info_dict[intersection['id']]["phase_roadLink_mapping"][phase_i] = lane_pair
phase_i += 1
return lane_phase_info_dict
if __name__ == "__main__":
lane_phase_info = parse_roadnet("manhattan/manhattan.json")
print(len(lane_phase_info)) # 3763
count_phase = defaultdict(int)
for inter in lane_phase_info.keys():
count_phase[len(lane_phase_info[inter]['phase'])]+=1
print(count_phase) # defaultdict(<class 'int'>, {1: 1421, 2: 1459, 4: 6, 9: 182, 8: 678, 10: 1, 3: 16}) |
你好,我是宣传部的乔嗣尧,已收到您的来信,我会及时查收并回复。如果您有急事,请联系我: 19823327107 或 18087037706
|
How to modify the parameters to run the manhattan data?
I try to adjust the road_net and the volum, but the 'json' file without NUM_COL and NUM_ROW.
Thank you very much.
The text was updated successfully, but these errors were encountered: