Method for constructing structured data set from traffic jam state picture sequence

By obtaining traffic congestion status images from online map services and constructing a structured dataset using image processing and color space conversion techniques, the problems of limited data acquisition and format incompatibility in intelligent transportation systems are solved, achieving low-cost data acquisition and traffic management optimization.

CN120808589APending Publication Date: 2025-10-17GUIZHOU INST OF TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510785117.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-12
Publication Date
2025-10-17

AI Technical Summary

Technical Problem

Existing traffic management methods lack real-time and flexibility. Traditional sensor and floating vehicle data have problems such as high cost, incomplete coverage and privacy disputes, resulting in limited data acquisition and incompatible formats, making it difficult to build a road network traffic congestion status dataset suitable for intelligent transportation systems.

Method used

By periodically accessing online map services to obtain images of road network traffic congestion status, image processing and color space conversion techniques are used to identify road sections and intersections, construct road section adjacency matrices and congestion status vectors, form a structured data set, and store it in a computer-usable file format.

Benefits of technology

It achieves low-cost data acquisition, solves the problems of limited data acquisition and format incompatibility, provides a data foundation for intelligent transportation systems, supports machine learning and deep learning analysis, predicts traffic congestion patterns and optimizes traffic management strategies.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure SMS_1
    Figure SMS_1
  • Figure SMS_2
    Figure SMS_2
  • Figure SMS_3
    Figure SMS_3
Patent Text Reader

Abstract

The invention discloses a method for constructing a structured data set from a traffic jam state picture sequence. According to the invention, based on an urban area road network traffic congestion state picture provided by an online map service provider, road sections and intersections in the traffic congestion state picture are identified by using a graphic method and structured road network description data are constructed; a color space conversion method is used for identifying the traffic congestion state of a road section and converting the traffic congestion state into vector representation, and the construction method of the traffic congestion state time sequence data set with the graph structure, which is suitable for research in the fields of machine learning, deep learning, artificial intelligence and the like, is realized by integrating the structured description of a road network and the vector representation of the traffic congestion state.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the field of intelligent transportation systems, in particular to a method for constructing a structured dataset from a traffic congestion state picture sequence. BACKGROUND

[0002] With the acceleration of urbanization, the number of motor vehicles, especially private cars, is growing exponentially, and traffic congestion is becoming increasingly serious. Traditional traffic management relies on manual scheduling, fixed signal light cycles, and limited monitoring methods, lacking real-time and flexibility. This method is difficult to adapt to dynamic changes in traffic flow and cannot quickly respond to emergencies such as accidents or bad weather. Intelligent transportation systems integrate advanced technologies such as sensors, the Internet of Things, big data analysis, artificial intelligence, etc. to optimize traffic management, improve road network efficiency, and improve user travel experience. Accordingly, intelligent transportation systems have higher requirements for the real-time and accuracy of road network traffic congestion state perception.

[0003] Early traffic state monitoring mainly relies on fixed sensors such as loop coils and microwave radars and floating car GPS data. Loop coils are expensive to deploy and difficult to maintain, and can only obtain single-point flow parameters; floating car data has problems such as incomplete spatial and temporal coverage and privacy disputes; more seriously, these methods cannot provide intuitive road network visualization. Road network real-time traffic congestion state construction based on crowd-sourced data has become a research hotspot due to its non-intrusive and wide coverage advantages, but there are still significant technical, cost, and usability bottlenecks in constructing a data set that can be used by intelligent transportation systems and suitable for computing. Traffic flow and road network state data are currently monopolized by a few online map service providers, either presented to the public in a raster picture format that is not suitable for computing, or requiring high API usage fees to obtain archivable data. This situation has brought major obstacles to the development of intelligent transportation systems, leading to problems such as limited data access, format incompatibility, and innovation being hindered; therefore, a method is needed to convert publicly accessible road network traffic congestion state pictures into a data set suitable for intelligent transportation systems and computable, thereby laying a solid foundation for research on traffic congestion diffusion patterns, causal relationships between traffic congestion and road segments, etc. SUMMARY

[0004] In view of the technical problems of existing road network traffic congestion state data being unsuitable for computing, the present application provides a method for converting road network traffic congestion state information presented in a raster format picture that can be publicly accessed into a computable data set, solving the above technical problems.

[0005] To achieve the above-mentioned purposes, the present application provides the following technical solutions:

[0006] A method for constructing a structured dataset from a traffic congestion state picture sequence, characterized in that, comprising:

[0007] S1, access the Web browser page of the online map service provider for ordinary users through timing, obtain the traffic congestion state picture containing the road network, identify the center line and two end points of the pixel block representing the traffic congestion state of each road segment in the road network as the center line and two end points of the road segment, identify the intersection point of the center line of the pixel block representing the traffic congestion state of different road segments in the road network as the intersection point between road segments, calculate the pixel coordinate set contained by each road segment, and construct the road segment adjacency matrix of the road network according to the intersection relationship between the road and the intersection point;

[0008] S2, obtain the real-time traffic congestion state picture of the road network at different time points at fixed time intervals, for each real-time traffic congestion state picture, based on the pixel coordinate set of each road segment in the picture, obtain the pixel value set representing the traffic congestion state of each road segment and convert the pixel value set into the congestion state vector representing the traffic congestion state of the road segment;

[0009] S3, serialize the road adjacency matrix of the road network and the road congestion state vector set constructed for the road network at multiple same interval time points and store them as a file on the permanent storage device in the computer system, to obtain a dataset for machine learning, deep learning, artificial intelligence and other research fields.

[0010] Preferably, step S1 specifically comprises:

[0011] S11, obtain a two-dimensional road network picture containing road distribution, traffic congestion state on the road and other elements, and retain only the pixels representing the traffic congestion state of the road segment through image processing technology, so that each road segment is represented by the pixel set of the traffic congestion state on the road segment;

[0012] S12, perform preprocessing such as graying, binarization and inversion on the road network picture, so that the pixel set representing the traffic congestion state of the road segment becomes a color different from black, and the picture background color becomes black;

[0013] S13, identify all pixel coordinates on the road segment center line, right width and left width of each pixel in the vertical direction of the center line, road segment intersection point pixel coordinates, and road segment two end point pixel coordinates using ridge line detection algorithm, calculate the coordinates of all pixels in the vertical direction of the center line of each road segment according to the center line coordinates and the right width and left width in the normal direction of the center line, and further obtain the coordinate set corresponding to the pixel set contained by the road segment;

[0014] S14, judging whether the center lines of the two road segments converge at a same road segment intersection, if yes, determining that the two road segments have an adjacent relationship in graph theory, if not, determining that the two road segments do not have an adjacent relationship in graph theory;

[0015] S15, constructing a road segment adjacency matrix of the road network according to the road segments and the adjacent relationships therebetween.

[0016] Preferably, the step S2 specifically comprises:

[0017] S21, obtaining one or more real-time traffic congestion state pictures of the road network at a current time point t by accessing a Web browser page for general users provided by an online map service provider in a timely manner; in the case of multiple real-time traffic congestion state pictures, using an image stitching algorithm to merge the multiple real-time traffic congestion state pictures into one real-time traffic congestion state picture.

[0018] S22, converting the set of RGB pixel values representing the congestion state of the road segment RoadSeg i into a set of HSV pixel values by conversion from an RGB color space to an HSV color space.

[0019] S23, for each road segment RoadSeg i generated by the ridge detection algorithm, calculating a congestion state vector CV i,t of the road at a specific time point by a statistical method based on the set of HSV pixel values representing the congestion state thereof and each HSV pixel value vector (H, S, V) therein.

[0020] Preferably, in the step S1, the road network picture is obtained by accessing an online map service page provided by an online map service provider for public access, and then one or more road network pictures of the target city are intercepted by a program or manually, merged into one picture if there are multiple pictures, and pixels representing irrelevant information are removed and only pixels representing roads are retained.

[0021] Preferably, in the step S12, the ridge detection algorithm is used to obtain, for each road segment RoadSeg i in the road network picture, each pixel coordinate (cx, cy) of the center line thereof, a normal angle a at the pixel coordinate, a left width w left , a right width w right , pixel coordinates (e x , e y ) of two end points, and two or more road segment intersection pixel coordinates (i x , i y ).

[0022] In step S13, the formula for calculating the set of pixel coordinates on the normal of the road segment at the centerline pixel coordinate (cx, cy) is:

[0023] CorrdsOnNormal cx,cy = {(x, y) | x = cx + w*cos(a + n), y = cy + w*sin(a + n), w e Z + , 1 < w < w left} U {(x, y) | x = cx + w*cos(a), y = cy + w*sin(a), w e Z + , 1 < w < w right}.

[0024] Preferably, in step S22, the conversion algorithm from RGB color space to HSV color space is:

[0025] R' = R / 255

[0026] G' = G / 255

[0027] B' = B / 255

[0028] C max = max(R, G, B')

[0029] C min = min(R', G', B')

[0030] A = C max - C min

[0031]

[0032] V = C max

[0033] Preferably, in step S23, the rules for determining the congestion level based on the HSV vector are:

[0034] Free-flow: 70 <= H < 150, S > 0.66, V > 0.66;

[0035] Slow: 30 <= H < 70, S > 0.66, V > 0.66;

[0036] Congestion: 0 <= H <= 30 or 345 <= H <= 360, S > 0.66, V > 0.66;

[0037] Severe congestion: 0 <= H <= 30 or 345 <= H <= 360, S > 0.66, V < 0.66.

[0038] Preferably, in step S3, the adjacency matrix is represented by two-dimensional data, the congestion state vector is represented in the form of a dictionary, and is stored to the hard disk through CSV, JSON file format.

[0039] In the above technical solution, the present application provides technical effects and advantages:

[0040] The present application breaks through the limitation of data acquisition by means of publicly available pictures provided by online map service providers through program or manual interception, acquires data at low cost or even zero cost, provides a data basis for intelligent transportation system research, solves the problem of limited data acquisition, reduces the research threshold, and enables more researchers and institutions to participate in related research;

[0041] The present application uses graphic methods to identify road segments and intersections, color space conversion methods to process congestion state information, etc., converts raster format pictures into structured and computable data sets, successfully solves the problem of incompatible data formats, provides convenience for subsequent analysis using machine learning, deep learning and other technologies, and widens the application range of data;

[0042] The present application constructs a traffic congestion state time series data set with a graph structure, integrates the structured description of the road network and the vector representation of the traffic congestion state, and such data set can intuitively present the distribution of traffic congestion in the road network and the trend of change over time, which is helpful for in-depth study of the generation mechanism, diffusion mode and causal relationship of traffic congestion between road segments; and through machine learning, deep learning and artificial intelligence, the potential laws and influencing factors of traffic congestion are mined, and the occurrence and development of traffic congestion are predicted; so that the traffic management department can formulate more accurate and effective traffic management strategies, such as optimizing signal timing, adjusting traffic control measures, etc., so as to improve the efficiency of traffic management, alleviate traffic congestion, improve the operation of urban traffic, and improve the public travel experience. DETAILED DESCRIPTION

[0043] In order to enable those skilled in the art to better understand the technical solutions of the present application, the present application will be further described in detail below.

[0044] Embodiment 1

[0045] A method for constructing a structured data set from a sequence of traffic congestion state pictures, characterized in that it comprises:

[0046] S1, access the web browser page of the online map service provider for ordinary users by timing, obtain the traffic congestion state picture containing the road network, identify the center line and two end points of the pixel block representing the traffic congestion state of each road segment in the road network as the center line and two end points of the road segment, identify the intersection point of the center line of the pixel block representing the traffic congestion state of different road segments in the road network as the intersection point between road segments, calculate the pixel coordinate set contained by each road segment, and construct the road segment adjacency matrix of the road network according to the intersection relationship between the road and the intersection point;

[0047] S2, obtain the real-time traffic congestion state picture of the road network at different time points at fixed time intervals, for each real-time traffic congestion state picture, obtain the pixel value set representing the traffic congestion state of the corresponding road segment in the picture based on the pixel coordinate set of the road segment, and convert the pixel value set into the congestion state vector representing the traffic congestion state of the road segment;

[0048] S3, serialize the road adjacency matrix of the road network and the road congestion state vector set constructed for the road network at multiple same interval time points and store them as files on the permanent storage device in the computer system, so as to obtain the data set for machine learning, deep learning, artificial intelligence and other research fields.

[0049] Step S1 specifically includes:

[0050] S11, obtain a two-dimensional road network picture containing road distribution, traffic congestion state on the road and other elements, and retain only the pixels representing the traffic congestion state of the road segment by image processing technology, so that each road segment is represented by the pixel set of the traffic congestion state on the road segment;

[0051] S12, perform preprocessing such as graying, binarization and inversion on the road network picture, so that the pixel set representing the traffic congestion state of the road segment becomes a color different from black, and the picture background color becomes black;

[0052] S13, identify all pixel coordinates on the road segment center line, right width and left width of each pixel in the vertical direction of the center line, road intersection point pixel coordinates, and road end point pixel coordinates by using ridge line detection algorithm, calculate the coordinates of all pixels in the vertical direction of the center line of the road segment according to the right width and left width in the normal direction of the center line, and further obtain the coordinate set corresponding to the pixel set contained by the road segment;

[0053] S14, determine whether the center lines of two road segments converge at the same road intersection point, if yes, determine that the two road segments have adjacent relationship in graph theory, if not, determine that the two road segments do not have adjacent relationship in graph theory;

[0054] S15, constructing a road segment adjacency matrix of the road network according to the road segments and the adjacency relationship therebetween.

[0055] Step S2 specifically comprises:

[0056] S21, acquiring one or more real-time traffic congestion state pictures of the road network at a current time point t by accessing a Web browser page for general users provided by an online map service provider in a timing manner; in the case of the multiple real-time traffic congestion state pictures, using an image stitching algorithm to merge the multiple real-time traffic congestion state pictures into one real-time traffic congestion state picture.

[0057] S22, converting the set of RGB pixel values representing the congestion state of the road segment RoadSeg i from an RGB color space to an HSV color space to obtain a set of HSV pixel values;

[0058] S23, for each road segment RoadSeg i generated by the ridge detection algorithm, calculating a congestion state vector CV i,t of the road at a specific time point based on the set of HSV pixel values representing the congestion state thereof and each HSV pixel value vector (H, S, V) therein by a statistical method.

[0059] In step S1, the road network picture is acquired by accessing an online map service page provided by an online map service provider for public access, and then one or more road network pictures of a target city are intercepted by a program or manually, merged into one picture if there are multiple pictures, and pixels representing irrelevant information are removed, and only pixels representing roads are reserved.

[0060] In step S12, the ridge detection algorithm is used to acquire the center line of each road segment RoadSeg i , each pixel coordinate (cx, cy) of the road segment, the normal angle a at the pixel coordinate, the respective widths w left , w right of the left and right sides at the pixel coordinate, the pixel coordinates (e x , e y ) of the two end points, and the pixel coordinates (i x , i y ) of the intersection of two or more road segments in the road network picture.

[0061] In step S13, the formula for calculating the set of pixel coordinates on the normal of the road segment at the center line pixel coordinate (cx, cy) is:

[0062] CoordsOnNormal cx,cy{(x, y) | x = cx + w*cos(a + n), y = cy + w*sin(a + n), w e Z, 1 < w < w +} U {(x, y) | x = cx + w*cos(a), y = cy + w*sin(a), w e Z, 1 < w < w left}. + right}.

[0063] In step S22, the conversion algorithm from RGB color space to HSV color space is:

[0064] R' = R / 255

[0065] G' = G / 255

[0066] B' = B / 255

[0067] C max = max(R, G, B')

[0068] C min = min(R', G', B')

[0069] A = C max - C min

[0070]

[0071] V = C max

[0072] In step S23, the rules for judging congestion levels based on HSV vectors are:

[0073] Free: 70 <= H < 150, S > 0.66, V > 0.66;

[0074] Slow: 30 <= H < 70, S > 0.66, V > 0.66;

[0075] Congestion: 0 <= H <= 30 or 345 <= H <= 360, S > 0.66, V > 0.66;

[0076] Severe congestion: 0 <= H <= 30 or 345 <= H <= 360, S > 0.66, V < 0.66.

[0077] In step S3, the adjacency matrix is represented by two-dimensional data, the congestion state vector is represented in the form of a dictionary, and is stored to the hard disk through CSV, JSON file format.

[0078] Example 2

[0079] ​A method for constructing a structured dataset from a traffic congestion state picture sequence, comprising the following steps:

[0080] S1: road network picture acquisition and processing

[0081] S11, access the online map service page provided by the online map service provider for public access, and intercept one or more road network pictures of the target city through a program or manually. In the case of covering the road network with multiple pictures, it needs to be spliced into one picture. In addition to containing road networks, the road network picture also includes icons of scenic spots and buildings and corresponding text annotations. Through computer graphics algorithms or manual operation, remove the pixels representing irrelevant information in the road network picture, and only keep the pixels representing the road.

[0082] S12, adopt a ridge line detection algorithm to obtain the center line of each road segment RoadSeg i in the road network picture, each pixel coordinate (cx, cy), the normal angle a at the pixel coordinate, the respective left and right width w left , w right of the pixel coordinate, the pixel coordinates (e x , e y ) of the two end points, and the pixel coordinates (i x , i y ) of the intersection of two or more road segments.

[0083] S13, based on the pixel coordinates (cx, cy), the normal angle a, the respective left and right width values w left , w right of the road segment center line given by the ridge line detection algorithm, the set CoordsOnNormal cx,cy of each pixel coordinate (x, y) on the normal of the road segment at the center line pixel coordinate (cx, cy) is calculated according to the following formula:

[0084] CoordsOnNormal cx,cy = {(x, y) | x = cx + w*cos(a+pi), y = cy + w*sin(a+pi), w e Z + , 1<=w<=w left} U {(x, y) | x = cx + w*cos(a), y = cy + w*sin(a), w e Z + , 1<=w<=w right}

[0085] S14, take the normal pixel coordinate set CoordsOnNormal cx,cythe union of the sets of coordinates of the pixels belonging to the road segment i, thus obtaining the set of coordinates of the pixels RoasSegPixelsCoords belonging to the road segment i i ; repeat the method for each road segment.

[0086] S15, when the end point pixel coordinates (e x ,e y ) of one end of the center line of a road segment exceed the intersection pixel coordinates (i x ,i y ) given by the ridge detection algorithm, it is determined that there is a neighboring relationship between the road segments, and the adjacency matrix AM between the roads is constructed according to the information.

[0087] S2: Obtain real-time traffic congestion state picture data

[0088] S21, access the online map service page provided by the online map service provider for public access, use the same parameters as S11, and intercept one or more road network pictures with real-time traffic congestion state of the target city at time point t through program or manually. In the case of covering the road network with multiple pictures, it needs to be spliced into one picture.

[0089] S22, based on the pixel coordinate set RoadSegPixelsCoords i corresponding to each road segment calculated in S14, extract the color value (R, G, B) of the pixel at each coordinate in the coordinate set RoadSegPixelsCoords i in the real-time traffic congestion state picture obtained in S21, and convert it to the vector (H, S, V) in the HSV color space through the following color space conversion algorithm:

[0090] R' = R / 255

[0091] G' = G / 255

[0092] B' = B / 255

[0093] C max = max(R, G, B')

[0094] C min = min(R', G', B')

[0095] Δ = C max - C min

[0096]

[0097] V = C max

[0098] S23, determine which one of the four congestion levels, free, slow, congested, and severely congested, each traffic congestion state pixel corresponds to, based on the HSV vector of each traffic congestion state pixel, using the following mapping method:

[0099] Free: 70 <= H < 150, S > 0.66, V > 0.66;

[0100] Slow: 30 <= H < 70, S > 0.66, V > 0.66;

[0101] Congested: 0 <= H <= 30 or 345 <= H <= 360, S > 0.66, V > 0.66;

[0102] Severely congested: 0 <= H <= 30 or 345 <= H <= 360, S > 0.66, V < 0.66.

[0103] S24, count the number of pixels corresponding to the four congestion levels, free, slow, congested, and severely congested, N smooth slow congested severe , calculate the percentage of each in the total and convert to float form F smooth slow congested severe , so as to obtain the congestion state vector CV i,t representing the traffic congestion state of the road section i at time point t

[0104] CV i,t = (F , F

[0001] , F , F )

[0105] S3: Traffic congestion state time series data set with graph structure

[0106] S31, represent the adjacency matrix describing the adjacency relationship between roads as a two-dimensional array, and represent the congestion state vector CV

[0002] of each road section i at each sampling time point t in dictionary form, and store these data in the hard disk through file formats such as CSV, JSON, etc. for subsequent use.

[0107] S32, the traffic congestion time series data set with graph structure thus constructed can be used in the fields of machine learning, deep learning, artificial intelligence, intelligent transportation system, etc. for understanding the generation and diffusion process of traffic congestion, so as to provide scientific decision support for controlling traffic congestion phenomenon.

[0108] ​​​​​​The application is based on the city area road network traffic congestion state pictures provided by online map service providers, uses a graphics method to identify road sections and intersections in the traffic congestion state pictures and construct a structured road network description data, uses a color space conversion method to identify the traffic congestion state of the road section and convert it into a vector representation, and comprehensively uses the structured description of the road network and the vector representation of the traffic congestion state to realize a traffic congestion state time series dataset construction method with a graph structure suitable for machine learning, deep learning and artificial intelligence research.

[0109] Embodiment 3

[0110] Construction based on data of a certain city area

[0111] 1. Road network picture acquisition and processing

[0112] Taking a medium-sized city as an example, an online map service page of a common online map service provider is accessed; a program is written using the Selenium library of Python to simulate browser operation, and a road network picture containing the traffic congestion state in the main roads of a certain area of the city is intercepted; if the picture coverage is limited, multiple pictures are obtained, and the image stitching function of the OpenCV library is used to stitch them into a complete road network picture with traffic congestion state; then, an image threshold segmentation algorithm is used to remove irrelevant information pixels such as scenic spots, building icons and text annotations in the picture;

[0113] The above ridge line detection algorithm is used, and with the help of a special image processing software or self-written Python code, the pre-processed road network picture is processed to accurately obtain the center line pixel coordinates, normal angle, left and right width, end point coordinates and intersection point coordinates of the pixel block representing the traffic congestion state in each road section;

[0114] According to the formula for calculating the pixel coordinate set of the road section, the pixel coordinates on the normal of each pixel are calculated by looping through the center line pixel coordinates in Python, and finally the pixel coordinate value set of each road section is obtained;

[0115] All road sections are traversed, and a road section adjacency matrix is constructed using the numpy library of Python according to the coincidence of the road section end point and intersection point coordinates.

[0116] 2. Obtain real-time traffic congestion state picture data

[0117] Set every 15 minutes as a time interval, use the same program as that for obtaining the road network picture to access the online map service provider page at regular intervals and obtain real-time traffic congestion state pictures; if there are multiple pictures, the same stitching processing is performed.

[0118] Using the PIL library of Python, the RGB color values of the corresponding pixels are extracted from the real-time picture according to the previously obtained pixel coordinate set of the road segment, and the RGB color values are converted into HSV color values according to the color space conversion algorithm;

[0119] A Python function is written to judge the HSV value of each pixel according to the congestion level judgment rule, and the number of pixels of different congestion levels is counted.

[0120] According to the statistical result, the proportion of the number of pixels of each congestion level is calculated, and the congestion state vector of each road segment at different time points is generated.

[0121] 3. Traffic congestion state time series data set with graph structure

[0122] The adjacency matrix is converted into a two-dimensional array, the congestion state vector is converted into a dictionary form, the adjacency matrix data is stored as a CSV format file using the pandas library of Python, and the dictionary form of the road congestion state vector is converted into a JSON format file and stored in a specified folder on the local hard disk, which is convenient for subsequent research and use.

[0123] Example 4

[0124] Adaptability test under different city sizes

[0125] 1. Select a large city and a small city, and repeat the steps in Example 2; in the large city test, due to the complexity of the road network and the large amount of data, higher requirements are put forward for the calculation efficiency and storage capacity of the program; through optimization algorithm and distributed storage technology, the data is successfully acquired and processed, and the corresponding data set is constructed.

[0126] 2. In the small city test, although the road network is relatively simple, the sparsity of data brings challenges; by adjusting the image interception range and time interval, the effectiveness of the data is improved, and a data set that meets the requirements is also constructed; the results show that the method of the present application has good adaptability under different city sizes.

[0127] Example 5

[0128] Based on the data of a certain city area

[0129] 1. Road network picture acquisition and processing

[0130] Taking the urban area of ​​Guiyang, Guizhou Province, as an example, we accessed the online map service page of a common online map service provider. We used the Python Selenium library to write a program to simulate browser operations and capture a road network image of a certain area of ​​the city, including traffic congestion on major roads. If the image coverage was limited, we obtained multiple images and used the image stitching function of the OpenCV library to stitch them into a complete road network image showing traffic congestion. Then, we used the image threshold segmentation algorithm to remove irrelevant pixels such as scenic spots, building icons, and text labels from the image.

[0131] Using the above ridge detection algorithm, with the help of specialized image processing software or self-written Python code, the pre-processed road network image is processed to accurately obtain the centerline pixel coordinates, normal angles, left and right widths, endpoint coordinates, and intersection coordinates of the pixel blocks representing the traffic congestion status of each road section;

[0132] According to the formula for calculating the pixel coordinate set of the road section, the center line pixel coordinates are looped through in Python to calculate the pixel coordinates on each pixel normal, and finally the pixel coordinate value set of each road section is obtained;

[0133] Traverse all road segments and construct the road segment adjacency matrix using Python's numpy library based on the coincidence of the coordinates of the road segment endpoints and intersections.

[0134] 2. Obtain real-time traffic congestion status image data

[0135] Set the time interval to 15 minutes, use the same procedure as that for obtaining road network images, and regularly access the online map service provider's page to obtain real-time traffic congestion status images; if there are multiple images, they will also be stitched together.

[0136] Using Python's PIL library, based on the previously obtained road segment pixel coordinate set, the RGB color values ​​of the corresponding pixels are extracted from the real-time image and converted into HSV color values ​​using the color space conversion algorithm;

[0137] Write a Python function to judge the HSV value of each pixel according to the congestion level determination rules and count the number of pixels at different congestion levels;

[0138] According to the statistical results, the proportion of pixels in each congestion level is calculated to generate the congestion state vector of each road section at different time points.

[0139] 3. Storage of traffic congestion status time series dataset with graph structure

[0140] The adjacency matrix is converted into a two-dimensional array, the congestion state vector is converted into a dictionary form, the adjacency matrix data is stored as a CSV format file using the pandas library of Python, the road congestion state vector in the form of a dictionary is converted into a JSON format file, and is stored in a specified folder of a local hard disk, facilitating subsequent research and use.

[0141] It should be understood that the embodiments of the present application are not limited to the above description, and various modifications and changes can be made without departing from the scope thereof. The scope of the embodiments of the present application is limited only by the appended claims.

[0142] The above-described embodiments only express several implementation manners of the embodiments of the present application, and the description is relatively specific and detailed, but it should not be understood as a limitation on the scope of the patent. It should be pointed out that, for ordinary skilled persons in the art, several modifications and improvements can be made without departing from the concept of the embodiments of the present application, and these all belong to the protection scope of the embodiments of the present application.

Claims

1. A method for constructing a structured dataset from a sequence of traffic congestion state images, characterized in that: include: S1. Periodically accessing a web browser page for ordinary users of an online map service provider to obtain a traffic congestion status image of a road network, identifying a centerline and two end points of a pixel block representing the traffic congestion status of each road section in the road network as the centerline and two end points of the road section, identifying intersections of the centerlines of the pixel blocks representing the traffic congestion status of different road sections in the road network as intersections between the sections, calculating a set of pixel coordinates included in each road section, and constructing a road section adjacency matrix of the road network based on the intersection relationship between roads and intersections; S2. Acquire real-time traffic congestion status images of the road network at different time points at fixed time intervals. For each real-time traffic congestion status image, obtain a set of pixel values ​​representing the traffic congestion status of the road section based on a set of pixel coordinates corresponding to each road section in the image, and convert the set of pixel values ​​into a congestion status vector representing the traffic congestion status of the road section. S3. Serialize and store the road adjacency matrix of the road network and the sets of road congestion state vectors constructed for the road network at multiple identically spaced time points as files on a permanent storage device within a computer system, thereby obtaining a data set that can be used in research fields such as machine learning, deep learning, and artificial intelligence.

2. The method for constructing a structured dataset from a traffic congestion state image sequence according to claim 1, characterized in that: Step S1 specifically includes: S11, obtaining a two-dimensional road network image including road distribution, traffic congestion status on the roads, and other elements, and retaining only pixels representing the traffic congestion status of road sections through image processing technology, so that each road section is represented by a set of traffic congestion status pixels on the road section; S12, performing pre-processing such as grayscale conversion, binarization, and inversion on the road network image, so that the pixel set representing the traffic congestion status of the road section becomes a color different from black, and the background color of the image becomes black; S13. Using a ridge detection algorithm, identify the coordinates of all pixels on the centerline of the road section, the right width and left width of each pixel in the vertical direction of the centerline, the pixel coordinates of the intersection of the road section, and the pixel coordinates of the endpoints of the road section. Based on the coordinates of the centerline of the road section and the right width and left width in the normal direction of the centerline, calculate the coordinates of all pixels in the normal direction of each pixel on the centerline of the road section, thereby obtaining a coordinate set corresponding to the set of pixels included in the road section. S14, determining whether the center lines of the two road sections converge at the same road section intersection; if so, determining that the two road sections have an adjacent relationship in graph theory; if not, determining that the two road sections do not have an adjacent relationship in graph theory; S15. Construct a road segment adjacency matrix of the road network according to the plurality of road segments and the adjacency relationships between them.

3. The method for constructing a structured dataset from a traffic congestion state image sequence according to claim 1, characterized in that: Step S2 specifically includes: S21. Obtain one or more real-time traffic congestion status pictures of the road network at the current time point t by periodically accessing the web browser page of the online map service provider for ordinary users; in the case of multiple real-time traffic congestion status pictures, use an image stitching algorithm to merge the multiple real-time traffic congestion status pictures into one real-time traffic congestion status picture. S22, by converting from RGB color space to HSV color space, i The RGB pixel value set in the congested state is changed to the HSV pixel value set; S23, for each road segment RoadSeg generated by the ridge detection algorithm i Based on the HSV pixel value set representing its congestion state and each HSV pixel value vector (H, S, V), the congestion state vector CV of the road at a specific time point is calculated by statistical methods. i,t .

4. The method for constructing a structured dataset from a traffic congestion state image sequence according to claim 1, characterized in that: In step S1, the road network image is obtained by accessing an online map service page provided by an online map service provider for public access, and capturing one or more road network images of the target city through a program or manually. If there are multiple images, they are spliced ​​into one, and pixels representing irrelevant information are removed, leaving only pixels representing the congestion status of several different roads in the road network.

5. The method for constructing a structured dataset from a traffic congestion state image sequence according to claim 1, characterized in that: In step S12, a ridge detection algorithm is used to obtain each road segment RoadSeg in the road network image. i Each pixel coordinate (cx, cy) of the center line, the normal angle α at the pixel coordinate, the width w on the left and right sides at the pixel coordinate left 、w right 、Pixel coordinates of the end points at both ends (e x ,e y ) and the pixel coordinates of the intersection of two or more road segments (i x ,i y ); In step S13, the formula for calculating the pixel coordinate set in the normal direction of the road segment at the center line pixel coordinate (cx, cy) is: CoordinatesOnNormal cx,cy ={(x,y)|x=cx+w*cos(α+π),y=cy+w*sin(α+π),w∈Z + ,1≤w≤w left }∪{(x,y)|x=cx+w*cos(α),y=cy+w*sin(α),w∈Z + ,1≤w≤w right }。 6. The method for constructing a structured dataset from a traffic congestion state image sequence according to claim 1, characterized in that: In step S22, the conversion algorithm from RGB color space to HSV color space is: R′=R / 255 G′=G / 255 B′=B / 255 C max =max(R,G,B′) C min =min(R’,G’,B’) Δ=C max –C min V=C max 。 7. The method for constructing a structured dataset from a traffic congestion state image sequence according to claim 3, characterized in that: In step S23, the rule for determining the congestion level based on the HSV vector is: Smooth: 70<=H<150, S>0.66, V>0.66; Slow running: 30<=H<70,S>0.66,V>0.66; Congestion: 0<=H<=30 or 345<=H<=360, S>0.66, V>0.66; Severe congestion: 0<=H<=30 or 345<=H<=360, S>0.66, V<0.

66.

8. The method for constructing a structured dataset from a traffic congestion state image sequence according to claim 1, characterized in that: In step S3, the adjacency matrix is ​​represented by two-dimensional data, the congestion state vector is represented by a dictionary, and the data is stored in a hard disk in CSV or JSON file format.