2025-09-25 15:32:23 +08:00
|
|
|
from app.service.design_fast.pipeline import LoadImage, KeyPoint, Segmentation, Color, PrintPainting, Scaling, Split, LoadBodyImage, ContourDetection, NoSegPrintPainting
|
2024-09-25 11:40:11 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
class BaseItem:
|
|
|
|
|
def __init__(self, data, basic):
|
|
|
|
|
self.result = data.copy()
|
|
|
|
|
self.result['name'] = data['type'].lower()
|
|
|
|
|
self.result.pop("type")
|
|
|
|
|
self.result.update(basic)
|
2026-01-12 16:18:04 +08:00
|
|
|
self.result['design_type'] = basic.get('design_type', None)
|
2024-09-25 11:40:11 +08:00
|
|
|
|
|
|
|
|
|
2025-11-07 10:56:34 +08:00
|
|
|
class OthersItem(BaseItem):
|
2024-11-26 16:08:10 +08:00
|
|
|
def __init__(self, data, basic, minio_client):
|
|
|
|
|
super().__init__(data, basic)
|
2025-11-07 10:56:34 +08:00
|
|
|
self.Others_pipeline = [
|
2024-11-26 16:08:10 +08:00
|
|
|
LoadImage(minio_client),
|
2025-09-16 11:47:19 +08:00
|
|
|
Segmentation(minio_client),
|
2026-01-29 16:25:43 +08:00
|
|
|
Color(minio_client),
|
2024-11-26 16:08:10 +08:00
|
|
|
Scaling(),
|
|
|
|
|
Split(minio_client)
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
def process(self):
|
2025-11-07 10:56:34 +08:00
|
|
|
for item in self.Others_pipeline:
|
2024-11-26 16:08:10 +08:00
|
|
|
self.result = item(self.result)
|
|
|
|
|
return self.result
|
|
|
|
|
|
|
|
|
|
|
2024-09-25 11:40:11 +08:00
|
|
|
class TopItem(BaseItem):
|
|
|
|
|
def __init__(self, data, basic, minio_client):
|
|
|
|
|
super().__init__(data, basic)
|
|
|
|
|
self.top_pipeline = [
|
|
|
|
|
LoadImage(minio_client),
|
|
|
|
|
KeyPoint(),
|
|
|
|
|
Segmentation(minio_client),
|
2024-10-30 10:34:53 +08:00
|
|
|
# BackPerspective(minio_client),
|
2024-09-25 11:40:11 +08:00
|
|
|
Color(minio_client),
|
2025-09-25 15:32:23 +08:00
|
|
|
NoSegPrintPainting(minio_client),
|
2024-09-25 11:40:11 +08:00
|
|
|
PrintPainting(minio_client),
|
|
|
|
|
Scaling(),
|
|
|
|
|
Split(minio_client)
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
def process(self):
|
|
|
|
|
for item in self.top_pipeline:
|
|
|
|
|
self.result = item(self.result)
|
|
|
|
|
return self.result
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class BottomItem(BaseItem):
|
|
|
|
|
def __init__(self, data, basic, minio_client):
|
|
|
|
|
super().__init__(data, basic)
|
|
|
|
|
self.bottom_pipeline = [
|
|
|
|
|
LoadImage(minio_client),
|
|
|
|
|
KeyPoint(),
|
|
|
|
|
ContourDetection(),
|
2025-02-25 17:26:00 +08:00
|
|
|
Segmentation(minio_client),
|
2024-10-30 10:34:53 +08:00
|
|
|
# BackPerspective(minio_client),
|
2024-09-25 11:40:11 +08:00
|
|
|
Color(minio_client),
|
2025-09-25 15:32:23 +08:00
|
|
|
NoSegPrintPainting(minio_client),
|
2024-09-25 11:40:11 +08:00
|
|
|
PrintPainting(minio_client),
|
|
|
|
|
Scaling(),
|
|
|
|
|
Split(minio_client)
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
def process(self):
|
|
|
|
|
for item in self.bottom_pipeline:
|
|
|
|
|
self.result = item(self.result)
|
|
|
|
|
return self.result
|
|
|
|
|
|
|
|
|
|
|
2026-01-12 16:18:04 +08:00
|
|
|
"""merge"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class OthersMergeItem(BaseItem):
|
|
|
|
|
def __init__(self, data, basic, minio_client):
|
|
|
|
|
super().__init__(data, basic)
|
|
|
|
|
self.Others_pipeline = [
|
|
|
|
|
LoadImage(minio_client),
|
|
|
|
|
# KeyPoint(),
|
|
|
|
|
# ContourDetection(),
|
|
|
|
|
Segmentation(minio_client),
|
|
|
|
|
# BackPerspective(minio_client),
|
|
|
|
|
Color(minio_client),
|
2026-01-22 13:41:47 +08:00
|
|
|
# NoSegPrintPainting(minio_client),
|
|
|
|
|
# PrintPainting(minio_client),
|
2026-01-12 16:18:04 +08:00
|
|
|
Scaling(),
|
|
|
|
|
Split(minio_client)
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
def process(self):
|
|
|
|
|
for item in self.Others_pipeline:
|
|
|
|
|
self.result = item(self.result)
|
|
|
|
|
return self.result
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class TopMergeItem(BaseItem):
|
|
|
|
|
def __init__(self, data, basic, minio_client):
|
|
|
|
|
super().__init__(data, basic)
|
|
|
|
|
self.top_pipeline = [
|
|
|
|
|
LoadImage(minio_client),
|
|
|
|
|
KeyPoint(),
|
|
|
|
|
Segmentation(minio_client),
|
|
|
|
|
Scaling(),
|
|
|
|
|
Split(minio_client)
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
def process(self):
|
|
|
|
|
for item in self.top_pipeline:
|
|
|
|
|
self.result = item(self.result)
|
|
|
|
|
return self.result
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class BottomMergeItem(BaseItem):
|
|
|
|
|
def __init__(self, data, basic, minio_client):
|
|
|
|
|
super().__init__(data, basic)
|
|
|
|
|
self.bottom_pipeline = [
|
|
|
|
|
LoadImage(minio_client),
|
|
|
|
|
KeyPoint(),
|
|
|
|
|
Segmentation(minio_client),
|
|
|
|
|
Scaling(),
|
|
|
|
|
Split(minio_client)
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
def process(self):
|
|
|
|
|
for item in self.bottom_pipeline:
|
|
|
|
|
self.result = item(self.result)
|
|
|
|
|
return self.result
|
|
|
|
|
|
|
|
|
|
|
2024-09-25 11:40:11 +08:00
|
|
|
class BodyItem(BaseItem):
|
|
|
|
|
def __init__(self, data, basic, minio_client):
|
|
|
|
|
super().__init__(data, basic)
|
|
|
|
|
self.top_pipeline = [
|
|
|
|
|
LoadBodyImage(minio_client),
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
def process(self):
|
|
|
|
|
for item in self.top_pipeline:
|
|
|
|
|
self.result = item(self.result)
|
|
|
|
|
return self.result
|