Urban street scene typical criminal event risk assessment method, medium and equipment

Through the method of combining large language models and deep residual networks, we can identify named entities in the judicial field and evaluate the crime risk of street view images. This solves the problems of named entity recognition and feature selection in street view images in the judicial field, and improves the accuracy and effectiveness of recognition. .

CN118710058APending Publication Date: 2024-09-27CHINA UNIV OF GEOSCIENCES (WUHAN)
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202410886551.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-03
Publication Date
2024-09-27

AI Technical Summary

Technical Problem

Existing technology cannot effectively identify named entities in the judicial field, and methods in general fields cannot be directly applied to judicial texts, causing the recognition effect to depend on data quality. Moreover, there is a lack of unified environmental feature selection standards for research on the relationship between street view images and criminal activities, resulting in Recognition effectiveness is low.

Method used

Use a large language model combined with text segmentation and text embedding tools to obtain street view image data through open street maps. Use deep residual networks and K nearest neighbor algorithms to evaluate the crime risk probability of street view images based on the vector inner product formula to improve crime location identification. and the accuracy of environmental feature selection.

Benefits of technology

It achieves accurate identification of named entities in the judicial field, reduces dependence on data, improves the effectiveness of criminal risk identification in street view images, and overcomes the problems of data dependence and blindness in environmental feature selection of existing methods.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118710058A
    Figure CN118710058A
Patent Text Reader

Abstract

The invention discloses an urban street scene typical criminal event risk assessment method, medium and device, and relates to the field of urban street criminal risk assessment, the urban street scene typical criminal event risk assessment method mainly comprises the following steps: obtaining a user prompt by using a big language model according to discriminant text data; training the large language model by using a text divider and a text embedding tool to obtain a trained large language model; according to a user prompt, obtaining a crime place description by using the trained large language model; according to the description of the crime site, utilizing an open street map to obtain a street view image data set; and according to the test streetscape image and the streetscape image data set, the crime risk probability of the test streetscape image is obtained by using the deep residual network. By implementing the urban street scene typical criminal event risk assessment method, the medium and the equipment provided by the invention, the effectiveness of street scene criminal risk identification can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of urban street crime risk assessment, and more specifically, to a method, medium and device for risk assessment of typical criminal incidents in urban street scenes. Background Art

[0002] Crime location information in judicial documents can be extracted through intelligent analysis to achieve automatic statistics of crime geographical distribution and support crime pattern recognition and prediction. This helps law enforcement agencies identify crime hotspots and formulate effective prevention and control strategies, thereby reducing crime rates and improving social security indexes.

[0003] Using street view images to identify crime risks in street environments can reveal the impact of the environment on crime, optimize police resource allocation, and enhance the effectiveness of preventing and combating crime. Combining big data and machine learning can predict crime risks, detect potential crimes in advance and issue early warnings, improve community security, and support safer urban planning and construction.

[0004] Named entity recognition (NER) aims to identify proper names and quantity phrases in text and determine their location, boundaries and types in the text. Common NER methods include rule-based, statistical model and machine learning, deep learning, semi-supervised and unsupervised learning, and hybrid methods. Named entity recognition methods based on statistical models and machine learning usually rely on large-scale annotated data and use statistical or machine learning models to learn the characteristics and patterns of named entities in text. First, a series of features are extracted from the text, such as part of speech, word form, word boundary, context information, etc. These features can help the model better understand the context of the named entity. Then, a model is trained using the extracted features and annotated training data, usually using a supervised learning algorithm. Commonly used statistical models and machine learning models include Maximum Entropy Model (MaxEnt), Hidden Markov Model (HMM), Conditional Random Field (CRF), Support Vector Machine (SVM), etc. The named entity recognition method based on deep learning uses deep neural network models to learn the feature representations of named entities in texts, and uses these representations to identify named entities in given texts. Using deep neural network models, such as Convolutional Neural Network (CNN), Recurrent Neural Network (RNN), Long Short-Term Memory Network (LSTM), Graph Neural Network (GNN), etc., it is possible to automatically learn rich semantic information and contextual relationships from text data.

[0005] Research on criminal behavior from the perspective of urban built environment can be divided into three types: spatial distribution of criminal behavior; research on the internal mechanism of criminal phenomena and urban built environment; and research on crime prevention strategies. Research on the spatial distribution of crime can reveal the patterns and trends of crime, and scholars at home and abroad have conducted a lot of exploration on this. Wang et al. explored the crime patterns in space by conducting spatial and quantitative analysis of property and violent crime data in 140 communities in Toronto, and found that crime hotspots are mainly distributed in the urban core, northwest and east, and pointed out that individual characteristics and community background factors have different effects on crime rates. Araújo et al. monitored criminal incidents through quantitative technology to improve police patrol planning, used machine learning algorithms to accurately point out relatively dangerous places and times, and assisted the police department in accurately allocating patrol forces to avoid ineffective patrols in certain places. In view of the high crime rate, diverse crime types and significant differences in different parts of the city in São Paulo, Garca et al. proposed the CrimAnalyzer visual analysis tool, which can explore local areas and understand their crime patterns, identify spatial crime hotspots that may not have the largest number of crimes but are important, and understand the dynamic changes of crime patterns over time. Liu Lin et al. constructed a multivariate linear regression model to explore the impact of different types of road density on the crime rate of theft in public spaces. The results showed that the density of urban secondary roads, urban branch roads and other accessible roads and the density of inaccessible roads had different effects on the crime rate of theft in public spaces, while the density of urban main roads had no obvious effect on the crime rate of theft in public spaces. Jiang et al. further considered the relationship between time scale and criminal activities and proposed a method of spatial-temporal crime association indication to understand the main causes of crime.

[0006] Zhang Yanji et al. systematically studied the impact of the urban built environment on criminal behavior and residential safety by integrating a large sample survey, criminal cases and spatial data in Beijing. The results showed that the degree of community openness has an impact on residential safety and the frequency of criminal activities, and the management and maintenance of the urban environment is more important than the design and construction stage. Chalfin et al. provide evidence that violent crime can be successfully reduced by changing the scene environment faced by potential victims and criminals. This study focuses on street lights, a common but under-researched feature of the urban landscape, and provides experimental evidence on the impact of street lights on crime.

[0007] The above studies have used traditional built environment data, such as Point of Interest (POI) data, to explore the impact mechanism of urban built environment on crime. In recent years, the widespread use of street view images has provided new ideas for this research direction. Yue et al. combined Baidu Street View images, deep learning algorithms and spatial statistical regression models to study the impact of street population and street physical environment on street crime, and found that the number of street population has a significant positive impact on overall street crime and street property crime. Zhou et al. used Google Street View images and street crime data to analyze the impact of micro-built environment on drug activities. This study provides micro-level evidence that poor management and high accessibility may increase the risk of drug activities. Xie et al. proposed a method that integrates street view images, machine learning models and interpretable analysis to try to understand the impact mechanism of street crime, and found that the number of people in street view images has the most significant impact on street property crime, while specific variables at different street locations have different effects on crime. Yue et al. discussed the situation that the location selection of street crime is affected by street scene environment and street crowd, and combined street scene images, deep learning algorithms and discrete spatial selection models to illustrate that street scene environment is crucial to understanding crime location preferences, especially the number of street crowds is significantly positively correlated with the location preferences of criminals. Zhou et al. explored the relationship between the perceived safety obtained from street scene images and street theft and robbery, and how it changes at different spatial scales, thus revealing the impact of spatial scale on the relationship between perceived safety and crime. Su et al. mainly measured the urban design quality at the entrance of the New York subway through street scene images, computer vision and machine learning technology, and found a significant correlation between urban design quality and street crime density, providing new insights for the interdisciplinary research in the fields of urban planning and criminology. Yue et al. used machine learning models to explore the impact of street population and street physical environment on the number of street theft cases, and examined whether their effects change with the day and night time, and revealed the difference between the impact of environmental factors and control variables on street theft during the day and night. Chen et al. used the old MC district of CA City as a case study and used a negative binomial regression model to analyze the influencing factors of street property crimes in different time periods, revealing the temporal and spatial differentiation characteristics of such crimes, which are manifested as a temporal pattern of "three peaks and two valleys" and a spatial aggregation pattern mainly concentrated in the prosperous commercial areas along the main roads of the city.

[0008] Most of the existing research on named entity recognition is conducted for English texts, and among the methods applicable to Chinese texts, there are very few entity recognition methods designed specifically for the judicial field. Judicial judgment documents are domain-specific texts, and judicial named entities are more complex than general domain entities, which is reflected in the finer description granularity, the existence of entity nesting, and blurred boundaries. Therefore, named entity recognition methods in general fields cannot adapt well to judicial texts. In this case, it is necessary to develop a special judicial named entity recognition method. However, to achieve this goal using existing research, it is necessary to prepare a large amount of high-quality data sets for model training, and to optimize the model hyperparameters to achieve the best results. These steps will consume a lot of manpower and time, and the recognition effect is heavily dependent on data quality.

[0009] As for the study of the relationship between street view images and criminal activities, most of the current methods are implemented by analyzing the association patterns between different geographical features in street views and crimes. However, there is no unified standard for the selection of environmental features, which is the core issue. A considerable number of studies focus on selecting single environmental elements, such as buildings, vehicles, trees, street lights, walls, etc., to study their relationship with crime, but the occurrence of criminal behavior is usually affected by more than one environmental variable. The selection of variables in multi-environmental variable research also has a certain degree of blindness. At the same time, relying on artificially defined semantic features may cause a large number of hidden meanings in street view images to be ignored or lost. In summary, the named entity recognition method in the general field cannot directly act on judicial named entities, and the development of a named entity recognition method specifically for the judicial field requires a lot of time and manpower costs, and the recognition effect is seriously dependent on data quality. Therefore, it is necessary to find other solutions to get rid of the dependence of the method on data. The existing research on the relationship between street view images and criminal activities lacks a unified standard for selecting environmental features, and relies on human-defined semantic features, which cannot guarantee the omission of potential meanings in street view images, and the effectiveness of street scene crime risk identification is low. Summary of the invention

[0010] The purpose of the present invention is to provide a method, medium and equipment for risk assessment of typical criminal incidents in urban street scenes, which can improve the effectiveness of crime risk identification in street scenes.

[0011] The present invention provides a risk assessment method for typical crime events in urban street scenes, comprising the following steps: S1: obtaining a judgment text of a target area, preprocessing the judgment text of the target area, and obtaining judgment text data; S2: obtaining a user prompt by using a large language model according to the judgment text data; S3: training the large language model by using a text segmenter and a text embedding tool according to the judgment text data, and obtaining a trained large language model; obtaining a crime location description by using the trained large language model according to the user prompt; S4: obtaining a street view image data set by using an open street map according to the crime location description; the street view image data set includes a crime street view set and a non-crime street view set; S5: obtaining a test street view image, and obtaining the crime risk probability of the test street view image by using a deep residual network according to the test street view image and the street view image data set.

[0012] Furthermore, step S3 of the above-mentioned method for risk assessment of typical crime incidents in urban street scenes includes: S31: obtaining judgment text block data by using a text segmenter based on the judgment text data; S32: obtaining judgment text vectors by using a text embedding tool based on the judgment text block data; S33: training a large language model by using the judgment text vector to obtain a trained large language model; S34: obtaining a description of the crime location by using the trained large language model according to user prompts.

[0013] Furthermore, step S4 of the above-mentioned risk assessment method for typical crime events in urban street scenes includes: S41: obtaining street view sampling points based on the description of the crime location using the open street map, and obtaining the coordinates of the street view sampling points based on the street view sampling points using the geographic information system; S42: obtaining street view images based on the coordinates of the street view sampling points; S43: obtaining a street view image dataset based on the street view images; the street view image dataset includes a crime street view set and a non-crime street view set.

[0014] Furthermore, step S5 of the above-mentioned method for risk assessment of typical crime events in urban street scenes includes: S51: preprocessing a street view image dataset to obtain a preprocessed street view image dataset; S52: obtaining a test street view image, and obtaining a test street view image feature vector and a street view image feature vector set based on the test street view image and the preprocessed street view image dataset using a deep residual network; the street view image feature vector set includes a crime street view image feature vector set and a non-crime street view image feature vector set; S53: obtaining the feature vector closest to the crime street view image and the feature vector closest to the non-crime street view image based on the test street view image feature vector and the street view image feature vector set; S54: obtaining the crime risk probability of the test street view image based on the test street view image feature vector, the feature vector closest to the crime street view image and the feature vector closest to the non-crime street view image.

[0015] Furthermore, step S53 of the above-mentioned method for risk assessment of typical crime events in urban street scenes includes: based on the test street view image feature vector and the street view image feature vector set, using the K nearest neighbor algorithm to find a vector closest to the test vector from all feature vectors corresponding to the crime street view image set and all feature vectors corresponding to the non-crime street view image set, to obtain the feature vector closest to the crime street view image and the feature vector closest to the non-crime street view image; wherein the distance metric of the K nearest neighbor algorithm is the Euclidean distance.

[0016] Furthermore, step S54 of the above-mentioned method for assessing the risk of typical crime events in urban street scenes includes: obtaining the crime risk probability of the test street scene image according to the feature vector of the test street scene image, the feature vector of the street scene image closest to the crime, and the feature vector of the street scene image closest to the non-crime, such as the formula:

[0017] P(x)=V(x)·V(c)-V(x)·V(nc)

[0018] Among them, P(x) represents the crime risk probability corresponding to the input test street view image x, V(x) is the feature vector of the test street view image x, V(c) and V(nc) are the crime street view feature vector and non-crime street view feature vector closest to V(x), respectively.

[0019] The present invention also provides a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, the steps of the above-mentioned method for risk assessment of typical criminal incidents in urban street scenes are implemented.

[0020] The present invention also provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the steps of the above-mentioned method for risk assessment of typical crime incidents in urban street scenes are implemented.

[0021] The implementation of the risk assessment method, medium and device for typical crime incidents in urban street scenes provided by the present invention has the following beneficial effects:

[0022] The present invention proposes a method for identifying crime locations in legal documents based on a large language model, designs a set of user prompts to guide the large language model to accurately identify crime locations, and implements the call to the large language model by accessing the large language model API, thereby overcoming the problems of the existing prior art that the crime location identification in judicial judgment documents is completed by specially constructing a named entity recognition model, there is a serious reliance on judicial corpus data, the computing resources required for the model training process are high, the hyperparameter scale is huge, and the parameter adjustment process is cumbersome. While training the model, the external place name and address knowledge is automatically learned, thereby enhancing the recognition ability of the large language model.

[0023] The present invention converts street view images into vector expressions. Relying on the powerful representation learning ability of the model, the feature vector can accurately capture the rich feature representation of the street view image at different levels, and the street view images corresponding to feature vectors that are close to each other have a high similarity. The crime street view feature vector and non-crime street view feature vector that are closest to a given street view image are searched out, and the similarity of the feature vectors is evaluated according to the defined improved formula based on the vector inner product, thereby identifying the crime risk probability of the street environment and improving the effectiveness of crime risk identification in street scenes. BRIEF DESCRIPTION OF THE DRAWINGS

[0024] The present invention will be further described below with reference to the accompanying drawings and embodiments, in which:

[0025] Figure 1 It is a flow chart of a risk assessment method for typical crime incidents in urban street scenes provided by the present invention;

[0026] Figure 2 It is a flow chart of constructing the algorithm model provided by the present invention;

[0027] Figure 3 It is a content structure diagram of the research on the identification of crime locations of legal documents based on a large language model provided by the present invention;

[0028] Figure 4 It is a flow chart of the crime location enhanced identification method with external knowledge injection provided by the present invention;

[0029] Figure 5 This is a structural diagram of the research content of street environment crime risk identification based on urban visual characteristics provided by the present invention;

[0030] Figure 6 It is a schematic diagram of crime risk identification in street environment based on urban visual features provided by the present invention;

[0031] Figure 7 It is a technical roadmap for research on street environment crime risk identification based on urban visual features provided by the present invention;

[0032] Figure 8 It is a box plot of crime risk distribution of test set images provided by the present invention;

[0033] Fig. 9 It is a crime risk plot level distribution map provided by the present invention;

[0034] Fig.10 It is a structural block diagram of the computer device provided by the present invention. DETAILED DESCRIPTION

[0035] In order to have a clearer understanding of the technical features, purposes and effects of the present invention, specific embodiments of the present invention are now described in detail with reference to the accompanying drawings.

[0036] Figure 1 A schematic diagram of a typical crime event risk assessment method for a city street scene in this embodiment is shown. In this embodiment, the typical crime event risk assessment method for a city street scene includes the following steps:

[0037] S1: Obtain the judgment text of the target area, pre-process the judgment text of the target area, and obtain judgment text data;

[0038] Specifically, the steps for data preparation for the task of identifying crime location information in legal documents are as follows: based on the original data obtained, further filter out the texts belonging to the first instance trial procedure, trim the overly long texts, and remove redundant and irrelevant information; Figure 2 Shown is a flowchart of algorithm model construction;

[0039] Optionally, step S1 specifically includes: obtaining criminal judgment documents from the China Judgment Documents Network; further screening out the texts belonging to the first instance trial procedure based on the obtained original data; using the text content of the judgment as the processing object for crime location identification; Figure 3 Shown is a content structure diagram of the research on crime location recognition of legal documents based on the large language model;

[0040] S2: Based on the judgment text data, use the large language model to obtain user prompts;

[0041] Specifically, construct user prompts to enable the large language model to accurately complete the tasks assigned by the user and to make the results returned by the model meet the needs of the user; specifically, use a single-round question-answering model to interact with the large language model to guide the model to perform the task of identifying the crime location in the judgment document;

[0042] Optionally, step S2 specifically includes: using a large language model to implement the task of named entity recognition, inputting the judgment text and the prompt content guiding the model recognition into the large language model; completing the recognition of the crime location in the legal document according to its feedback output; constructing an HTTP request and sending it to the API endpoint, then waiting for the response of the API, and finally returning the response data received from the API;

[0043] Specifically, the strategy of looping access to the large language model API is adopted to complete the crime location identification task based on the large language model; based on the analysis of the characteristics of the judgment documents and the adjustment according to the results returned by the large language model in the actual test, the input user prompt is finally determined: "In the text below, where is the specific location where the crime occurred? Answer directly according to the original content, and do not answer irrelevant locations such as the location of the court or the procuratorate or the location where the defendant was arrested or other irrelevant information"; the program reads the content of a judgment document each time to construct a user prompt, and then uses a single-round question-and-answer mode to interact with the large language model to guide the model to perform the crime location identification task in the judgment document; after the program obtains the response content of the large language model, it will automatically extract the crime location description identified by the model according to the response format; finally, the recognition result is written to the output file;

[0044] S3: Based on the judgment text data, the text segmenter and text embedding tool are used to train the large language model to obtain a trained large language model; based on the user prompt, the trained large language model is used to obtain a description of the crime location;

[0045] Specifically, step S3 of the above-mentioned method for risk assessment of typical crime incidents in urban street scenes includes: S31: obtaining judgment text block data by using a text segmenter according to the judgment text data; S32: obtaining judgment text vectors by using a text embedding tool according to the judgment text block data; S33: training a large language model by using the judgment text vectors to obtain a trained large language model; S34: obtaining a description of the crime location by using the trained large language model according to user prompts;

[0046] Optionally, build an external knowledge base containing place name and address knowledge, which integrates corpus covering different geographical levels, expression diversity and contextual details; these corpus include but are not limited to multi-dimensional place name and address information such as administrative divisions, landmark buildings, transportation nodes, community streets, etc., which can ensure that the model fully considers various possible expressions and contextual clues when identifying crime locations; inject external knowledge into the large language model;

[0047] Optionally, step S3 of the above-mentioned risk assessment method for typical crime incidents in urban street scenes includes: using the CharacterTextSplitter tool in the LangChain framework to perform refined text segmentation operations; using the text2vec-base-chinese text embedding tool to perform vectorized conversion of knowledge; using the Chroma vector repository as the carrier of the knowledge base; using the ChatGLM3-6B model as the core large language model of the crime location enhanced recognition method with external knowledge injection; passing the constructed external knowledge enhanced user prompt words to the large language model as additional input to guide it to complete the accurate recognition of the crime location description;

[0048] Specifically, the original document is intelligently segmented to ensure that each text block can independently carry complete place name and address description information and meet the processing specifications of the large language model, so as to prepare for the subsequent knowledge vectorization processing; in order to enable the large language model to understand and effectively use the information in the place name and address knowledge base, the study uses text embedding tools to perform knowledge vectorization conversion; based on the deep learning model, complex text information is compressed into dense vectors. These vectors not only have lower dimensions and are easy to calculate and process, but they also successfully retain the deep semantic features in the original text, so that text information that was originally difficult to directly compare can be efficiently compared and retrieved in the vector space;

[0049] Specifically, this embodiment uses the ChatGLM3-6B model as the core large language model of the crime location enhanced recognition method with external knowledge injection. The model supports local deployment by users, and the deployment method is simpler and the deployment cost is lower. By downloading the open source model weight file to the local and installing it to the correct path, the pre-defined model loading script and running program can be executed to use the ChatGLM3-6B model. This makes the application of the model more flexible and autonomous, thereby facilitating the improvement of the large language model usage process, so as to support this study in combining with an external knowledge base to enhance the recognition ability of the crime location description.

[0050] Specifically, the trained large language model includes a place name and address knowledge base, which is used to load the local model weight file into the memory. When the model instance is created and receives the task of identifying the description of the crime location, it will first retrieve the knowledge fragment most relevant to the text to be identified from the constructed place name and address knowledge base; by comparing the semantic distance between the vector representation of the text to be identified and each vector in the knowledge base, the knowledge entry that best fits the description of the crime location is found; in order to further strengthen the external knowledge application of the large language model in the recognition task, this embodiment designs a user prompt template mechanism; based on the relevant place name and address knowledge found, the system automatically generates user prompt words rich in domain knowledge. These prompt words not only contain key place name information, but also incorporate multiple elements such as contextual context and geographical association, aiming to provide more targeted guidance information for the large language model; finally, the constructed external knowledge-enhanced user prompt words are passed to the large language model as additional input to guide it to complete the accurate recognition of the description of the crime location; Figure 4 Shown is a flow chart of the crime location enhanced identification method with external knowledge injection;

[0051] S4: Based on the description of the crime location, the street view image dataset is obtained using the open street map; the street view image dataset includes a crime street view set and a non-crime street view set;

[0052] Specifically, step S4 of the above-mentioned method for risk assessment of typical crime incidents in urban street scenes includes:

[0053] S41: Based on the description of the crime location, the street view sampling points are obtained using the open street map, and based on the street view sampling points, the coordinates of the street view sampling points are obtained using the geographic information system;

[0054] Specifically, we use the road network data obtained from OpenStreetMap (OSM) to generate street scene sampling points to ensure that the collected street scenes are evenly distributed in space, and then use ArcGIS software to calculate the longitude and latitude coordinates of each sampling point;

[0055] S42: Obtaining a street view image according to the street view sampling point coordinates;

[0056] Specifically, a Python script is written to call the Tencent location service static image API, and a URL request containing parameters such as the development key, image size, and longitude and latitude coordinates is constructed to batch obtain the required street view images based on the longitude and latitude information of the sampling points.

[0057] S43: obtaining a street view image dataset according to the street view image; the street view image dataset includes a crime street view set and a non-crime street view set;

[0058] Among them, the street view image dataset can be used to transform the abstract visual features in street view images into concrete vector expressions using the feature extraction capability of the ResNet50 model, and define a feature similarity calculation method to evaluate the potential crime risk level in street views;

[0059] S5: Obtain a test street view image, and obtain the crime risk probability of the test street view image using a deep residual network according to the test street view image and the street view image dataset;

[0060] Specifically, step S5 of the above-mentioned method for risk assessment of typical crime incidents in urban street scenes includes:

[0061] S51: preprocessing the street view image dataset to obtain a preprocessed street view image dataset;

[0062] S52: Acquire a test street view image, and obtain a test street view image feature vector and a street view image feature vector set using a deep residual network according to the test street view image and a preprocessed street view image dataset; the street view image feature vector set includes a crime street view image feature vector set and a non-crime street view image feature vector set;

[0063] S53: obtaining a feature vector of a street view image closest to a crime and a feature vector of a street view image closest to a non-crime according to the test street view image feature vector and the street view image feature vector set;

[0064] Specifically, step S53 of the above-mentioned method for risk assessment of typical crime incidents in urban street scenes includes:

[0065] According to the test street view image feature vector and the street view image feature vector set, a vector closest to the test vector is found from all feature vectors corresponding to the crime street view image set and all feature vectors corresponding to the non-crime street view image set using the K nearest neighbor algorithm, so as to obtain the feature vector closest to the crime street view image and the feature vector closest to the non-crime street view image; wherein the distance metric of the K nearest neighbor algorithm is the Euclidean distance;

[0066] S54: Obtaining the crime risk probability of the test street view image according to the test street view image feature vector, the feature vector of the street view image closest to the crime, and the feature vector of the street view image closest to the non-crime;

[0067] Specifically, step S54 of the above-mentioned method for risk assessment of typical crime incidents in urban street scenes includes:

[0068] According to the feature vector of the test street view image, the feature vector of the street view image closest to the crime, and the feature vector of the street view image closest to the non-crime, the crime risk probability of the test street view image is obtained, as shown in the formula:

[0069] P(x)=V(x)·V(c)-V(x)·V(nc)

[0070] Where P(x) represents the crime risk probability corresponding to the input test street view image x, V(x) is the feature vector of the test street view image x, V(c) and V(nc) are the crime street view feature vector and non-crime street view feature vector closest to V(x), respectively.

[0071] Optionally, step S5 of the above-mentioned method for assessing the risk of typical crime events in urban street scenes includes: the original street view image in the data set is opened by using the Image module of the Python Imaging Library (PIL), and then a series of preprocessing operations are required to adapt to the input requirements of the ResNet50 model; in order to extract the visual features of the street view image, the pre-trained ResNet50 model is loaded, and the last fully connected layer of the model is removed, and the main part of the network is retained; the ResNet50 model generates a feature vector after extracting features from the street view image, and uses an improved formula based on the inner product of the vector to evaluate the similarity of the feature vector, thereby identifying the crime risk probability of the street environment;

[0072] Specifically, feature similarity is a metric to measure the similarity between two feature vectors, and is usually used to compare the similarities or differences between different images or different regions in an image. The feature vector similarity of street view images is an effective means to quantitatively analyze the similarity of different street environments. Since feature vectors are stable, when the street environments in the input street view images are similar, the extracted feature vectors should also be similar. The stability of feature vectors comes from the abstract ability of deep learning models to image features. This embodiment uses an improved formula based on vector inner product to evaluate the similarity of feature vectors, and then identifies the crime risk probability of the street environment. For the input street view image, the ResNet50 model is first used to obtain the corresponding 2048-dimensional feature vector. The K-Nearest Neighbor (K-Nearest Neighbor) The KNN algorithm finds a vector closest to the test vector from all feature vectors corresponding to the crime street view image set and all feature vectors corresponding to the non-crime street view image set. In this embodiment, the Euclidean distance is selected as the distance metric for K-nearest neighbor search. The two selected feature vectors are respectively recorded as V(c) (crime) and V(nc) (non-crime). The similarity between the test vector and the two feature vectors is calculated using the vector inner product, and the crime risk value of the input street view image is evaluated according to formula (1):

[0073] P(x)=V(x)·V(c)-V(x)·V(nc)

[0074] Among them, P(x) represents the crime risk probability corresponding to the input street view image x, V(x) is the feature vector of the street view image x, V(c) and V(nc) are the feature vectors of the crime street view and the feature vectors of the non-crime street view that are closest to V(x), respectively; the more similar the two feature vectors for the inner product operation are, the larger the value obtained by the operation; therefore, if V(x) and V(c) are more similar, the value of P(x) will become larger, while V(x) and V(nc) will make the value of P(x) larger when they are less similar; the above formula shows that a larger P(x) indicates that the street view image x is more similar to the crime street scene, and the difference with the non-crime street scene is larger, so it is believed that there is a high crime risk in the environment of the street view image x; such as Figure 5 Shown is a content structure diagram of the research on crime risk identification in street environments based on urban visual characteristics.

[0075] In some embodiments, the above-mentioned typical crime incident risk assessment method for urban street scenes can also be implemented in the following manner.

[0076] This example selects judicial judgment documents published by a certain people's court and obtains documents of the criminal judgment type: Figure 6 Shown is a schematic diagram of crime risk identification in street environments based on urban visual characteristics; Figure 7 It is a technical roadmap for the research on crime risk identification in street environments based on urban visual characteristics;

[0077] Step 1: Use the large language model to implement the task of named entity recognition. Input the judgment text and the prompt content guiding the model to recognize into the large language model, and complete the recognition of the crime location in the legal document according to its feedback output; in order to improve the quality of the recognized crime location data and facilitate the subsequent research to locate its spatial location as accurately as possible according to the description of the crime location, it should be ensured that the model extracts the most detailed location information; Based on the above analysis and adjustments made according to the results returned by the large language model in the actual test, the input user prompt text was finally determined as: "In the text below, where is the specific location where the crime occurred? Answer directly according to the original content, and do not answer irrelevant locations or other irrelevant information such as the location of the court or procuratorate or the location where the defendant was arrested";

[0078] Step 2: Use the strategy of looping access to the large language model API to complete the crime location identification task based on the large language model. The program reads the content of a judgment document each time to construct a user prompt, and then uses a single-round question-and-answer mode to interact with the large language model to guide the model to perform the crime location identification task in the judgment document. After the program obtains the response content of the large language model, it will automatically extract the crime location description identified by the model according to the response format. Finally, after writing the recognition result to the output file, the call to the large language model API is terminated and the next round of API access is started.

[0079] Step 3: Build an external knowledge base containing place name and address knowledge, and use the CharacterTextSplitter tool in the LangChain framework to perform refined text segmentation operations; CharacterTextSplitter intelligently splits the original document according to the preset text block size (set to 256) to ensure that each text block can independently carry complete place name and address description information; The ChatGLM3-6B model is selected as the core large language model of the crime location enhanced recognition method with external knowledge injection, because the model supports local deployment by users. After loading the local model weight file into the memory, the created model instance will retrieve the knowledge fragment most relevant to the text to be recognized from the constructed place name and address knowledge base when receiving the task of identifying the crime location description;

[0080] Step 4: Select the area within the Third Ring Road of a city as the research area, including District 1, District 2, District 3, District 4, District 5, District 6 and District 7, District 8, District 9, District 10, and District 11; use the road network data within the Third Ring Road of the city obtained from OpenStreetMap (OSM) to generate street view sampling points to ensure that the collected street views are evenly distributed in space, and then use ArcGIS software to calculate the longitude and latitude coordinates of each sampling point; the data used include crime location coordinate data and street view image data; the crime location coordinate data is obtained from the crime location in Chapter 3 Description After decoding the address information, the corresponding longitude and latitude coordinates are obtained; the longitude and latitude coordinates used in this embodiment are based on the GCS-WGS1984 geographic coordinate system; by writing a Python script to call the Tencent location service static image API, a URL request containing development keys, image size, longitude and latitude coordinates and other parameters is constructed, and the required street view images can be obtained in batches according to the longitude and latitude information of the sampling points. In this embodiment, the size of the street view image is set to 512 pixels × 512 pixels; finally, after manual visual inspection of the street view image quality, a total of 56,461 street view images are finally available;

[0081] Step 5: Use the pre-trained ResNet50 model as a feature extractor to efficiently obtain visual features from street view images. First, the original street view images in the dataset are opened by using the Image module of the Python Imaging Library (PIL). Then, a series of pre-processing operations are required to adapt to the input requirements of the ResNet50 model. The transforms.Compose class of PyTorch can be used to combine multiple transformation operations. Specifically, for each street view image, the transforms.Resize function is used to resize the image to 224×224 pixels, which is the fixed input size required by the ResNet50 model, which can ensure that the pre-trained model can smoothly process the input street view image data. Since the input of the neural network model is usually required to be in tensor format rather than the PIL format of the original image, next, the tr The ansforms.ToTensor function converts the PIL image format to the PyTorch tensor format for easy calculation in the network. In this process, the image is converted into a multidimensional tensor, where each dimension corresponds to the channel, height, and width of the image. At the same time, the process of converting the image to the tensor format can also normalize the image data. The pixel values ​​of the image will be scaled to the range of [0,1] to meet the requirements of PyTorch. Finally, the transforms.Normalize function is used to normalize the RGB channels of the image to ensure that all images have a uniform color distribution, so that the input data conforms to the standardized parameters used in model pre-training.

[0082] Combining the coordinate parameters of the street view image data for buffer analysis, the entire street view image set can be divided into a crime street view image set and a non-crime street view image set; 1940 crime street view images are obtained; after that, a non-crime street view image set needs to be constructed, and 7760 images are randomly selected from the remaining images to form a non-crime street view image set;

[0083] Based on the use of specially designed user prompt text to guide the large language model to complete the identification of crime locations in judicial documents, this embodiment further improves the method and proposes an enhanced identification method for crime locations with external knowledge injection. Next, the recognition performance and quality of this method for crime location descriptions will be verified: as shown in Table 1, the recognition result accuracy of the gpt-3.5-turbo model, the ChatGLM3-6B model, and the enhanced identification result accuracy of crime locations with external knowledge injection based on the ChatGLM3-6B model are recorded. The accuracy, recall rate, and F1 score are also used to show their respective precision, completeness, and comprehensive performance.

[0084] Table 1 Comparison of recognition accuracy of gpt-3.5-turbo, ChatGLM3-6B and enhanced recognition accuracy of external knowledge injection

[0085]

[0086] The gpt-3.5-turbo model showed high performance in terms of accuracy, reaching 0.814, and in terms of recall, 0.562; in contrast, the ChatGLM3-6B model without external knowledge injection was weaker than the gpt-3.5-turbo model in terms of accuracy and recall, especially in terms of recall, which was only 0.143, reflecting that the model had obvious defects in fully capturing the crime location information;

[0087] However, when the external knowledge injection technology was used to enhance the ChatGLM3-6B model, the situation changed significantly. Under the enhanced recognition method, the recognition accuracy of the ChatGLM3-6B model jumped from 0.729 to 0.894, even surpassing the gpt-3.5-turbo model. The recall rate was also greatly improved to 0.533, which was still slightly lower than the recall rate of the gpt-3.5-turbo model, but the gap had been significantly narrowed.

[0088] In terms of the F1 score that comprehensively considers the balance between accuracy and recall, the gpt-3.5-turbo model scored 0.665, while the ChatGLM3-6B model, which was optimized after external knowledge injection, scored 0.668, which is basically the same as or even slightly ahead. This shows that by introducing external place name and address knowledge for enhanced recognition, the ChatGLM3-6B model's performance in identifying crime scene descriptions can be significantly improved, so that the ChatGLM3-6B model, which was initially significantly weaker in recognition ability than the gpt-3.5-turbo model, can be comparable to or even surpass the gpt-3.5-turbo model to a certain extent after optimization. The above results strongly prove the effectiveness of the crime scene enhanced recognition method injected with external knowledge, and also provide a strong empirical basis for further exploring the use of large-scale pre-trained models combined with external knowledge to solve legal text understanding and information extraction problems.

[0089] In order to verify the effectiveness of this embodiment for street scene crime risk identification, a performance evaluation was first performed on a test dataset; the test dataset contains a total of 9700 street scene images, including 1940 crime street scene images and 7760 non-crime street scene images; Figure 8 is a box plot of the crime risk distribution of the test set images;

[0090] Fig. 9The distribution of crime risk values ​​of street view images in the test set is shown. The risk values ​​of criminal street view images and non-criminal street view images show significant differences in interval distribution, and there is no overlap in the crime risk values ​​between them. It can be seen that the street view images in the test data set can basically obtain reasonable crime risk values, which shows that the feature vectors extracted by the ResNet50 model from the street view images effectively represent the landscape characteristics of the street environment, so that the correct similarity vectors can be efficiently found to calculate the crime risk, which provides strong support for crime risk identification based on feature similarity.

[0091] This embodiment provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the above-mentioned method for risk assessment of typical crime events in urban street scenes are implemented. The storage medium may be a magnetic disk, an optical disk, a read-only memory (ROM), a random access memory (RAM), a flash memory, a hard disk drive (HDD) or a solid-state drive (SSD), etc.; the storage medium may also include a combination of the above-mentioned types of memory.

[0092] This embodiment provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, the steps of the above-mentioned method for risk assessment of typical crime incidents in urban street scenes are implemented.

[0093] like Fig.10As shown, the computer device may include: at least one processor 121, such as a CPU (Central Processing Unit), at least one communication interface 123, a memory 124, and at least one communication bus 122. Among them, the communication bus 122 is used to realize the connection and communication between these components. Among them, the communication interface 123 may include a display screen (Display), a keyboard (Keyboard), and the optional communication interface 123 may also include a standard wired interface and a wireless interface. The memory 124 may be a high-speed RAM memory (Random Access Memory, volatile random access memory) or a non-volatile memory (non-volatile memory), such as at least one disk memory. The memory 124 may also be at least one storage device located away from the aforementioned processor 121. Among them, the memory 124 stores an application program, and the processor 121 calls the program code stored in the memory 124 to perform any of the above method steps. Among them, the communication bus 122 may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus, etc. The communication bus 122 can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Fig.10Only one line is used to represent it, but it does not mean that there is only one bus or one type of bus. Among them, the memory 124 may include a volatile memory (English: volatile memory), such as a random access memory (English: random-access memory, abbreviated: RAM); the memory may also include a non-volatile memory (English: non-volatile memory), such as a flash memory (English: flash memory), a hard disk drive (English: hard disk drive, abbreviated: HDD) or a solid-state drive (English: solid-state drive, abbreviated: SSD); the memory 124 may also include a combination of the above-mentioned types of memory. Among them, the processor 121 may be a central processing unit (English: central processing unit, abbreviated: CPU), a network processor (English: network processor, abbreviated: NP) or a combination of CPU and NP. Among them, the processor 121 may further include a hardware chip. The above-mentioned hardware chip may be an application-specific integrated circuit (English: application-specific integrated circuit, abbreviated: ASIC), a programmable logic device (English: programmable logic device, abbreviated: PLD) or a combination thereof. The PLD can be a complex programmable logic device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL), or any combination thereof. Optionally, the memory 124 is also used to store program instructions. The processor 121 can call program instructions to implement the risk assessment method for typical crime events in urban street scenes as in this embodiment.

[0094] The embodiments of the present invention are described above in conjunction with the accompanying drawings, but the present invention is not limited to the above-mentioned specific implementation modes, which are merely illustrative rather than restrictive. Under the guidance of the present invention, ordinary technicians in this field can also make many forms without departing from the scope of protection of the present invention and the claims, all of which are within the protection of the present invention.

Claims

1. A risk assessment method for typical crime incidents in urban street scenes, comprising the following steps: S1: Obtain the judgment text of the target area, pre-process the judgment text of the target area, and obtain judgment text data; S2: obtaining user prompts based on the judgment text data using a large language model; S3: According to the judgment text data, a large language model is trained using a text segmenter and a text embedding tool to obtain a trained large language model; according to user prompts, a description of the crime location is obtained using the trained large language model; S4: obtaining a street view image dataset using an open street map according to the description of the crime location; the street view image dataset includes a crime street view set and a non-crime street view set; S5: Obtain a test street view image, and obtain the crime risk probability of the test street view image using a deep residual network based on the test street view image and the street view image dataset.

2. The risk assessment method for typical crime events in urban street scenes according to claim 1 is characterized in that: Step S3 includes: S31: obtaining judgment text block data using a text segmenter according to the judgment text data; S32: obtaining a judgment text vector using a text embedding tool according to the judgment text block data; S33: training the large language model using the judgment document text vector to obtain a trained large language model; S34: According to the user prompt, the trained large language model is used to obtain a description of the crime location.

3. The risk assessment method for typical crime events in urban street scenes according to claim 1 is characterized in that: Step S4 includes: S41: obtaining street view sampling points using an open street map according to the description of the crime location, and obtaining street view sampling point coordinates using a geographic information system according to the street view sampling points; S42: Obtaining a street view image according to the street view sampling point coordinates; S43: Obtain a street view image dataset according to the street view image; the street view image dataset includes a crime street view set and a non-crime street view set.

4. The risk assessment method for typical crime events in urban street scenes according to claim 1 is characterized in that: Step S5 includes: S51: preprocessing the street view image dataset to obtain a preprocessed street view image dataset; S52: Acquire a test street view image, and obtain a test street view image feature vector and a street view image feature vector set using a deep residual network according to the test street view image and a preprocessed street view image dataset; the street view image feature vector set includes a crime street view image feature vector set and a non-crime street view image feature vector set; S53: obtaining a feature vector of a street view image closest to a crime and a feature vector of a street view image closest to a non-crime according to the test street view image feature vector and the street view image feature vector set; S54: Obtain the crime risk probability of the test street view image according to the test street view image feature vector, the feature vector of the street view image closest to the crime, and the feature vector of the street view image closest to the non-crime.

5. The risk assessment method for typical crime events in urban street scenes according to claim 4 is characterized in that: Step S53 includes: According to the test street view image feature vector and the street view image feature vector set, a vector closest to the test vector is respectively found from all feature vectors corresponding to the crime street view image set and all feature vectors corresponding to the non-crime street view image set using a K nearest neighbor algorithm to obtain a feature vector closest to the crime street view image and a feature vector closest to the non-crime street view image; wherein the distance metric of the K nearest neighbor algorithm is the Euclidean distance.

6. The risk assessment method for typical crime events in urban street scenes according to claim 4 is characterized in that: Step S54 includes: According to the test street view image feature vector, the feature vector of the street view image closest to the crime and the feature vector of the street view image closest to the non-crime, the crime risk probability of the test street view image is obtained, as shown in the formula: P(x)=V(x)V(c)-V(x)·V(nc) Among them, P(x) represents the crime risk probability corresponding to the input test street view image x, V(x) is the feature vector of the test street view image x, V(c) and V(nc) are the crime street view feature vector and non-crime street view feature vector closest to V(x), respectively.

7. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the risk assessment method for typical crime events in urban street scenes as claimed in any one of claims 1-6 are implemented.

8. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the steps of the risk assessment method for typical crime events in urban street scenes as claimed in any one of claims 1-6 are implemented.

Citation Information

Cited By

  • Urban space optimization design method and system based on urban crime multi-modal spatial-temporal distribution knowledge representation

    CN121259230A