A method and system for visual workflow mapping and asynchronous scheduling in clothing
By separating the workflow description file and configuration file, performing parameter validation before submission, and using asynchronous queues and event buses to handle task status, the problems of coupling and low resource utilization in image generation tasks are solved, and stable execution of visual generation tasks is achieved.
Patent Information
- Application Number
- CN202611400568.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-09-10
- Publication Date
- 2026-11-17
AI Technical Summary
In existing technologies, the workflow nodes and task interfaces of image generation tasks are highly coupled, resulting in high costs of repeated development and maintenance when adding new visual generation capabilities, low resource utilization in high-concurrency environments, and unstable task status recording and result writing.
By separating the computation graph from the input/output interface through workflow description files and configuration files, performing parameter validation before submission, employing asynchronous queues and multi-instance scheduling, and combining event bus to handle task status, the workflow is decoupled and executed stably.
It reduces the coupling between task submission logic and specific visual generation workflow, reduces the resource consumption of invalid tasks, and improves the scalability and asynchronous execution stability of visual generation tasks for various types of clothing.
Smart Images

Figure CN123114683A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of artificial intelligence image generation, visual workflow orchestration, and computational task scheduling, and in particular to a method and system for visual workflow mapping and asynchronous scheduling of clothing. Background Technology
[0002] With the development of AI image generation technology, tasks such as virtual try-on, product display image generation, clothing image editing, and marketing material generation are increasingly being accomplished by image generation models, image editing models, and multimodal image understanding models. Different tasks have different input formats, node structures, and output locations, and upper-level systems typically need to write parameter injection and result parsing logic separately for each workflow.
[0003] Graphical vision workflows typically consist of nodes such as model loading, image input, text encoding, image generation, post-processing, and result output. When workflow node numbers, input fields, and output positions change, the upper-level calling code also needs to be adjusted synchronously, resulting in a high degree of coupling between the task interface and the specific workflow. Adding new vision generation capabilities leads to high costs of repeated development and maintenance.
[0004] Image generation tasks are characterized by long computation time and high resource consumption. If, after entering an image generation instance, the task discovers that the input is missing, the type is incorrect, the image format is not up to standard, or the parameters are out of range, invalid tasks will occupy graphics processor resources and prolong the waiting time of valid tasks.
[0005] Existing asynchronous task scheduling mechanisms may lack unified priority handling, concurrency control, instance load balancing, and health checks. In high-concurrency environments, a large number of node progress events may also crowd out the storage space for critical events such as task completion, failure, or cancellation, affecting task status recording and result writing.
[0006] Therefore, there is a need for a visual workflow mapping and asynchronous scheduling scheme for apparel that can separate the computation graph of the visual generation workflow from the input and output interfaces and complete unified execution through configuration mapping, pre-submission verification, asynchronous queues, multi-instance scheduling and event postback. Summary of the Invention
[0007] The purpose of this invention is to overcome the shortcomings of the above-mentioned background technology and provide a method and system for mapping and asynchronous scheduling of clothing visual workflows, which reduces the coupling between task submission logic and specific visual generation workflows, reduces the consumption of computing resources by invalid tasks, and improves the scalability and asynchronous execution stability of various types of clothing visual generation tasks.
[0008] This invention provides a method for mapping and asynchronous scheduling of visual workflows for clothing. The method involves acquiring a task request that includes a workflow identifier, original input parameters, an image key name list, task priority, and result write-back information; reading independent workflow description files and workflow configuration files based on the workflow identifier; performing pre-submission parameter validation according to the input validation rules in the workflow configuration file; processing image parameters according to the image key name list; and writing the original input parameters to the corresponding computing nodes according to the input mapping relationship, thus forming an executable visual generation workflow.
[0009] This invention encapsulates the executable visual generation workflow into generation tasks and writes them into a priority queue; it limits concurrency through global concurrency control and single-instance concurrency control; it excludes instances from the image generation instance connection pool that are unavailable, have health issues, or have reached their concurrency limit, and selects available instances using polling, least-task-count, or weighted methods. During task execution, status and node progress are published via an event bus; after task completion, the generated results are extracted according to the output mapping relationship and stored, associated with business logic, and returned.
[0010] For virtual try-on tasks, this invention utilizes a multimodal image understanding model to jointly analyze images of people and clothing, generating image editing control instructions that include the range of clothing replacement, clothing details, preservation of the person's identity, and image quality requirements. When the multimodal image understanding model malfunctions, a preset template corresponding to the try-on type is invoked. This step is an optional enhancement for virtual try-on tasks and does not constitute a necessary step in text-to-image generation tasks.
[0011] This invention also provides a corresponding visual workflow mapping and asynchronous scheduling system for clothing and a computer-readable storage medium. The visual workflow mapping and asynchronous scheduling system for clothing includes modules for task acquisition, image analysis and instruction generation, workflow configuration management, parameter verification and image processing, parameter injection, asynchronous task management, instance scheduling, event processing, and result extraction and write-back.
[0012] The present invention provides a method and system for visual workflow mapping and asynchronous scheduling in apparel, which has the following beneficial effects: First, the workflow description file records the computation nodes and node connection relationships, and the workflow configuration file records the input / output interfaces and verification rules, thus separating the workflow computation graph from the unified task submission logic.
[0013] Second, parameter injection is completed through node identifiers and node input field identifiers, and results are extracted through output node identifiers and node output position identifiers, enabling virtual try-on, image editing, and text-to-image generation tasks to reuse the same execution framework.
[0014] Third, performing input validation before generating tasks enter the asynchronous queue and occupy image generation instances can reduce the consumption of graphics processor resources by invalid tasks.
[0015] Fourth, by using priority queues, two-level concurrency control, multi-instance load balancing, and periodic health checks, we can improve resource utilization and task execution stability in high-concurrency environments.
[0016] Fifth, by using an event bus to distinguish between critical and non-critical events, and by uniformly completing the storage of generated results and business write-back, the reliability of task status transmission and result processing is improved. Attached Figure Description
[0017] Figure 1 This is a schematic diagram of the overall process of the clothing visual workflow mapping and asynchronous scheduling method in Embodiment 1 of the present invention; Figure 2 This is a schematic diagram of the two-layer workflow configuration and node input / output mapping in Embodiment 2 of the present invention; Figure 3 This is a schematic diagram of the asynchronous task queue and image generation instance scheduling process in Embodiment 2 of the present invention; Figure 4 This is a schematic diagram of the process for generating task state transitions and event handling in Embodiment 2 of the present invention; Figure 5 This is a schematic diagram of the collaborative operation of each module of the clothing visual workflow mapping and asynchronous scheduling system in Embodiment 5 of the present invention. Detailed Implementation
[0018] The present invention will now be described in further detail with reference to the accompanying drawings and embodiments, but these embodiments should not be construed as limiting the present invention.
[0019] Example 1 like Figure 1 As shown, this embodiment provides a method for mapping and asynchronous scheduling of visual workflows for clothing, the method including steps S101 to S110.
[0020] Step S101: Obtain a task request. The task request includes a workflow identifier, original input parameters, a list of image key names, task priority, and result write-back information. The task request can be initiated by the user client, merchant client, intelligent agent tool, or other business services.
[0021] Step S102: Read the workflow description file and workflow configuration file based on the workflow identifier. The workflow description file records the computation nodes, node connection relationships, and execution order; the workflow configuration file declares the input parameters, output parameters, input mapping relationships, output mapping relationships, and input validation rules.
[0022] Step S103: Perform pre-submission parameter validation on the original input parameters according to the input validation rules. If the validation fails, return a failure message and terminate the task submission; if the validation passes, proceed to step S104.
[0023] Step S104: Identify image parameters based on the image key name list, download the image corresponding to the image Uniform Resource Locator to the workflow execution environment, or convert it into an image reference accessible by the image generation instance. For text-to-image tasks, the image key name list can be empty.
[0024] Step S105: Based on the input mapping relationship, write the parameter values in the original input parameters into the node input field of the corresponding calculation node in the workflow description file to form an executable vision generation workflow.
[0025] Step S106: Encapsulate the executable vision generation workflow into generation tasks, assign task identifiers to the generation tasks, and write them into the asynchronous task queue according to task priority.
[0026] Step S107: Exclude instances from the image generation instance connection pool that are unavailable, have abnormal health status, or have reached the single instance concurrency limit, and select available instances according to the preset instance order, the current number of tasks, or the configured weight.
[0027] Step S108: An executable vision generation workflow is executed by an available instance, and task status events and node execution progress are published via the event bus.
[0028] Step S109: Extract the generated image or image access address based on the output node identifier and node output location identifier in the output mapping relationship.
[0029] Step S110: Upload the generated image to object storage or image resource library, associate the generated result with user try-on records, product material records, marketing material records or other business objects based on the result write-back information, and return the result.
[0030] Example 2 This embodiment is basically the same as Embodiment 1, except that: Task request parameter description (corresponding to the technical content of step S101): In this embodiment, the workflow identifier, original input parameters, image key name list, task priority, and result write-back information in the task request each serve different task execution functions. The workflow identifier indicates the target visual generation workflow invoked by this clothing visual generation task. The system obtains the corresponding workflow description file and workflow configuration file from the workflow registry through the workflow identifier, thereby eliminating the need for the unified task entry point to directly identify the computational node structure within different visual workflows.
[0031] The initial input parameters are used to carry the task data required for the execution of the target vision generation workflow. Different tasks can have different initial input parameters. For example, the initial initial input parameters for a virtual try-on task may include a person image, a clothing image, and the try-on type; after performing multimodal image analysis, the system can supplement the input parameters to be injected as text control parameters; a product display image generation task may include a model image, a product clothing image, and display control information; a text-to-image generation task may include text prompts and output dimensions. The unified task entry does not pre-define that all workflows have exactly the same input fields, but rather the parameter mapping positions are determined by the workflow configuration file corresponding to the target vision generation workflow.
[0032] The image key name list is used to identify parameter fields from the original input parameters that need to be processed according to image data. For parameters identified by the image key name list, the system performs image download, image reference conversion, or local path conversion; for text parameters and numerical parameters not identified as image parameters, the corresponding parameter values are retained and the process proceeds to the subsequent node parameter injection process. Therefore, the same task submission entry can simultaneously process visual editing tasks containing images and text-to-image tasks that do not contain images.
[0033] The task priority is used to determine the sorting relationship of the generated tasks after they enter the asynchronous task queue. In one specific implementation, the task priority is represented by a preset numerical range, and the task dequeue order is determined together with the task submission time. The result write-back information is used to record the business object and purpose corresponding to the generated result. After the generated task is executed, the system associates the generated result or the access address of the generated result with the corresponding user try-on record, product material record, marketing material record, or other business data according to the result write-back information. By setting the above fields separately in the unified task request, the input differences between task types, workflow positioning, image preprocessing, asynchronous sorting, and result business association can be uniformly incorporated into the same task submission structure.
[0034] Workflow configuration and node mapping (this part is jointly disclosed by the technical features of steps S102, S105 and S109) and Workflow registration and two-tier configuration (this part is jointly disclosed by the technical features of steps S102, S105 and S109): like Figure 2As shown, each vision generation workflow corresponds to an independent workflow description file and workflow configuration file. In one implementation, both types of files are in JSON format. The workflow description file is the native computation graph of the vision workflow engine, containing nodes such as model loading, image input, text encoding, image generation, post-processing, and result output; the workflow configuration file declares the input and output interfaces required for a unified task entry point.
[0035] The input mapping relationship includes input parameter names, node identifiers, and node input field identifiers. In one specific implementation, the node identifier is represented by `node_id`, and the node input field identifier is represented by `node_input_field`. The system queries the node coordinates based on the input parameter name and writes parameters such as the person image, clothing image, text prompt information, output width, and output height into the corresponding node. The output mapping relationship includes the output result field, output node identifier, and node output position identifier. In one specific implementation, the node output position identifier is represented by `node_output_index`. After the workflow is completed, the system locates the output node based on the output node identifier and extracts the generated image or its access address based on the node output position identifier.
[0036] The workflow configuration file also records input validation rules. When adding new visual generation capabilities, new workflow description files and configuration files can be registered without modifying the unified task submission, queue scheduling, and result write-back logic. When workflow nodes or interfaces change, the corresponding files can be updated while maintaining the stability of the upper-level interfaces.
[0037] Workflow registration and configuration driving mechanism (this part is jointly disclosed by the technical features of steps S102, S105 and S109): In one specific implementation, the system maintains the correspondence between workflow identifiers and workflow description files and workflow configuration files through a workflow registry. Upon receiving a task request, the unified task entry point does not directly write the node number of the target workflow into the program code. Instead, it first queries the workflow registry based on the workflow identifier in the task request to obtain the workflow description file and workflow configuration file corresponding to this task. The workflow description file and workflow configuration file respectively handle the description of the computation process and the external interface. The workflow description file describes the computation graph structure of the actual execution of the visual generation task; the workflow configuration file converts the input parameter names to the task requester into node positions in the computation graph. Therefore, the task requester can submit tasks using parameter names with business meaning, such as person images, clothing images, text prompts, output width, and output height, without needing to be aware of the specific node numbers used within the workflow.
[0038] On the input side, the system converts input parameter names into node identifiers and node input field identifiers based on the input mapping relationships in the workflow configuration file. The node identifier is used to identify the target computation node in the workflow description file, and the node input field identifier is used to identify the specific input location within the target computation node that receives the parameter value. Thus, a unified task entry point allows the same parameter processing logic to be applied to visual generation workflows with different computation node structures. On the output side, the workflow configuration file establishes a mapping relationship between the generated results and the computation graph output through output result fields, output node identifiers, and node output location identifiers. Once the visual generation workflow is executed, the result processing does not require writing separate result parsing code for each workflow; instead, it locates the target output node and extracts the corresponding output based on the output mapping relationships in the corresponding configuration.
[0039] In one specific implementation, when adding a new visual generation capability, the new workflow description file and its corresponding workflow configuration file are registered to the workflow registry, enabling the unified task entry point to invoke the visual generation capability based on the new workflow identifier. When the computation nodes or node connections in the computation graph change, but the change does not affect the node identifiers, node input field identifiers, and node output position identifiers recorded in the workflow configuration file, only the corresponding workflow description file needs to be updated. When changes in the computation graph cause changes in the node identifiers, node input fields, or node output positions corresponding to the input or output mapping, the corresponding workflow configuration file is updated synchronously. This approach ensures that the mapping relationship between the workflow description file and the workflow configuration file remains consistent, while reducing modifications to the unified task submission, asynchronous scheduling, and result write-back logic.
[0040] Task Input Processing 1) Virtual try-on instruction generation (this part is jointly disclosed by the technical features of steps S103 and S104): When the task type is a virtual try-on task, the system can invoke a multimodal image understanding model before parameter injection. The model simultaneously receives images of the person and clothing. For the person, it extracts body shape, posture, skin tone, hairstyle, current attire, and background lighting information. For the clothing, it extracts color, fabric texture, pattern, collar type, sleeve length, hem length, and pattern information. Based on the above analysis results, the system generates English editing instructions for the image editing workflow. These instructions may include the scope of clothing replacement, detailed descriptions of clothing, requirements for maintaining the person's identity, and image quality requirements. In one specific implementation, the editing instructions are 100 to 200 English words in length.
[0041] The current workflow can employ a dual-image editing approach, using a person image as the first input and a clothing image as the second input, with editing instructions written into text-encoded nodes. For multiple garments, the images of the top and bottom can be stitched together to form a reference image, or the result generated in the previous round can be used as the input for the person image in the next round. When the multimodal image understanding model fails to be invoked, the system uses a preset template corresponding to the try-on type.
[0042] In this embodiment, multimodal image understanding and image editing control instruction generation are task-specific preprocessing steps performed before workflow parameter injection for virtual try-on tasks, rather than necessary steps for all clothing visual generation tasks. When the task is a virtual try-on task, the image editing control instructions generated by the multimodal image understanding model are used as text control parameters in the original input parameters and written into the text encoding node according to the input mapping relationship defined in the target workflow configuration file. Thus, the multimodal image understanding module connects with the subsequent workflow mapping mechanism through ordinary input parameters without changing the unified processing procedures of workflow configuration, parameter verification, asynchronous queues, and instance scheduling.
[0043] When the task is a visual generation task that does not require joint analysis of person and clothing images, the above-mentioned multimodal image analysis steps can be omitted. For example, a text-to-image task can directly use text prompts as raw input parameters, and an image editing task can directly receive image editing instructions provided by the task requester. These tasks still complete parameter validation, node parameter injection, asynchronous task scheduling, and result extraction according to the corresponding workflow configuration file. Therefore, multimodal image analysis, as an input enhancement method for specific clothing visual tasks, complements the technical main chain of this invention, which implements unified task execution based on workflow configuration, without restricting other visual generation workflows from accessing the unified execution framework.
[0044] 2) Parameter verification and image processing (this part is jointly disclosed by the technical features of steps S103 and S104): Input validation rules in the workflow configuration file are used to validate required fields, data types, parameter ranges, and image parameters. The dual-image editing workflow can require input of a person image, a reference image, and text control parameters; the text-to-image workflow can require text prompts and allow output size as an optional parameter. For image parameters, the system can validate the number of images, file format, file size, and image dimensions. Parameter validation is performed before the task is written to the asynchronous queue. If validation fails, it returns a failure field, failure type, and modification prompt, without consuming an image generation instance.
[0045] After successful verification, the system processes the image parameters according to the image key name list. In one implementation, the unified task entry point receives the image's Uniform Resource Locator (URL) and converts the corresponding image into an image reference that the visual generation workflow execution environment can read. This image reference can be a local or shared storage path accessible to the workflow execution environment, or an object storage address accessible to the image generation instance. Subsequently, after the generation task is assigned to a specific image generation instance, that instance reads the corresponding image data based on the image reference.
[0046] 3) Configuration driver parameter verification and image recognition (this part is jointly disclosed by the technical features of steps S103 and S104): In this embodiment, different vision generation workflows can declare different input validation rules in their respective workflow configuration files. A unified task entry point performs validation according to the validation rules corresponding to the target workflow, without needing to write a fixed validation program for each vision generation workflow. Parameter validation can be performed sequentially according to the completeness and validity of input parameters. First, the required parameters for the current target workflow are determined based on the input parameter definitions in the workflow configuration file, and it is checked whether the corresponding parameters exist in the task request. Subsequently, the data type, value range, and other constraints of the provided parameters are validated. When the parameter is an image parameter, it is further determined whether the number of images, file format, file size, and image dimensions meet the requirements of the corresponding workflow.
[0047] Only after the pre-submission parameter validation passes will the system download or convert the image parameters and proceed to the workflow node parameter injection process. If any required parameter is missing or does not meet the input validation rules, the system directly returns the corresponding failure information and does not create an execution task that consumes image generation computing resources. This allows some task errors to be identified and terminated before entering the image generation instance. The image key name list is used to distinguish between image parameters and non-image parameters in the original input parameters. The system iterates through the image key name list and performs image processing on the corresponding parameters in the list; non-image parameters such as text prompts, task types, and output sizes are not processed by image download but retain their original values for subsequent node parameter injection.
[0048] For example, in a dual-image editing workflow, the image key list can identify the person image field and the clothing image field, and the system processes the two image parameters separately. In a text-to-image workflow, the image key list can be empty, the system skips the image processing, and directly performs subsequent node mapping on the text prompts and output parameters. Thus, the same task submission interface can be compatible with different numbers of image inputs, as well as visual generation tasks that do not contain image inputs.
[0049] Asynchronous task scheduling Asynchronous queues and instance scheduling (this part is jointly disclosed by the technical features of steps S106 and S107): like Figure 3 As shown, the asynchronous task queue adopts a priority queue based on a heap structure. In one specific implementation, the task priority value ranges from 1 to 10, with a higher value indicating a higher priority; tasks with the same priority are sorted according to their submission time. Task cancellation uses a lazy deletion method, skipping tasks with deletion flags during dequeueing; the heap is reconstructed when the number of entries with deletion flags exceeds a preset threshold.
[0050] The system sets global and single-instance concurrency limits. In one implementation, the global concurrency limit is 20, and the single-instance concurrency limit is 5. The task scheduler checks the queue and available concurrency slots once per second. These values can be adjusted based on the number of graphics processors and the deployment scale.
[0051] The image generation instance connection pool supports three allocation methods: round-robin, minimum task count, and weighted. Round-robin allocates tasks according to instance order; minimum task count selects the instance with the fewest current tasks; and weighted allocation determines the allocation ratio based on the instance's configured weights.
[0052] The connection pool performs health checks at preset intervals. In one specific implementation, the health check cycle is 30 seconds. Idle instances are marked as unassignable when their health check fails; instances executing tasks retain their current task association when their health check fails, and the instance status is updated only after the task is completed, fails, or times out.
[0053] Concurrent slots, instance selection, and resource release (this part is disclosed by the technical features of step S107): During task scheduling, global concurrency control and single-instance concurrency control work together to allocate generation tasks. Global concurrency control limits the total number of generation tasks that can be executed simultaneously in the current image generation instance connection pool, while single-instance concurrency control limits the number of generation tasks that a single image generation instance can handle simultaneously. The task scheduler only performs new task allocation when the global concurrency count has not reached the global concurrency limit, and at least one available image generation instance has not reached the single-instance concurrency limit. When the current global number of tasks has reached the global concurrency limit, the generation tasks to be executed remain in the asynchronous task queue and will be re-scheduled in subsequent scheduling cycles. When there are still available concurrent slots globally, but all instances in the image generation instance connection pool are in a state of connection unavailable, health abnormality, or have reached the single-instance concurrency limit, the generation tasks also remain in a pending state until an allocable instance is detected in a subsequent scheduling cycle.
[0054] For multiple available image generation instances obtained through filtering, the system can select different instance allocation methods based on the deployment environment. When the computing power and task processing capabilities of multiple instances are relatively similar, a round-robin approach can be used to allocate tasks sequentially. When there are significant differences in the execution time of different generation tasks, the minimum number of tasks can be used to prioritize instances with lower current load. When there are differences in the computing power of different instances, a weighted allocation method can be used based on configured weights to ensure that instances with higher task processing capabilities receive a corresponding proportion of tasks.
[0055] After a task is assigned to an image generation instance, the system increments the current task count of the corresponding instance and establishes an execution association between the generation task and the image generation instance. Upon task completion, failure, or termination, the system releases the instance execution resources occupied by the task and updates the current task count accordingly, enabling the instance to participate in subsequent task allocation. In one specific implementation, the acquisition and release of instance connection resources employ a paired management approach, ensuring that corresponding resource release operations are performed both upon normal task completion and abnormal exit, thereby reducing the discrepancy between the available concurrent instance count and the actual state caused by unreleased execution resources in abnormal paths.
[0056] Task Status and Result Processing 1) Task status, events, and exception handling (this part is disclosed by the technical features of step S108): like Figure 4 As shown, the main execution states of a generated task can include pending execution, executing, completed execution, and failed execution. For generated tasks canceled before execution, the system can set a deletion flag and generate a task cancellation event; for generated tasks that fail to execute but meet preset retry conditions, they can enter a retry waiting process and be rewritten into the asynchronous task queue after the preset retry time has elapsed. Corresponding events are generated during task status changes and workflow node execution.
[0057] The event bus uses a publish-subscribe pattern. In one specific implementation, the maximum capacity of the event queue is 10,000 entries. Task completion, task failure, and task cancellation events are considered critical events and are retained with priority; task progress and general state change events are considered non-critical events and can be deleted or overwritten when the queue capacity reaches its limit.
[0058] When the exception is a recoverable network connection failure, instance service overload, or temporary workflow execution failure, the system can rewrite the task into the asynchronous task queue within a preset number of retries. When the exception does not meet the retry conditions, the task status is updated to execution failure and the reason for failure is recorded. When result extraction fails, the extraction exception is recorded according to the output mapping in the configuration file, without dynamically changing the output node.
[0059] 2) Task progress event transmission (this part is disclosed by the technical features of step S108): In one specific implementation, the image generation instance generates node-level execution progress information during the execution of the visual generation workflow. The visual workflow execution engine sends the node execution progress to the progress callback module via a bidirectional communication connection. The progress callback module converts the node execution progress into a unified task event and publishes it to the event bus. The event bus adopts a publish-subscribe approach, decoupling the task execution end from the state consumption end. The asynchronous task management module can subscribe to task status events and update the corresponding task status. The result extraction and write-back module can trigger subsequent result processing based on task completion events. The task request end can subscribe to task progress and general state change events.
[0060] In one specific implementation, the visual workflow execution engine transmits node-level execution progress via WebSocket. Progress callbacks convert corresponding progress updates into events and send them to the EventBus. The event subscriber then continuously sends task status and node execution progress to the task requester via a server-side event channel. Thus, the node execution status in the image generation instance can be transmitted to the task requester through a unified event processing chain, without the task requester needing to directly connect to the image generation instance. For critical events such as task completion, task failure, and task cancellation, the event processing module prioritizes their entry into the event queue. For non-critical events such as task progress updates and general status changes, when the event queue reaches its capacity limit, earlier non-critical events can be deleted or overwritten according to a preset strategy to reduce the impact of a large amount of high-frequency progress information on the transmission of critical task status.
[0061] Task record and result status persistence (this part is disclosed by the technical features of step S110): In one specific implementation, the system establishes a task record for each visual generation task entering the asynchronous execution flow to save the task's status information from creation, queuing, execution, completion, or failure. The task record may include at least one or more of the following: task type, task status, task progress, workflow identifier, task priority, generated result address, and failure reason. When a task enters the asynchronous task queue, the system establishes a corresponding task record and saves the task identifier, workflow identifier, task type, and task priority. When an image generation instance begins executing its corresponding task, the system updates the task execution status and task start time; during workflow execution, the system can update the task progress based on node execution events; when the generation task is completed, the system updates the task status and saves the access address of the generated result; when the task fails, the system saves the corresponding failure reason for querying and anomaly analysis by the task requesting end.
[0062] In one specific implementation, the status field in the task record represents the task's lifecycle from pending execution to execution, and then to completion or failure; the task progress field records the current execution progress; the result address field records the access address after the generated image is uploaded to object storage; the failure reason field stores task execution exception information; the workflow identifier identifies the visual generation workflow invoked by this task; and the task priority records the task's priority information in the asynchronous task queue. The system can also use a unified image record to manage user-uploaded images and system-generated images. The image record can store basic information such as image access address, object storage key, file size, file type, image width, and image height. Task records, user session records, product material records, and other business records can be associated with corresponding image resources through image identifiers or image access addresses.
[0063] Thus, the event bus is responsible for the real-time transmission of status and progress during task execution, the task record is responsible for the persistent storage of task status and result information, and the result write-back process further establishes an association between the generated results and the corresponding business objects, thereby forming a process in which task execution status transmission, result persistence and business result write-back are interconnected.
[0064] Example of Apparel Business Tasks Examples 3 and 4 further disclose the technical solution of the present invention using real-world examples. The user virtual try-on task can receive images of a person, clothing, and the type of clothing to try on. It uses a multimodal image understanding model to generate editing instructions and outputs try-on images through a dual-image editing workflow. The generated results can be linked to the user's session records or try-on history. The product display image generation task can receive images of a model, product clothing, and display control information. It reuses the dual-image editing workflow to generate display images of a model wearing the product clothing and links the results to product identification. The marketing material generation task can use either image editing or text-to-image generation. Image editing receives product images or product display images and scene description information, while text-to-image generation receives text prompts and optional output sizes. The results can be linked to product identification and material usage labels. Brand identification, pricing, and detailed typography can be processed manually or using layout tools after image generation.
[0065] Example 3: Virtual Try-on Task for Users In one implementation of virtual try-on, the task requesting end acquires a user image, clothing image, and try-on type, and generates a corresponding clothing visual generation task. The task request includes at least a workflow identifier, original input parameters, an image key name list, task priority, and result write-back information. The original input parameters include the user image, clothing image, and try-on type; the image key name list identifies the user image parameters and clothing image parameters; and the result write-back information determines the user session record or try-on history record corresponding to the generated result.
[0066] Based on the workflow identifier, the system reads the workflow description file and workflow configuration file corresponding to the virtual try-on task from the workflow registry. The workflow description file describes the image input nodes, text encoding nodes, image generation nodes, and result output nodes in the dual-image editing workflow, along with their connection relationships. The workflow configuration file declares the node identifiers and node input field identifiers corresponding to input parameters such as person images, clothing images, and text control parameters, as well as the output node identifiers and node output position identifiers corresponding to the generated results. The workflow description file and workflow configuration file adopt the aforementioned independent two-layer organization method. This two-layer workflow mechanism, together with the unified task entry point and node input / output mapping relationships, constitutes the foundation for subsequent task execution.
[0067] Before injecting node parameters, the system performs pre-submission validation on the task input parameters according to the input validation rules in the workflow configuration file. For virtual try-on tasks, at least the existence of necessary inputs such as the person image, clothing image, and try-on type is verified, and image format, file size, image dimensions, and parameter type can be further verified. If the validation fails, a parameter validation failure message is returned and the task submission is terminated, preventing the corresponding task from entering the asynchronous task queue and image generation instance; if the validation passes, the subsequent image processing and workflow parameter injection process begins.
[0068] For virtual try-on tasks that pass parameter validation, the system identifies the parameters of the person and clothing images based on the image key name list, and converts the images pointed to by the corresponding image Uniform Resource Locators into image references that can be read by the visual generation workflow. In one implementation, the image can be downloaded to an input directory accessible to the image generation instance, and the resulting local path can be used as the image input for the workflow; alternatively, the image can be converted into an object storage address that can be directly accessed by the image generation instance.
[0069] In this embodiment, the system can also invoke a multimodal image understanding model before parameter injection to perform joint analysis on the person image and clothing image. On the person image side, information such as body shape, posture, skin tone, hairstyle, current clothing, and background lighting can be extracted; on the clothing image side, information such as color, fabric texture, pattern, collar type, sleeve length, hem length, and cut can be extracted. Based on the above analysis results and the fitting type, the system generates image editing control instructions for the dual-image editing workflow. These instructions include at least the clothing replacement range, clothing detail description, requirements for maintaining the person's identity, and image quality requirements. In one specific implementation, the editing instructions can be in natural language form consisting of 100 to 200 English words. When the multimodal image understanding model call fails, the system can invoke a preset image editing instruction template corresponding to the fitting type.
[0070] Subsequently, based on the input mapping relationship in the workflow configuration file, the system writes the person image into the first image input node, the clothing image into the second image input node, and the image editing control instructions into the text encoding node; for other parameters such as output size, they are also written into the corresponding calculation nodes according to the node identifier and node input field identifier recorded in the configuration file, thus forming an executable visual generation workflow.
[0071] The system encapsulates the executable visual generation workflow into generation tasks, assigns task identifiers to these tasks, and writes them into an asynchronous task queue according to task priority. The task scheduler retrieves tasks to be executed according to queue priority and, within the limits of global concurrency and single-instance concurrency, excludes instances from the image generation instance connection pool that have unavailable communication connections, abnormal health status, or whose current task count has reached the single-instance concurrency limit. It then selects available image generation instances using round-robin, least-task-count, or weighted allocation methods. The asynchronous task queue, concurrency control, and instance connection pool reuse the general scheduling mechanism described above in this specification, and no separate scheduling link is established for virtual try-on tasks.
[0072] During the execution of the dual-image editing workflow in the image generation instance, task status changes and node execution progress are published via the event bus. The task requester can receive task execution progress; task completion, task failure, and task cancellation events are treated as critical events and given priority. When a temporary exception occurs during task execution that meets preset retry conditions, the task can be rewritten into the asynchronous task queue; when the retry conditions are not met, the task status is updated to execution failure and the reason for failure is recorded.
[0073] After the task is completed, the system locates the result output node by identifying the output node according to the output mapping relationship in the workflow configuration file, and extracts the user's virtual try-on image or its access address by identifying the node's output location. The generated image can be uploaded to object storage or an image resource library, and the system associates the generated result with the user's session record or try-on history record according to the result write-back information in the task, and finally returns it to the task requesting client.
[0074] When a user needs to try on multiple garments simultaneously, a serial overlay approach can be used to execute multiple rounds of virtual try-on tasks. For example, first, a person image and an image of the top garment are used to perform the first round of generation, resulting in a try-on of the top garment. Then, the result of the previous round is used as the input for the next round of generation, where the person image and the bottom garment image are used together to perform the second round of generation, thus obtaining a try-on result containing multiple garments. Alternatively, multiple garment images can be stitched together into a single reference image and used as the garment input for a two-image editing workflow.
[0075] Example 4: Merchant Marketing Material Generation Task In one implementation of marketing material generation, the task requesting end obtains product images or product display images, scene description information, and product identifiers and material usage information corresponding to the generated results, and generates a marketing material generation task. The task request includes a workflow identifier, original input parameters, an image key name list, task priority, and result write-back information. When the marketing material task uses image editing, the original input parameters include at least a product image or product display image and scene description information; the image key name list is used to identify product image parameters. The scene description information can represent seasons, holidays, or specific usage environments, such as autumn, holiday themes, coffee shops, offices, beaches, etc. Contextualized marketing materials can be generated based on existing product images or product display images, and the target background or visual environment can be controlled through the scene description information.
[0076] The system retrieves the corresponding image editing workflow description file and workflow configuration file from the workflow registry based on the workflow identifier. The workflow description file records the calculation nodes and node connections for product image input, text control, image generation, and result output. The workflow configuration file declares the input mapping relationships corresponding to parameters such as product image, scene description information, and optional output size, and records the output node identifier and node output position identifier corresponding to the generated result. Before the task enters the asynchronous task queue, the system performs pre-submission parameter validation according to the input validation rules in the workflow configuration file. For marketing material tasks using image editing, it can validate whether the product image or product display image exists, whether the scene description information meets the parameter requirements, and whether the image format, file size, image size, and optional output size meet the corresponding workflow requirements. When the validation fails, a parameter validation failure message is returned and the task submission is terminated; when the validation passes, the product image is converted into an image reference that the workflow can read based on the image key name list.
[0077] Subsequently, the system, according to the input mapping relationship, writes the product image or product display image into the corresponding image input node, the scene description information into the text control node, and parameters such as output size into the corresponding parameter node, forming an executable image editing workflow. The node parameter injection process still uses the input parameter name, node identifier, and node input field identifier recorded in the workflow configuration file for positioning, eliminating the need to write separate parameter injection code for marketing material tasks. The system encapsulates the formed executable workflow into generation tasks and writes them into the asynchronous task queue according to task priority. The task scheduler obtains the tasks to be executed according to the aforementioned priority queue and concurrency control mechanism, selects image generation instances from the instance connection pool that have normal communication connections, are in good health, and have not reached the single-instance concurrency limit, and completes task allocation using round-robin, least-task-number, or weighted allocation methods.
[0078] During the image generation instance's execution of the marketing material generation task, the system publishes task status and node execution progress via the event bus. When the event queue reaches its capacity limit, critical events such as task completion, task failure, and task cancellation are prioritized. Temporary abnormal tasks that meet preset retry conditions can be rewritten into the asynchronous task queue.
[0079] After the task is completed, the system extracts the marketing material image or its access address based on the output node identifier and node output location identifier in the workflow configuration file, uploads the generated result to object storage or image resource library, and establishes an association between the marketing material image and the corresponding product identifier and material usage identifier based on the result write-back information. The marketing material can be used for product promotion, seasonal new product launches, holiday marketing, or scenario-based display, etc.
[0080] For brand logos, pricing information, and detailed text layout, subsequent processing can be performed manually or using layout tools after image generation. This embodiment does not consider the aforementioned text layout process as a necessary step in the visual workflow mapping and asynchronous scheduling main chain. As can be seen from this embodiment, although the merchant marketing material generation task and the user virtual try-on task have different input data and visual generation objectives, both reuse workflow description files and workflow configuration files, pre-submission parameter validation, node parameter injection, asynchronous priority queues, instance connection pool scheduling, event buses, and result extraction and write-back mechanisms. This demonstrates that the workflow mapping and asynchronous scheduling method described in this invention can adapt to different apparel visual generation businesses.
[0081] Example 5 System components: The relationships between the components of the apparel visual workflow mapping and asynchronous scheduling system disclosed in this embodiment are as follows: like Figure 5 As shown, the system includes a task acquisition module 101, an image analysis and instruction generation module 102, a workflow configuration management module 103, a parameter verification and image processing module 104, a parameter injection module 105, an asynchronous task management module 106, an instance scheduling module 107, an event processing module 108, and a result extraction and write-back module 109.
[0082] The task acquisition module 101 acquires task requests; the image analysis and instruction generation module 102 generates editing instructions in the virtual try-on task; the workflow configuration management module 103 registers and maintains workflow description files and workflow configuration files; the parameter validation and image processing module 104 performs input validation and processes image parameters; the parameter injection module 105 writes parameters according to node mapping; the asynchronous task management module 106 maintains priority queues and task status; the instance scheduling module 107 performs concurrency control, instance selection, and health checks; the event handling module 108 publishes task status and node progress; and the result extraction and write-back module 109 extracts, stores, and writes back results.
[0083] Specific deployment method: In one specific deployment method, the task acquisition module, workflow configuration management module, parameter verification and image processing module, and parameter injection module can be deployed on the task access side to receive unified task requests, query workflow configurations, perform pre-submission parameter verification, process image input, and form an executable visual generation workflow.
[0084] The asynchronous task management module, instance scheduling module, and event handling module can be deployed on the task scheduling side. The asynchronous task management module maintains the priority task queue and task status, the instance scheduling module maintains the image generation instance connection pool and performs concurrency control, instance selection, and health checks, and the event handling module is responsible for receiving the task status and node execution progress generated by the image generation instances and publishing task events to the corresponding subscribers.
[0085] One or more compute nodes with graphics processing capabilities can serve as image generation instances to execute executable visual generation workflows assigned by the task scheduler. Multiple image generation instances are managed uniformly through an instance connection pool, enabling the task scheduling process to allocate tasks based on the instance's current number of tasks, health status, and configuration weights.
[0086] The result extraction and write-back module can connect to object storage and business databases. After the generation task is completed, the result extraction and write-back module extracts the generation results according to the output mapping relationship corresponding to the target workflow, writes the generated image to object storage or image resource library, and writes the generation result access address, task status, and corresponding business association information to task records or business data.
[0087] The above deployment method illustrates a specific collaborative relationship between the functional modules. These modules can be located on the same computing device or distributed across different servers or computing nodes, depending on the deployment scale. These modules can be deployed on application servers, task scheduling servers, and one or more computing nodes with graphics processors, or they can be implemented by different program units within the same computing device. The workflow execution engine can use ComfyUI or other visual workflow engines with the same node orchestration capabilities; the image generation model, image editing model, and multimodal image understanding model can use models capable of performing the same functions.
[0088] The module correspondence in Example 5 is shown in Table 1 below: Table 1. Correspondence and Function Table of Each Module in This Embodiment
[0089] Obviously, those skilled in the art can make various modifications and variations to this invention without departing from its spirit and scope. Therefore, if these modifications and variations fall within the scope of the claims of this invention and their equivalents, this invention also intends to include these modifications and variations.
[0090] The contents not described in detail in this specification are existing technologies known to those skilled in the art.
Claims
1. A method for mapping and asynchronous scheduling of visual workflows for clothing, characterized in that: Includes the following steps: S1. Obtain the task request for the clothing visual generation task. The task request includes workflow identifier, original input parameters, image key name list, task priority and result write-back information. S2. Based on the workflow identifier, obtain the corresponding and independent workflow description file and workflow configuration file from the workflow registry. The workflow description file is used to record the computing nodes and node connection relationships in the visual generation workflow. The workflow configuration file is used to record the input mapping relationship between input parameters and input fields of computing nodes, the output mapping relationship between output result fields and output nodes and node output positions, and input validation rules. S3. Perform pre-submission parameter verification on the original input parameters according to the input verification rules, and terminate the task submission if the parameter verification fails. After the parameter verification is passed, the image parameters in the original input parameters are identified according to the image key name list, and the image corresponding to the image parameter is converted into an image reference that can be read by the visual generation workflow. S4. Based on the input mapping relationship, write the parameter values in the original input parameters into the node input field of the corresponding computing node in the workflow description file to form an executable visual generation workflow. The executable visual generation workflow is encapsulated into generation tasks, each assigned a task identifier, and written to an asynchronous task queue according to its priority. Generation tasks are retrieved from the asynchronous task queue according to their priority, and image generation instances with unavailable communication connections, abnormal health status, or reaching the single-instance concurrency limit are excluded from the image generation instance connection pool. Available image generation instances are selected based on one or more of the following: preset instance order, current task count, or configured weights. The executable visual generation workflow is executed by the available image generation instances, and task status events and node execution progress are published via an event bus. S5. After the generation task is completed, the generation result is extracted according to the output node identifier and node output position identifier in the output mapping relationship, and the storage, business association and result return of the generation result are completed according to the result write-back information.
2. The method for mapping and asynchronous scheduling of visual workflows for clothing according to claim 1, characterized in that: In step S1, the clothing visual generation task includes one or more of the following: virtual try-on task, product display image generation task, marketing material generation task, and text-to-image task; wherein, the original input parameters of the virtual try-on task include a person image, clothing image, and try-on type; the original input parameters of the product display image generation task include a model image, product clothing image, and display control information; the original input parameters of the marketing material generation task include a product image or product display image and scene description information; and the original input parameters of the text-to-image task include text prompt information and an optional output size. When the clothing visual generation task is a virtual try-on task, the person image and the clothing image are input into a multimodal image understanding model to extract person feature information and clothing feature information, and image editing control instructions are generated based on the person feature information, the clothing feature information and the try-on type. The image editing control instructions include clothing replacement range, clothing detail requirements, person identity preservation requirements and image quality requirements. When the multimodal image understanding model is called abnormally, a preset image editing instruction template corresponding to the try-on type is called.
3. The method for mapping and asynchronous scheduling of visual workflows for clothing according to claim 2, characterized in that: In step S2, the workflow description file and the workflow configuration file are independent of each other. The workflow description file includes one or more of the following: model loading node, image input node, text encoding node, image generation node, image post-processing node, and result output node, as well as the connection relationships between each node. The workflow configuration file includes a workflow identifier, input parameter definitions, output parameter definitions, input mapping relationships, output mapping relationships, and input validation rules. When adding or adjusting a visual generation workflow, the unified task submission logic is maintained by registering or updating the workflow description file and the workflow configuration file.
4. The method for mapping and asynchronous scheduling of visual workflows for clothing according to claim 3, characterized in that: In step S2, the input mapping relationship includes the correspondence between input parameter names, node identifiers, and node input field identifiers; the corresponding node identifier and node input field identifier are queried according to the input parameter name; the target computing node is located according to the node identifier; the target input field is located according to the node input field identifier; and the parameter value corresponding to the input parameter name in the original input parameter is written into the target input field. The output mapping relationship includes the correspondence between the output result fields, the output node identifier, and the node output position identifier; After the visual generation workflow is completed, the target output node is located according to the output node identifier, and the target generated image or the access address of the target generated image is extracted from the output result of the target output node according to the node output position identifier.
5. The method for mapping and asynchronous scheduling of visual workflows for apparel according to claim 4, characterized in that: In step S3, the pre-submission parameter verification includes: verifying whether the input parameters marked as required exist; verifying whether the data type and value range of the input parameters conform to the input verification rules; when the input parameters include images, verifying one or more of the following: the number of input images, file format, file size, and image dimensions; if any input parameter fails verification, generating parameter verification failure information, terminating the encapsulation of the generation task, and not writing the clothing visual generation task into the asynchronous task queue.
6. The method for mapping and asynchronous scheduling of visual workflows for apparel according to claim 5, characterized in that: In step S4, the asynchronous task queue adopts a heap structure based on task priority, with high-priority generated tasks being dequeued before low-priority generated tasks; when multiple generated tasks have the same task priority, the dequeue order is determined according to the task submission time; when a generated task is canceled, a deletion flag is set for the generated task and the generated task is skipped during dequeueing; when task entries with deletion flags reach the preset cleanup conditions, the asynchronous task queue is reconstructed.
7. The method for mapping and asynchronous scheduling of visual workflows for apparel according to claim 6, characterized in that: In step S4, the concurrent execution of the generation task adopts global concurrency control and single instance concurrency control; when the global concurrency number is lower than the global concurrency limit and the current task number of one or more image generation instances is lower than the single instance concurrency limit, the available image generation instance is selected from the remaining available instances using a round-robin allocation method, a minimum task number allocation method, or a weighted allocation method.
8. The method for mapping and asynchronous scheduling of visual workflows for clothing according to claim 7, characterized in that: In step S4, the image generation instance connection pool performs health checks on each image generation instance at preset time intervals; when an image generation instance that has not performed a generation task fails the health check, it is marked as unallocatable. When an image generation instance that is performing a generation task fails a health check, the current task execution association is retained, and the allocatable state of the image generation instance is updated after the task is completed, fails, or times out. The event bus identifies one or more of the following events as critical events: task completion event, task failure event, and task cancellation event; and identifies one or two of the following events as non-critical events: task progress event and general status change event. When the event storage space reaches its capacity limit, the critical events will be retained first. When the generated task execution fails and the preset retry conditions are met, the generated task is rewritten into the asynchronous task queue. When the failure does not meet the preset retry conditions, the task status is updated to execution failure and the reason for failure is recorded.
9. A visual workflow mapping and asynchronous scheduling system for clothing, characterized in that: Includes the following: Task Acquisition Module: Used to acquire task requests that include workflow identifier, raw input parameters, image key name list, task priority, and result write-back information; Image analysis and instruction generation module: used to perform multimodal analysis on images of people and clothing in virtual try-on tasks and generate image editing control instructions; Workflow Configuration Management Module: Used to register and maintain workflow description files and workflow configuration files, and to retrieve the corresponding workflow description files and workflow configuration files from the workflow registry based on the workflow identifier; Parameter validation and image processing module: used to perform pre-submission parameter validation according to input validation rules, and convert image parameters into image references that the workflow can read based on the image key name list; Parameter injection module: used to write the original input parameters into the corresponding computing node according to the input mapping relationship; Asynchronous task management module: used to encapsulate executable visual generation workflows into generation tasks and write them into the asynchronous task queue according to task priority; Instance scheduling module: used to exclude unavailable instances and select available images to generate instances; Event handling module: Used to publish task status events and node execution progress via the event bus; The result extraction and write-back module is used to extract, store, and write back the generated results based on the output mapping relationship.
10. The apparel visual workflow mapping and asynchronous scheduling system according to claim 9, characterized in that: The asynchronous task management module adopts a priority heap structure and supports lazy deletion of canceled tasks; The instance scheduling module performs global concurrency control and single instance concurrency control, and supports round-robin, minimum number of tasks and weighted allocation. The image generation instance connection pool performs periodic health checks. When the event storage space reaches its capacity limit, the event handling module prioritizes retaining task completion events, task failure events, and task cancellation events.
