POI-based vehicle-mounted music recommendation method and system and vehicle
By parsing POI types and matching music tags, combined with dynamic programming algorithms, the problem of in-car music recommendation being unable to meet the user's mood needs is solved, and the effect of music being played exactly when it reaches the destination is achieved, improving user experience and safety.
Patent Information
- Application Number
- CN202410640512.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-22
- Publication Date
- 2024-08-23
AI Technical Summary
In-vehicle terminals require manual operation by the user when playing music in navigation, which causes the eyes to move out of the driving field of vision, affecting traffic safety. Music recommendations cannot meet the mood needs of users with different POIs, affecting the user experience.
Based on POI type analysis and music tag matching, a dynamic programming algorithm is used to calculate the optimal music list in the remaining time to ensure that the music is finished playing when it reaches the destination, improving user experience.
It improves the user's listening experience, avoids safety hazards caused by users' manual operations, meets the music needs of different navigation destinations, and improves the personalization and accuracy of music recommendations.
Smart Images

Figure CN118535798A
Abstract
Description
Technical Field
[0001] The present invention relates to the field of vehicle technology, and in particular to a POI-based in-vehicle music recommendation method, system, electronic equipment, storage medium and vehicle. Background Art
[0002] At present, the following problems exist when the vehicle terminal plays music during navigation:
[0003] 1. Audio playback generally requires active user operation, and often ends before navigation ends, requiring the user to manually operate again to play the music. However, when the user manually operates, the line of sight moves out of the driving field of vision, hindering driving operations and easily causing traffic safety hazards, and the user experience is not good;
[0004] 2. Music recommendations are often based on the user's historical playlist or listening habits. However, different users have different moods at different POIs of the navigation destination, and the types of music they need may also vary. The same type of music recommendations cannot satisfy the user's current mood, affecting the user's listening experience.
[0005] Therefore, the present application provides a POI-based in-vehicle music recommendation method to solve the above technical problems. Summary of the invention
[0006] The object of the present invention is to provide a POI-based in-vehicle music recommendation method, system, electronic device, storage medium and vehicle, which can solve at least one of the technical problems mentioned above.
[0007] In order to solve the above technical problems, the present invention provides a POI-based in-vehicle music recommendation method, comprising:
[0008] In response to the acquired destination information, parsing the POI type of the destination information;
[0009] Determining a music type that matches the POI type based on a defined matching rule between the POI type and the music tag;
[0010] Based on the music type that matches the POI type, music that matches the music type is acquired, and an initial music list that matches the music type is generated according to a defined screening rule;
[0011] In response to the acquired path information, the remaining time required to reach the destination information is dynamically calculated, based on the initial music list, the optimal music list that can be played within the remaining time is calculated according to a dynamic programming algorithm, and music is played according to the order of the optimal music list.
[0012] In some specific embodiments, in response to the acquired destination information, parsing the POI type of the destination information specifically includes:
[0013] In response to the navigation start signal, calling the map API service;
[0014] Responding to a control command input by a user or according to a driving trajectory of the vehicle, obtaining navigation destination information;
[0015] The POI type is parsed based on the navigation destination information, wherein the POI type includes different scene types.
[0016] In some specific embodiments, based on the defined matching rules between the POI type and the music tag, determining the music type matching the POI type specifically includes:
[0017] Defining a matching rule between the POI type and the music tag, wherein the matching rule includes clarifying the music type or music style associated with each POI type;
[0018] Constructing a database including association information between the POI type and the music tag;
[0019] The database is traversed to obtain music types that match the POI type.
[0020] In some specific embodiments, based on the music type that matches the POI type, music that matches the music type is obtained, and according to a defined screening rule, an initial music list that matches the music type is generated, specifically including:
[0021] Based on the music type, obtaining music matching the music type in a music database, wherein the music database includes a local music library and an online music service;
[0022] Based on the screening rules, the music is screened and sorted to generate an initial music list, wherein the screening rules include user preferences, music ratings, and music duration;
[0023] The number of songs in the initial music list is set, and the total music duration of the initial music list is obtained.
[0024] In some specific embodiments, in response to the acquired path information, dynamically calculating the remaining time required to reach the destination information, calculating the optimal music list that can be played within the remaining time according to the dynamic programming algorithm based on the initial music list, and playing music according to the order of the optimal music list, specifically includes:
[0025] Based on the path information, dynamically calculate the remaining time required to reach the destination information and update the remaining time in real time;
[0026] Traverse the initial music list to obtain the music duration of each piece of music;
[0027] Constructing a dynamic programming table, and calculating the optimal music list that can be played within the remaining time based on the dynamic programming algorithm, wherein the dynamic programming algorithm obtains the optimal solution by filling in the dynamic programming table according to the relationship between the music duration of each piece of music and the remaining time;
[0028] Based on the result of the dynamic planning table, the optimal music list is selected, and the music is played in the order of the optimal music list.
[0029] In some specific embodiments, a dynamic programming table is constructed, and based on the dynamic programming algorithm, the optimal music list that can be played within the remaining time is calculated, specifically including:
[0030] Initialize a two-dimensional array dp, where the number of rows is the number of songs in the initial music list plus 1, the number of columns is the possible value of the remaining time plus 1, and all elements are initialized to 0;
[0031] The dynamic programming algorithm includes:
[0032] dp[i][j]=max(dp[i-1][j],dp[i-1][j-musicDuration[i-1]]+mu sicDuration[i-1]);
[0033] Wherein, i represents the number of songs, j represents the remaining time, and musicDuration represents the duration of the song, which is used to calculate the longest playing duration of i under the remaining time j;
[0034] Use a double loop to traverse all the music and the remaining time, and fill the dp array based on the dynamic programming algorithm;
[0035] When filling is completed, the optimal music playing combination is found through reverse deduction starting from the last element of the dp array to generate the optimal music list.
[0036] Based on the same concept, the present invention also provides a POI-based in-vehicle music recommendation system, comprising:
[0037] a POI type parsing module, configured to parse the POI type of the destination information in response to the acquired destination information;
[0038] A music type matching module, configured to determine a music type matching the POI type based on a defined matching rule between the POI type and the music tag;
[0039] A music list screening module, configured to obtain music matching the music type based on the music type matching the POI type, and generate an initial music list matching the music type according to a defined screening rule;
[0040] The dynamic planning playback module is configured to dynamically calculate the remaining time required to reach the destination information in response to the acquired path information, calculate the optimal music list that can be played within the remaining time based on the initial music list according to the dynamic planning algorithm, and play music according to the order of the optimal music list.
[0041] Based on the same concept, the present invention also provides an electronic device, including: a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus; a computer program is stored in the memory, and when the computer program is executed by the processor, the processor executes the steps of the POI-based in-vehicle music recommendation method.
[0042] Based on the same concept, the present invention also provides a computer-readable storage medium storing a computer program executable by an electronic device. When the computer program runs on the electronic device, the electronic device executes the steps of the POI-based in-vehicle music recommendation method.
[0043] Based on the same concept, the present invention also provides a vehicle, wherein the vehicle is provided with the above-mentioned POI-based in-vehicle music recommendation system.
[0044] Compared with the prior art, the invention has the following beneficial effects:
[0045] The present invention discloses a POI-based in-vehicle music recommendation method, system, electronic device, storage medium and vehicle. According to the parsed POI type and matching with the music tag, dynamic planning is used to ensure that the music is just finished when arriving at the destination, thereby improving the user's listening experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] Figure 1 It is a flowchart of a POI-based in-vehicle music recommendation method in some specific embodiments of the present invention;
[0047] Figure 2 It is a flowchart of a POI-based in-vehicle music recommendation method in some applications of the present invention;
[0048] Figure 3It is a schematic diagram of the calculation flow of filling a table in some applications of a POI-based in-vehicle music recommendation method of the present invention;
[0049] Figure 4 It is a schematic diagram of the reverse derivation process of a POI-based in-vehicle music recommendation method in some applications of the present invention;
[0050] Figure 5 It is a structural schematic diagram of a POI-based in-vehicle music recommendation system in some specific embodiments of the present invention;
[0051] Figure 6 It is a schematic diagram of the structure of an electronic device in some specific embodiments of the present invention. DETAILED DESCRIPTION
[0052] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present application.
[0053] The terms used in the embodiments of the present application are only for the purpose of describing specific embodiments, and are not intended to limit the present application. The singular forms "a", "said" and "the" used in the embodiments of the present application and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings, and "multiple" generally includes at least two.
[0054] It should be understood that the term "and / or" used in this article is only a description of the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally indicates that the associated objects before and after are in an "or" relationship.
[0055] It should be understood that although the terms first, second, third, etc. may be used to describe in the embodiments of the present application, these descriptions should not be limited to these terms. These terms are only used to distinguish the descriptions. For example, without departing from the scope of the embodiments of the present application, the first may also be referred to as the second, and similarly, the second may also be referred to as the first.
[0056] As used herein, the words "if" and "if" may be interpreted as "at the time of" or "when" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrases "if it is determined" or "if (stated condition or event) is detected" may be interpreted as "when it is determined" or "in response to determining" or "when detecting (stated condition or event)" or "in response to detecting (stated condition or event)", depending on the context.
[0057] It should also be noted that the term "includes", "comprising" or any other variation thereof is intended to cover non-exclusive inclusion, so that a commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprising a ..." do not exclude the existence of other identical elements in the commodity or device including the elements.
[0058] It should be particularly noted that any symbols and / or numbers in the specification that are not marked in the accompanying drawings are not drawing marks.
[0059] Reference Figure 1 , a POI-based in-vehicle music recommendation method, comprising:
[0060] S101, in response to the acquired destination information, parsing the POI type of the destination information;
[0061] It is understandable that in this step, after the user starts the navigation system or map application, the destination information is obtained through input (such as keyboard input, voice input, etc.) or automatic recognition (such as judging according to the vehicle's driving trajectory). The destination information includes the name, address, longitude and latitude of the destination.
[0062] For example, when a user inputs "navigate to Central Park" through voice, the destination is recognized as "Central Park" and its related address and longitude and latitude information are obtained.
[0063] After obtaining the destination information, the destination is classified, that is, its POI type is determined. POI types include restaurants, parks, shopping malls, cinemas, etc. In order to accurately parse the POI type, a POI type library is pre-defined. The POI type library contains various POI types and their related information. The name, label, description and other information of various POI types are recorded, and a mechanism for matching with the navigation destination information is provided.
[0064] For example, the POI type library contains the following information:
[0065] POI Type: Park
[0066] Tags: leisure, outdoor
[0067] Example names: Central Park, People's Park
[0068] POI Type: Restaurant
[0069] Tags: food, catering
[0070] Example names: KFC, Pizza Hut
[0071] The acquired destination information is matched with the information in the POI type library to determine the POI type of the destination.
[0072] For example, in the above example, "Central Park" is matched with the information in the POI type library, and it is found that "Central Park" matches the example name under the POI type of "Park", so the POI type of the destination is determined to be "Park".
[0073] In some of the applications, in response to the acquired destination information, the POI type of the destination information is parsed, and in response to the navigation start signal, the map API service is called; in response to the control instructions input by the user or according to the driving trajectory of the vehicle, the navigation destination information is acquired; based on the navigation destination information, the POI type is parsed, and the POI type includes different scene types.
[0074] It is understandable that in this application, when the user starts navigation, the map API service is called. The map API service provides rich map data and functional interfaces, including location search, route planning, real-time traffic conditions, etc. Navigation destination information is obtained in two ways: one is to respond to control commands input by the user, such as the user inputs the destination name or address through voice input or touch screen; the other is to automatically determine the destination according to the vehicle's driving trajectory. Example 1 (user input): The user enters "Central Mall" as the destination through the touch screen of the in-vehicle navigation, and the vehicle receives and recognizes this input as navigation destination information. Example 2 (automatic judgment): Based on the vehicle's driving trajectory and current position, combined with historical driving data and map information, it is automatically judged that the user's possible destination is "City Square", and it is used as navigation destination information.
[0075] After obtaining the navigation destination information, the information is parsed to determine the POI type of the destination.
[0076] S102, determining a music type that matches the POI type based on a defined matching rule between the POI type and the music tag;
[0077] It is understandable that in this step, the matching rules between POI types and music tags are first defined. They are formulated based on common POI types and their association with music types. For example, a shopping mall may be more suitable for playing brisk pop music, while a park may be more suitable for playing tranquil nature music.
[0078] For example:
[0079] POI Type: Shopping Mall
[0080] Matching music tags: pop, light, shopping;
[0081] POI Type: Park
[0082] Matching music tags: nature, tranquility, relaxation;
[0083] POI Type: Restaurant
[0084] Matching music tags: jazz, romantic, gourmet;
[0085] These rules can be adjusted and optimized according to actual needs to ensure the matching of music and POI type.
[0086] In navigation, the POI type of the navigation destination is obtained through user input or automatic recognition, which is combined with the above-mentioned process of obtaining navigation destination information.
[0087] For example, a user inputs "Navigate to Central Park" through the voice input function of the in-vehicle navigation, and identifies the POI type of the destination as "park".
[0088] According to the predefined matching rules between POI types and music tags, the music tags matching the acquired POI types are searched and the corresponding music types are determined.
[0089] For example, in the above example, the POI type of the destination obtained is "park".
[0090] According to the matching rules, music tags matching "park" are searched, and "nature", "tranquility" and "relaxation" are obtained.
[0091] Based on these music tags, the types of music that match the “park” genre are determined to be nature music or relaxing music.
[0092] Finally, according to the determined music type, the corresponding music is selected from the music library for playback. In order to provide a richer and more personalized music experience, intelligent recommendations can also be made based on the user's music preferences and historical playback records.
[0093] In some of the applications, based on the defined matching rules between POI types and music tags, in determining the music types that match the POI types, matching rules between POI types and music tags are defined, and the matching rules include clarifying the music types or music styles associated with each POI type; building a database containing the association information between POI types and music tags; traversing the database to obtain the music types that match the POI types.
[0094] It can be understood that, in this application, the music type or music style that is usually associated with each POI type is firstly clarified.
[0095] For example,
[0096] POI Type: Cafe
[0097] Related music tags: jazz, light music, relaxation;
[0098] POI Type: Gym
[0099] Related music tags: dynamic, electronic, rock;
[0100] POI Type: Park
[0101] Related music tags: nature, tranquility, folk music;
[0102] After defining the matching rules, a database containing the association information between POI types and music tags is constructed for the subsequent music matching process.
[0103] For example,
[0104] Table name: POI_Music_Association;
[0105] Fields:
[0106] poi_type (POI type, such as "café", "gym", "park", etc.)
[0107] music_label (music label, such as "Jazz", "Dynamic", "Natural", etc.)
[0108] association_score (association score, used to indicate the degree of association between POI type and music tag)
[0109] Example data:
[0110]
[0111] After the POI type of the navigation destination is determined, the database is traversed to find music tags matching the POI type, thereby determining the type of music to be played.
[0112] For example, the POI type of the destination is "cafe". Traverse the POI_Music_Association table and find all records with poi_type "cafe". Then, get the music_label field values in these records, namely "Jazz", "Light Music" and "Relaxation", as the music types that match the POI type of "cafe". According to these music types, select the corresponding music from the music library to play, providing users with a personalized music experience that matches the POI type.
[0113] S103, based on the music type that matches the POI type, obtaining music that matches the music type, and generating an initial music list that matches the music type according to a defined screening rule;
[0114] It can be understood that in this step, the corresponding music type is first determined according to the POI type. For example, if the POI type is a cafe, then the corresponding music type is relaxing, jazz or folk, etc. When the music type is determined, music matching these music types is retrieved from the music library. The music library can be a database containing a large number of music files, each of which has a music tag associated with it to represent its music type, style, artist and other information. Music is retrieved from the music library through a query statement or API interface. The query statement or API interface will include the music type as a parameter to return a list of music matching the music type. For example, if the music type is "jazz", all music files tagged with "jazz" will be retrieved from the music library. After obtaining a list of music matching the music type, the list is further processed according to the filtering rules. The filtering rules are defined according to actual needs, for example:
[0115] Duration filter: Only select music within a certain duration range, such as 3-5 minutes.
[0116] Quality filtering: Filter based on the quality rating of the music, and only select music with a rating above a certain threshold.
[0117] Artist Filters: Select only music from specific artists, or exclude music from certain artists.
[0118] Style screening: Under the determined music type, further refine the style screening, such as selecting only relaxing jazz.
[0119] Finally, the obtained music list is filtered according to the defined filtering rules to generate an initial music list that matches the POI type. The list contains music files that meet all the filtering conditions and are arranged in a certain order (such as from high to low according to quality score).
[0120] For example, suppose the POI type is a cafe, and it is determined that the music type that matches it is "relaxing jazz". Then all music files tagged with "relaxing jazz" are retrieved from the music library, and a list of 100 pieces of music is obtained. The list is filtered according to the defined filtering rules. The filtering rules include: only select music with a duration between 3-5 minutes. Only select music with a quality score higher than 4.5 (out of 5 points). After filtering, an initial music list of 20 pieces of music is finally generated, which not only meets the music type of "relaxing jazz" but also meets the requirements of duration and quality.
[0121] In some of the applications, based on the music type that matches the POI type, music that matches the music type is obtained, and based on the defined filtering rules, an initial music list that matches the music type is generated; based on the music type, music that matches the music type is obtained from a music database, and the music database includes a local music library and an online music service; based on the filtering rules, the music is filtered and sorted to generate an initial music list, and the filtering rules include user preferences, music ratings, and music duration; the number of music in the initial music list is set, and the total music duration of the initial music list is obtained.
[0122] It is understandable that in this application, firstly, according to the determined music type (such as pop, classical, jazz, etc.), music matching the type is retrieved in the music database. The music database includes a local music library and an online music service. The local music library is a collection of music files stored on the user's device, while the online music service provides a wide range of online music resources.
[0123] For example, if the music genre is "popular", the local music library will be searched for music files tagged as "popular" first. If the local music library does not have enough music or the user wants more choices, the online music service will be connected to retrieve and obtain more music of the "popular" genre.
[0124] After obtaining music that matches the music type, the music is filtered and sorted according to the filtering rules. The filtering rules include user preferences, music ratings, and music duration.
[0125] User Preferences: Determine the user's preference for music based on their historical play history, favorites list, or explicit preferences. This may include specific artists, albums, or song styles.
[0126] Music Ratings: Get music rating information from music databases or third-party sources.
[0127] Music duration: Consider the user's playback time and scenario, and filter the music duration.
[0128] For example, suppose the user prefers pop music by a specific artist A, and prefers music with a score higher than 4.5 (out of 5). At the same time, considering that the user uses the music service while driving, music with a duration between 3 and 5 minutes will be preferred. Based on these filtering rules, the acquired music is sorted to ensure that the music that meets the user's preferences is ranked first.
[0129] After screening and sorting, the final initial music list is generated according to the set music quantity limit in the initial music list. At the same time, the total music duration in the initial music list is calculated. For example, the set initial music list has 10 songs. After screening and sorting, the first 10 songs that meet the conditions are selected to generate the initial music list. Then the total duration of these 10 songs is calculated, and the total music duration is 45 minutes.
[0130] S104, in response to the acquired path information, dynamically calculate the remaining time required to reach the destination information, calculate the optimal music list that can be played within the remaining time based on the initial music list according to a dynamic programming algorithm, and play the music according to the order of the optimal music list.
[0131] It is understandable that in this step, after the user enters the destination information, the navigation service is called to obtain the path information to the destination. The path information includes the estimated driving distance, the estimated driving time, the road condition information, etc. The remaining time is calculated based on the current time and the estimated arrival time. For example, if the current time is 10:00 and the estimated arrival time is 11:30, the remaining time is 1 hour and 30 minutes. The initial music list is screened. Consider the duration of each piece of music. Assume that there are 10 pieces of music in the initial music list, and the duration of each piece of music is [3 minutes, 4 minutes, 5 minutes 4 minutes, 3 minutes, 6 minutes, 5 minutes, 4 minutes, 3 minutes, 4 minutes], and the remaining time is 1 hour and 30 minutes (i.e. 90 minutes). Remove the music whose total duration exceeds the remaining time, or select some music according to the dynamic programming algorithm to maximize the diversity or quality of music playback. In order to select the optimal music list within the given remaining time, the dynamic programming algorithm is used to calculate the optimal music list, and then the music is played in the order in the list. During playback, if the remaining time changes (such as changes in traffic conditions causing the estimated arrival time to change), the remaining time will be recalculated and the music list will be updated.
[0132] In some of the applications, in response to the acquired path information, the remaining time required to reach the destination information is dynamically calculated, based on the initial music list, the optimal music list that can be played within the remaining time is calculated according to the dynamic programming algorithm, and the music is played according to the order of the optimal music list. Based on the path information, the remaining time required to reach the destination information is dynamically calculated and the remaining time is updated in real time; the initial music list is traversed to obtain the music duration of each music; a dynamic programming table is constructed, and based on the dynamic programming algorithm, the optimal music list that can be played within the remaining time is calculated. The dynamic programming algorithm obtains the optimal solution by filling in the dynamic programming table based on the relationship between the music duration of each music and the remaining time; based on the result of the dynamic programming table, the optimal music list is selected, and the music is played according to the order of the optimal music list.
[0133] It can be understood that in this application, the remaining time required to reach the destination is first dynamically calculated and updated in real time based on the path information, and then the initial music list is traversed to obtain the music duration of each piece of music. By constructing a dynamic programming table and using a dynamic programming algorithm to calculate the optimal music list that can be played within the remaining time. Finally, based on the results of the dynamic programming table, the optimal music list is selected and the music is played in its order.
[0134] Construct a dynamic programming table, where the rows represent the numbers of the songs in the music list and the columns represent the remaining time. Each element dp[i][j] in the table represents the maximum score that can be achieved when selecting music with a total duration of no more than j minutes from the first i songs. Get the optimal solution by filling in this table. Specifically, for each piece of music, calculate whether adding it to the current optimal solution will make the total score higher, and update the corresponding elements in the table. Finally, the last element dp[n][T] in the table (where n is the length of the music list and T is the remaining time) will represent the maximum score that can be obtained in the remaining time and the corresponding music list.
[0135] For example, suppose the rating is proportional to the duration of the music:
[0136]
[0137]
[0138] As shown in the table above, the value of each element is calculated based on the value of the previous row and column. For example, dp[2][7] represents the maximum score that can be achieved when selecting music with a total duration of no more than 7 minutes from the first two pieces of music. Its value is equal to max(dp[1][7], dp[1][3] + score[2]), where score[2] is the score of the second piece of music.
[0139] According to the results of the dynamic programming table, the optimal music list is selected. Specifically, backtracking is started from the last element of the table, and the value of each element is used to determine whether to select the music, thereby constructing the optimal music list. Finally, the music is played in the order of the optimal music list. During the playback process, if the remaining time changes (such as the estimated arrival time changes due to changes in road conditions), the remaining time is recalculated and the optimal music list is updated.
[0140] For example, if the remaining time is reduced from 90 minutes to 70 minutes due to changes in road conditions during driving, the dynamic planning table is rebuilt and the optimal music list that can be played within the new remaining time is calculated. Then the current playback order is updated according to the new optimal music list to ensure that the music playback is optimally matched with the remaining time.
[0141] For example, assuming that the current remaining time is 90 minutes, the music duration and ratings in the initial music list are as follows:
[0142]
[0143]
[0144] After constructing the dynamic programming table, it is calculated that the maximum score that can be obtained within the remaining 90 minutes is 22, and the corresponding music list is [2,5,9], that is, the 2nd, 5th and 9th music are selected for playing.
[0145] However, during driving, if the remaining time is reduced to 60 minutes for some reason, the optimal music list is recalculated. In the new remaining time, the optimal music list may change, for example, it may be [1,4,5], which means that the 1st, 4th and 5th music are selected for playback in the new remaining time.
[0146] In some of the applications, a dynamic programming table is constructed. Based on the dynamic programming algorithm, the optimal music list that can be played in the remaining time is calculated, and a two-dimensional array dp is initialized, where the number of rows is the number of songs in the initial music list plus 1, the number of columns is the possible value of the remaining time plus 1, and all elements are initialized to 0; the dynamic programming algorithm includes:
[0147] dp[i][j]=max(dp[i-1][j],dp[i-1][j-musicDuration[i-1]]+mu sicDuration[i-1]);
[0148] Where i represents the number of songs, j represents the remaining time, and musicDuration represents the duration of the song, which is used to calculate the longest playback duration of i under the remaining time j. A double loop is used to traverse all the music and the remaining time, and the dp array is filled based on the dynamic programming algorithm. When the filling is completed, reverse deduction is performed starting from the last element of the dp array to find the optimal music playback combination and generate the optimal music list.
[0149] It is understandable that in this application, a two-dimensional array dp is first initialized, then the array is filled using a dynamic programming algorithm, and finally the optimal music playback combination is found through reverse deduction. Assuming that the initial music list contains n songs, the possible values of the remaining time are from 0 to T minutes (including 0 and T), first initialize a (n+1)x(T+1) two-dimensional array dp, and initialize all elements to 0. Among them, dp[i][j] represents the maximum score that can be achieved when selecting music with a total duration of no more than j minutes from the first i songs.
[0150] Suppose there is an array musicDuration, which is used to store the duration of each song (in minutes), and an array musicScore, which is used to store the score of each song.
[0151] Use a double loop to iterate over all songs and the remaining time, and fill the dp array based on a dynamic programming algorithm. For each dp[i][j], there are two options:
[0152] Do not select the i-th song: At this time, the value of dp[i][j] is the same as dp[i-1][j], which indicates the maximum score that can be achieved when selecting music with a total duration of no more than j minutes from the first i-1 songs.
[0153] Select the i-th song: At this time, determine whether the duration of the i-th song, musicDuration[i-1], is less than or equal to the remaining time j. If so, the value of dp[i][j] is dp[i-1][j-musicDuration[i-1]]+musicScore[i-1], which means that music with a total duration of no more than j-musicDuration[i-1] minutes is selected from the first i-1 songs, and the maximum score that can be achieved by the score of the i-th song is added.
[0154] When the dp array is filled, start from the last element of the dp array and reversely deduce to find the optimal music playback combination. Specifically, start from dp[n][T] and compare the values of dp[n][T] and dp[n-1][T]. If dp[n][T] is greater than dp[n-1][T], it means that the optimal solution contains the nth song. Add the nth song to the optimal music list and continue to deduce forward; otherwise, the optimal solution does not contain the nth song, and deduce forward directly. Through continuous comparison and deduction, the optimal music playback combination can be obtained in the end.
[0155] For example, the initial music list contains 3 songs with durations of [3, 4, 5] minutes and a remaining time of 10 minutes. The score of each song is simply set to be the same as its duration (taking duration as the optimization target).
[0156] First, initialize a 4x11 two-dimensional array dp and initialize all elements to 0. Then fill the dp array according to the song duration and rating:
[0157]
[0158]
[0159] Next, start from dp[3]
[10] and work backwards. Because dp[3]
[10] (12) is greater than dp[2]
[10] (7), the optimal solution includes the third song (5 minutes in length). Continue working forward and compare dp[2][5](7) with dp[1][5](3). Because dp[2][5](7) is greater, the optimal solution also includes the second song (4 minutes in length). Finally, compare dp[1][1](0) with dp[0][1](0). Because they are equal and the remaining time is 0, no other songs are included.
[0160] Therefore, the optimal music playback combination is [2,3], that is, the second and third songs are selected for playback, with a total duration of 9 minutes (less than or equal to the remaining time of 10 minutes).
[0161] Combine the following Figures 2 to 4 The following describes some examples of the POI-based in-vehicle music recommendation method of the present invention in some applications:
[0162] like Figure 2 As shown,
[0163] 1. Get the POI type of the navigation destination: Use the in-vehicle navigation system or map API related services to obtain the POI (Point of Interest) type information of the navigation destination. This can be different types of location information such as restaurants, parks, shopping malls, etc.
[0164] 2. Matching music types: Define the matching rules between POI types and music tags, and build a database or data set that contains the association information of different POI types and music tags. Match the acquired POI types with pre-defined music tag types. For example, match restaurants with soothing music, parks with light music, shopping malls with popular music, etc. You can use keyword matching, semantic analysis, or other related algorithms.
[0165] 3. Generate an initial selected music list: According to the matched music tags, obtain the corresponding music list from the music library or online music service. This music list is the initialization music list, and the number of songs in the music list is counted as N.
[0166] 4. Based on the navigation itinerary, dynamically calculate the remaining time required to reach the destination, which is recorded as remainingTime.
[0167] 5. Dynamically calculate the playing time of songs in the list: For the songs in the list, get the number of songs to be played, and for each song, get its estimated playing time.
[0168] 6. Dynamically plan the music list to be played. The specific steps are:
[0169] (1) Create a dynamic programming table: Create a two-dimensional array dp[i][j] to store the intermediate results of the dynamic programming process. The number of rows in this two-dimensional array is N+1, which represents the number of songs in the music list (including the case where no music is selected), and the number of columns is remainingTime+1, which represents the remaining time (between 0 and remainingTime). dp[i][j] represents the longest playback time of the first i songs when the remaining navigation time is j, where i represents the currently selected song (0≤i≤N+1) and j represents the remaining time from the current time to the destination when arriving at the navigation destination (0≤j≤remainingTime+1). Initialize the array dp to 0.
[0170] (2) Use the state transition equation: Define the state transition equation dp[i][j], which is the longest play time that can be achieved when the first i songs are considered and the remaining navigation time is j. The state transition equation is:
[0171] dp[i][j]=max(dp[i-1][j],dp[i-1][j-musicDuration[i-1]]+mu sicDuration[i-1]);
[0172] Here, max means taking the larger value of the two calculated results, and musicDuration[i] represents the duration of the i-th music.
[0173] Then, starting from dp[0][0], use the state transition equation to fill in the table in sequence.
[0174] The calculation process for filling the table is as follows Figure 3 As shown:
[0175] (i) Double loop traversal: Use two nested loops, the outer loop traverses each song in the music list, and the inner loop traverses the remaining time from 1 to remainingTime+1.
[0176] (ii) Determine whether the current song can be included: For the current song i-1, check whether its playing duration musicDuration[i-1] is less than or equal to the current remaining time j, and update the value of the current cell in the dynamic planning table.
[0177] (a) If the judgment is true, it means that this song can be played in the remaining time. Calculate dp[i][j] according to the transfer state equation. In this case, it is necessary to consider the remaining time j and the current music playing time musicDuration[i-1]. Therefore, it is necessary to subtract the current music playing time musicDuration[i-1] from the remaining time j, and select the longest playing time of the first i-1 songs when the remaining time is j-musicDuration[i-1], and then add the current music playing time musicDuration[i-1]. Combining these two options, the value of dp[i][j] takes the larger value of the two, so the max function is used for comparison.
[0178] (b) If the judgment is false, it means that this song cannot be played in the remaining time. In this case, dp[i][j] is equal to the value of the same column in the previous row, that is, dp[i-1][j], which means that the current music is not selected and the original maximum playing time is maintained.
[0179] (iv) Filled: When the double loop ends, each cell in the table dp has been filled, containing the maximum playing time based on the current remaining time and the selected music.
[0180] (3) Derivation of the optimal solution: Calculate dp[N][remaining time when reaching the destination] according to the state transition equation, where N is the number of songs. By traversing the dp table filled in the previous step from the last element forward, the optimal solution can be deduced in reverse, that is, which songs to select to put into the playlist.
[0181] The reverse derivation process is as follows Figure 4 As shown:
[0182] (i) Initialize the traversal index: Set the variable i to the number of rows in the dynamic programming table dp minus one, that is, N, which represents the number of songs in the music list; set the variable j to the number of columns in the dynamic programming table dp minus one, that is, the remaining time remainingTime.
[0183] (ii) Traversal backtracking: Enter the loop, as long as i>0 and j>0, there are still elements to backtrack. In each loop:
[0184] (a) Check whether the current cell dp[i][j] is different from the value dp[i-1][j] of the same column in the previous row. If they are different, it means that the current song (i.e. musicDuration[i-1]) is selected and added to the selected music list.
[0185] (b) Subtract the current music playing duration musicDuration[i-1] from the remaining time j to continue backtracking the value of the next cell.
[0186] (c) Decrement the row index i by 1, that is, trace back to the previous row.
[0187] (iii) Return result: When the loop ends, the selected music list is returned, which contains the best music list selected according to the dynamic programming algorithm.
[0188] (4) Ensure that the final remaining time is less than 1 minute: After obtaining the optimal solution, check whether the final remaining time is less than 1 minute. If the remaining time is less than 1 minute, the playlist is the optimal playlist; if the remaining time exceeds 1 minute, select the music to be played in the music list, adjust the length of the last music, and adopt the method of playing only the chorus part so that the final remaining time meets the requirements.
[0189] 7. Play music: Finally, based on the calculated optimal music combination, the music is played in sequence at the end of navigation.
[0190] This embodiment is described below in conjunction with application scenarios:
[0191] 1. Get the POI type of the navigation destination: Use the in-vehicle navigation system or map API related services to get the POI of the navigation destination, such as a park.
[0192] 2. Matching music type: Matching is done based on the matching rules of the existing POI type and music tags. For example, the park is matched with light music.
[0193] 3. Generate an initial selected music list: According to the matched light music tags, obtain the corresponding music list from the music library or online music service. This music list is the initialization music list.
[0194] 4. Dynamically calculate the remaining time to reach the destination based on the navigation itinerary. For ease of calculation and understanding, the remaining time from the end of the navigation is taken as remainingTime = 636 seconds.
[0195] 5. Dynamically calculate the playing time of the music in the list: For the songs in the music list, obtain the number of songs to be played N=6, and for each song, obtain its estimated playing time. The list of music to be played is as follows:
[0196]
[0197]
[0198] 6. Dynamically plan the music list to be played. The specific steps are as follows:
[0199] (1) Create a two-dimensional array dp[i][j], where i represents the currently selected song (0≤i≤7), and j represents the remaining time from the current time to the destination when the navigation destination is reached (0≤j≤637). dp[i][j] represents the longest playing time of the first i songs when the remaining navigation time is j. Initialize dp to 0.
[0200] (2) Fill in the table and calculate according to the state transfer equation:
[0201] The state transfer equation is:
[0202] dp[i][j]=max(dp[i-1][j],dp[i-1][j-musicDuration[i-1]]+mu sicDuration[i-1]);
[0203] Here, max means taking the larger value of the two calculated results, and musicDuration[i] represents the duration of the i-th music.
[0204] Fill in the form and calculate:
[0205] When i=1 and j=1, it can be seen from the initialized dp table that dp[0][1]=0, musicDuration[0]=210>j, which means that this song cannot be played in the remaining time, so dp[1][1]=dp[0][1]=0.
[0206] Based on this calculation, when i=1 and j=210, musicDuration[0]=210=j, which means that this song can be played in the remaining time.
[0207] dp[1]
[210] =max(dp[0][0],dp[0][210-musicDuration[0]]
[0208] +musicDuration[0])
[0209] =max(0,dp[0][0]+210)=210.
[0210] By analogy, a complete dynamic programming table can be obtained.
[0211] (4) Reverse derivation of the optimal solution:
[0212] Initialize i=6, j=636. From the dynamic programming table calculated in the previous step, we know that at this time dp[6]
[636] =dp[5]
[636] =630, which does not meet the conditions for adding to the waiting list. Then i=i-1=5 and continue calculating.
[0213] When i=3, j=636, dp[3]
[636] =630≠dp[4]
[636] =462, which meets the conditions for adding to the waiting list, that is, MusicC is added to the waiting list. At this time, j=636-168=468 is updated, and the case of i=i-1=2, j=468 is continued to be calculated.
[0214] When i=2, j=468, dp[2]
[468] =462≠dp[1]
[468] =210, which meets the conditions for adding to the waiting list, that is, MusicB is added to the waiting list. At this time, j=468-252=216 is updated, and the case of i=i-1=1, j=216 is continued to be calculated.
[0215] When i=1, j=216, dp[1]
[216] =210≠dp[0]
[216] =0, which meets the condition of adding to the waiting list, that is, MusicA is added to the waiting list. At this time, j=216-210=6 is updated, and the case of i=i-1=0, j=6 is continued to be calculated.
[0216] When i=0, the cycle is not satisfied and the reverse deduction ends.
[0217] The best song combination is MusicC, MusicB, and MusicA.
[0218] (5) Ensure that the remaining time is less than 1 minute:
[0219] Check whether the final remaining time is less than 1 minute. If not, you need to adjust the length of the last music so that the final remaining time meets the requirements.
[0220] Here are the best song combinations:
[0221] MusicC:168seconds;
[0222] MusicB:252seconds;
[0223] MusicA: 210 seconds;
[0224] In this way, at the end of navigation, the total duration of the playlist is 168+252+210=630<636, and the remaining time is less than 1 minute, which meets the requirement.
[0225] In this scenario, the dynamic programming algorithm can help find the optimal song combination to ensure that the music can be finished when the navigation ends and the remaining time is less than 1 minute.
[0226] The above embodiment matches music tags according to navigation POI types and constructs a music recommendation list based on them. Taking into account the remaining navigation time and the total time of the music to be played, the list to be played is adjusted dynamically so that the music is finished within a certain threshold when the journey ends.
[0227] For the method steps disclosed in the above embodiments, the method steps are described as a series of action combinations for the purpose of simple description, but those skilled in the art should know that the embodiments of the present invention are not limited by the order of the actions described, because according to the embodiments of the present invention, some steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required by the embodiments of the present invention.
[0228] like Figure 5 As shown, the present invention also provides a POI-based in-vehicle music recommendation system, comprising:
[0229] A POI type parsing module 201 is configured to parse the POI type of the destination information in response to the acquired destination information;
[0230] A music type matching module 202 is configured to determine a music type that matches the POI type based on a defined matching rule between the POI type and the music tag;
[0231] The music list screening module 203 is configured to obtain music matching the music type based on the music type matching the POI type, and generate an initial music list matching the music type according to a defined screening rule;
[0232] The dynamic planning playback module 204 is configured to dynamically calculate the remaining time required to reach the destination information in response to the acquired path information, calculate the optimal music list that can be played within the remaining time based on the initial music list according to the dynamic planning algorithm, and play the music according to the order of the optimal music list.
[0233] It is worth noting that although only some basic functional modules are disclosed in the embodiments of the present invention, it does not mean that the composition of the present system is limited to the above basic functional modules. On the contrary, what the present embodiment wants to express is that on the basis of the above basic functional modules, those skilled in the art can arbitrarily add one or more functional modules in combination with the prior art to form an infinite number of embodiments or technical solutions. In other words, the present system is open rather than closed. Just because the present embodiment only discloses individual basic functional modules, it cannot be considered that the protection scope of the claims of the present invention is limited to the disclosed basic functional modules. At the same time, for the convenience of description, the above devices are described in terms of functions and are described separately in various units and modules. Of course, when implementing the present invention, the functions of each unit and module can be implemented in the same or one or more software and / or hardware.
[0234] like Figure 6 As shown, the present invention also provides an electronic device, including: a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus; a computer program is stored in the memory, and when the computer program is executed by the processor, the processor executes the steps of the POI-based in-vehicle music recommendation method.
[0235] Figure 6 Schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. Figure 6 The electronic device provided in the embodiment of the present invention includes: one or more processors 710 and a storage device 720; the processor 710 in the electronic device may be one or more, Figure 6 A processor 710 is taken as an example; the storage device 720 is used to store one or more programs; the one or more programs are executed by the one or more processors 710, so that the one or more processors 710 implement the POI-based in-vehicle music recommendation method as described in any one of the embodiments of the present invention.
[0236] The electronic device may further include: an input device 730 and an output device 740 .
[0237] The processor 710, storage device 720, input device 730 and output device 740 in the electronic device can be connected via a bus or other means. Figure 6 The example of connecting through bus is taken in the following.
[0238] The storage device 720 in the electronic device is a computer-readable storage medium that can be used to store one or more programs, which can be software programs, computer executable programs, and modules, such as program instructions / modules corresponding to the POI-based in-vehicle music recommendation method provided in the embodiment of the present invention. The processor 710 executes various functional applications and data processing of the electronic device by running the software programs, instructions, and modules stored in the storage device 720, that is, implementing the POI-based in-vehicle music recommendation method in the above method embodiment.
[0239] The storage device 720 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created according to the use of the electronic device, etc. In addition, the storage device 720 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device. In some instances, the storage device 720 may further include a memory remotely arranged relative to the processor 710, and these remote memories may be connected to the device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0240] The input device 730 may be used to receive input digital or character information and generate key signal input related to user settings and function control of the electronic device. The output device 740 may include a display device such as a display screen.
[0241] The present invention also provides a computer-readable storage medium storing a computer program executable by an electronic device. When the computer program runs on the electronic device, the electronic device executes the steps of the POI-based in-vehicle music recommendation method.
[0242] Specifically, the computer storage medium of the embodiment of the present invention can adopt any combination of one or more computer-readable media. The computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium. The computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples (non-exhaustive list) of computer-readable storage media include: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present embodiment, the computer-readable storage medium can be any tangible medium containing or storing a program, which can be used by an instruction execution system, device or device or used in combination with it.
[0243] The present invention also provides a vehicle, wherein the vehicle is provided with the POI-based in-vehicle music recommendation system as described above.
[0244] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. A POI-based in-vehicle music recommendation method, characterized in that: include: In response to the acquired destination information, parsing the POI type of the destination information; Determining a music type that matches the POI type based on a defined matching rule between the POI type and the music tag; Based on the music type that matches the POI type, music that matches the music type is acquired, and an initial music list that matches the music type is generated according to a defined screening rule; In response to the acquired path information, the remaining time required to reach the destination information is dynamically calculated, based on the initial music list, the optimal music list that can be played within the remaining time is calculated according to a dynamic programming algorithm, and music is played according to the order of the optimal music list.
2. The POI-based in-vehicle music recommendation method according to claim 1, characterized in that: In response to the acquired destination information, parsing the POI type of the destination information specifically includes: In response to the navigation start signal, calling the map API service; Responding to a control command input by a user or according to a driving trajectory of the vehicle, obtaining navigation destination information; The POI type is parsed based on the navigation destination information, wherein the POI type includes different scene types.
3. The POI-based in-vehicle music recommendation method according to claim 1, characterized in that: Determining the music type matching the POI type based on the defined matching rule between the POI type and the music tag specifically includes: Defining a matching rule between the POI type and the music tag, wherein the matching rule includes clarifying the music type or music style associated with each POI type; Constructing a database containing association information between the POI type and the music tag; The database is traversed to obtain music types that match the POI type.
4. The POI-based in-vehicle music recommendation method according to claim 1, characterized in that: Based on the music type that matches the POI type, music that matches the music type is acquired, and according to a defined screening rule, an initial music list that matches the music type is generated, specifically including: Based on the music type, obtaining music matching the music type in a music database, wherein the music database includes a local music library and an online music service; Based on the screening rules, the music is screened and sorted to generate an initial music list, wherein the screening rules include user preferences, music ratings, and music duration; The number of songs in the initial music list is set, and the total music duration of the initial music list is obtained.
5. The POI-based in-vehicle music recommendation method according to claim 1, characterized in that: In response to the acquired path information, dynamically calculating the remaining time required to reach the destination information, calculating the optimal music list that can be played within the remaining time according to the dynamic programming algorithm based on the initial music list, and playing music according to the order of the optimal music list, specifically including: Based on the path information, dynamically calculate the remaining time required to reach the destination information and update the remaining time in real time; Traverse the initial music list to obtain the music duration of each piece of music; Constructing a dynamic programming table, and calculating the optimal music list that can be played within the remaining time based on the dynamic programming algorithm, wherein the dynamic programming algorithm obtains the optimal solution by filling in the dynamic programming table according to the relationship between the music duration of each piece of music and the remaining time; Based on the result of the dynamic planning table, the optimal music list is selected, and the music is played in the order of the optimal music list.
6. The POI-based in-vehicle music recommendation method according to claim 5, characterized in that: Constructing a dynamic programming table, and calculating the optimal music list that can be played within the remaining time based on the dynamic programming algorithm, specifically includes: Initialize a two-dimensional array dp, where the number of rows is the number of songs in the initial music list plus 1, the number of columns is the possible value of the remaining time plus 1, and all elements are initialized to 0; The dynamic programming algorithm includes: dp[i][j]=max(dp[i-1][j],dp[i-1][j-musicDuration[i-1]]+mu sicDuration[i-1]); Wherein, i represents the number of songs, j represents the remaining time, and musicDuration represents the duration of the song, which is used to calculate the longest playing duration of i under the remaining time j; Use a double loop to traverse all the music and the remaining time, and fill the dp array based on the dynamic programming algorithm; When filling is completed, the optimal music playing combination is found through reverse deduction starting from the last element of the dp array to generate the optimal music list.
7. A POI-based in-vehicle music recommendation system, characterized in that: include: a POI type parsing module, configured to parse the POI type of the destination information in response to the acquired destination information; A music type matching module, configured to determine a music type matching the POI type based on a defined matching rule between the POI type and the music tag; A music list screening module, configured to obtain music matching the music type based on the music type matching the POI type, and generate an initial music list matching the music type according to a defined screening rule; The dynamic planning playback module is configured to dynamically calculate the remaining time required to reach the destination information in response to the acquired path information, calculate the optimal music list that can be played within the remaining time based on the initial music list according to the dynamic planning algorithm, and play music according to the order of the optimal music list.
8. An electronic device, characterized in that: include: A processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus; a computer program is stored in the memory, and when the computer program is executed by the processor, the processor executes the steps of the method described in any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that: It stores a computer program executable by an electronic device, and when the computer program runs on the electronic device, the electronic device executes the steps of the method described in any one of claims 1 to 6.
10. A vehicle, characterized in that: The vehicle is provided with the POI-based in-vehicle music recommendation system as claimed in claim 7.
Citation Information
Patent Citations
Music playing method and vehicle-mounted music playing system
CN104797001A
Method, device and system for adjusting driving modes and vehicle
CN106683673A
Music recommendation system based on real-time road conditions
CN112417204A
Music recommendation method and system based on vehicle navigation, electronic equipment and medium
CN115905611A
Interaction method and device, vehicle-machine interaction system and vehicle
CN116424362A
Cited By
Recommendation system
US20240370489A1
