使用AI视觉自动化图片验证任务
中级
这是一个Product, AI, IT Ops, SecOps领域的自动化工作流,包含 11 个节点。主要使用 Set, SplitOut, EditImage, GoogleDrive, ManualTrigger 等节点,结合人工智能技术实现智能自动化。 通过AI视觉技术自动化图片验证任务
前置要求
- •Google Drive API 凭证
- •Google Gemini API Key
使用的节点 (11)
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"meta": {
"instanceId": "408f9fb9940c3cb18ffdef0e0150fe342d6e655c3a9fac21f0f644e8bedabcd9"
},
"nodes": [
{
"id": "6c78b4c7-993b-410d-93e7-e11b3052e53b",
"name": "当点击\"测试工作流\"时",
"type": "n8n-nodes-base.manualTrigger",
"position": [
0,
420
],
"parameters": {},
"typeVersion": 1
},
{
"id": "c2ab6497-6d6d-483b-bd43-494ae95394c0",
"name": "结构化输出解析器",
"type": "@n8n/n8n-nodes-langchain.outputParserStructured",
"position": [
1440,
600
],
"parameters": {
"schemaType": "manual",
"inputSchema": "{\n\t\"type\": \"object\",\n\t\"properties\": {\n\t\t\"is_valid\": { \"type\": \"boolean\" },\n \"photo_description\": {\n \"type\": \"string\",\n \"description\": \"describe the appearance of the person(s), object(s) if any and the background in the image. Mention any colours of each if possible.\"\n },\n\t\t\"reasons\": {\n \"type\": \"array\",\n \"items\": { \"type\": \"string\" }\n }\n\t}\n}"
},
"typeVersion": 1.2
},
{
"id": "b23f5298-17c7-49ac-a8ca-78e006b2d294",
"name": "照片 URL",
"type": "n8n-nodes-base.set",
"position": [
360,
380
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "6baa3e08-8957-454e-8ee9-d5414a0ff990",
"name": "data",
"type": "array",
"value": "={{\n[\n{\n \"name\": \"portrait_1\",\n \"url\": \"https://drive.google.com/file/d/1zs963iFkO-3g2rKak8Hcy555h55D8gjF/view?usp=sharing\"\n},\n{\n \"name\": \"portrait_2\",\n \"url\": \"https://drive.google.com/file/d/19FyDcs68dZauQSEf6SEulJMag51SPsFy/view?usp=sharing\"\n},\n{\n \"name\": \"portrait_3\",\n \"url\": \"https://drive.google.com/file/d/1gbXjfNYE7Tvuw_riFmHMKoqPPu696VfW/view?usp=sharing\",\n\n},\n{\n \"name\": \"portrait_4\",\n \"url\": \"https://drive.google.com/file/d/1s19hYdxgfMkrnU25l6YIDq-myQr1tQMa/view?usp=sharing\"\n},\n{\n \"name\": \"portrait_5\",\n \"url\": \"https://drive.google.com/file/d/193FqIXJWAKj6O2SmOj3cLBfypHBkgdI5/view?usp=sharing\"\n}\n]\n}}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "8d445f73-dff7-485b-87e2-5b64da09cbf0",
"name": "照片转列表",
"type": "n8n-nodes-base.splitOut",
"position": [
520,
380
],
"parameters": {
"options": {},
"fieldToSplitOut": "data"
},
"typeVersion": 1
},
{
"id": "7fb3b829-88a7-42ec-abfd-3ddaa042c916",
"name": "下载照片",
"type": "n8n-nodes-base.googleDrive",
"position": [
680,
380
],
"parameters": {
"fileId": {
"__rl": true,
"mode": "url",
"value": "={{ $json.url }}"
},
"options": {},
"operation": "download"
},
"credentials": {
"googleDriveOAuth2Api": {
"id": "yOwz41gMQclOadgu",
"name": "Google Drive account"
}
},
"typeVersion": 3
},
{
"id": "b8644f6d-691f-49bc-b0fe-33a68c59638d",
"name": "为 AI 调整大小",
"type": "n8n-nodes-base.editImage",
"position": [
1060,
440
],
"parameters": {
"width": 1024,
"height": 1024,
"options": {},
"operation": "resize",
"resizeOption": "onlyIfLarger"
},
"typeVersion": 1
},
{
"id": "ecb266f2-0d2d-4cbe-a641-26735f0bdf18",
"name": "便签",
"type": "n8n-nodes-base.stickyNote",
"position": [
280,
180
],
"parameters": {
"color": 7,
"width": 594,
"height": 438,
"content": "## 1. 导入照片进行验证"
},
"typeVersion": 1
},
{
"id": "a1034923-0905-4cdd-a6bf-21d28aa3dd71",
"name": "便签1",
"type": "n8n-nodes-base.stickyNote",
"position": [
900,
180
],
"parameters": {
"color": 7,
"width": 774,
"height": 589.25,
"content": "## 2. 使用 AI 视觉模型验证护照照片有效性"
},
"typeVersion": 1
},
{
"id": "af231ee5-adff-4d27-ba5f-8c04ddd4892d",
"name": "便签2",
"type": "n8n-nodes-base.stickyNote",
"position": [
-140,
0
],
"parameters": {
"width": 386,
"height": 610.0104651162792,
"content": "## 试试看!"
},
"typeVersion": 1
},
{
"id": "e07e1655-2683-4e21-b2b7-e0c0bfb569c0",
"name": "护照照片验证器",
"type": "@n8n/n8n-nodes-langchain.chainLlm",
"position": [
1240,
440
],
"parameters": {
"text": "Assess if the image is a valid according to the passport photo criteria as set by the UK Government.",
"messages": {
"messageValues": [
{
"message": "=You help verify passport photo validity.\n\n## Rules for digital photos\nhttps://www.gov.uk/photos-for-passports\n\n### The quality of your digital photo\nYour photo must be:\n* clear and in focus\n* in colour\n* unaltered by computer software\n* at least 600 pixels wide and 750 pixels tall\n* at least 50KB and no more than 10MB\n\n### What your digital photo must show\nThe digital photo must:\n* contain no other objects or people\n* be taken against a plain white or light-coloured background\n* be in clear contrast to the background\n* not have ‘red eye’\n* If you’re using a photo taken on your own device, include your head, shoulders and upper body. Do not crop your photo - it will be done for you.\n\nIn your photo you must:\n* be facing forwards and looking straight at the camera\n* have a plain expression and your mouth closed\n* have your eyes open and visible\n* not have hair in front of your eyes\n* not have a head covering (unless it’s for religious or medical reasons)\n* not have anything covering your face\n* not have any shadows on your face or behind you - shadows on light background are okay\n* Do not wear glasses in your photo unless you have to do so. If you must wear glasses, they cannot be sunglasses or tinted glasses, and you must make sure your eyes are not covered by the frames or any glare, reflection or shadow.\n\n### Photos of babies and children\n* Children must be on their own in the picture. Babies must not be holding toys or using dummies.\n* Children under 6 do not have to be looking directly at the camera or have a plain expression.\n* Children under one do not have to have their eyes open. You can support their head with your hand, but your hand must not be visible in the photo.\n* Children under one should lie on a plain light-coloured sheet. Take the photo from above.\n\n"
},
{
"type": "HumanMessagePromptTemplate",
"messageType": "imageBinary"
}
]
},
"promptType": "define",
"hasOutputParser": true
},
"typeVersion": 1.4
},
{
"id": "0a36ba22-90b2-4abf-943b-c1cc8e7317d5",
"name": "Google Gemini 聊天模型",
"type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
"position": [
1240,
600
],
"parameters": {
"options": {},
"modelName": "models/gemini-1.5-pro-latest"
},
"credentials": {
"googlePalmApi": {
"id": "dSxo6ns5wn658r8N",
"name": "Google Gemini(PaLM) Api account"
}
},
"typeVersion": 1
}
],
"pinData": {},
"connections": {
"Photo URLs": {
"main": [
[
{
"node": "Photos To List",
"type": "main",
"index": 0
}
]
]
},
"Resize For AI": {
"main": [
[
{
"node": "Passport Photo Validator",
"type": "main",
"index": 0
}
]
]
},
"Photos To List": {
"main": [
[
{
"node": "Download Photos",
"type": "main",
"index": 0
}
]
]
},
"Download Photos": {
"main": [
[
{
"node": "Resize For AI",
"type": "main",
"index": 0
}
]
]
},
"Google Gemini Chat Model": {
"ai_languageModel": [
[
{
"node": "Passport Photo Validator",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Structured Output Parser": {
"ai_outputParser": [
[
{
"node": "Passport Photo Validator",
"type": "ai_outputParser",
"index": 0
}
]
]
},
"When clicking ‘Test workflow’": {
"main": [
[
{
"node": "Photo URLs",
"type": "main",
"index": 0
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
中级 - 产品, 人工智能, IT 运维, 安全运维
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
简历PDF解析(多模态视觉AI)
使用多模态视觉AI进行简历PDF解析
If
Edit Image
Google Drive
+6
13 节点Jimleuk
人力资源
使用AI汇总Slack频道活动生成周报
使用AI汇总Slack频道活动生成周报
If
Set
Code
+13
47 节点Jimleuk
其他
AI驱动的RAG文档处理与聊天机器人 - Google Drive、Supabase、OpenAI
基于Google Drive、Supabase和OpenAI的AI驱动RAG文档处理与聊天机器人
Set
Code
Limit
+19
35 节点Billy Christi
人工智能
评估指标:摘要
评估指标:摘要
Set
Webhook
Evaluation
+9
17 节点Jimleuk
工程
使用 n8n、Apify 和 OpenAI o3 自托管 AI 深度研究代理
使用 n8n、Apify 和 OpenAI o3 自托管 AI 深度研究代理
If
Set
Code
+20
87 节点Jimleuk
人工智能
审核Google Drive文件权限以进行访问控制管理
审核Google Drive文件权限以进行访问控制管理
Set
Gmail
Filter
+8
19 节点Jimleuk
IT 运维
工作流信息
难度等级
中级
节点数量11
分类4
节点类型9
作者
Jimleuk
@jimleukFreelance consultant based in the UK specialising in AI-powered automations. I work with select clients tackling their most challenging projects. For business enquiries, send me an email at hello@jimle.uk LinkedIn: https://www.linkedin.com/in/jimleuk/ X/Twitter: https://x.com/jimle_uk
外部链接
在 n8n.io 查看 →
分享此工作流