Skip to content

Commit

Permalink
add sam edit (#167)
Browse files Browse the repository at this point in the history
* add sam edit function

* add sam point/box nodes

* combine sam loader and segment-anything node

* refine the code

* refine the code

* refine the code

* refine the code

* add point/box example json files

* refine the code

* refine the code

* refine the code

* delete unused changes

* rm unused example jsons

* delete example json

* refine the code

* modify README.md、add example json and refine the code

* add example json in docs directory

* modify the example json

* refine the code

* update ci

* refine

---------

Co-authored-by: Yao Chi <[email protected]>
  • Loading branch information
Wanghanying and doombeaker authored Oct 30, 2024
1 parent 3bb5843 commit 33dd528
Show file tree
Hide file tree
Showing 10 changed files with 1,958 additions and 106 deletions.
16 changes: 2 additions & 14 deletions .github/workflows/workflow-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ on:
pull_request:
branches:
- master
types: [opened, synchronize, reopened]

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
Expand All @@ -31,7 +30,7 @@ jobs:
modified_files=$(git diff --name-only origin/${{ github.base_ref }}...HEAD)
only_non_code_files=true
for file in $modified_files; do
if [[ "$file" == *.py ]] || [[ "$file" == *.js ]] || [[ "$file" == *.json ]]; then
if [[ "$file" == *.py ]] || [[ "$file" == *.js ]] || [[ "$file" == *.json ]] || [[ "$file" == *.yml ]]; then
only_non_code_files=false
break
fi
Expand All @@ -43,24 +42,13 @@ jobs:

run-examples-workflows:
needs: check-modified-files
if: ${{ needs.check-modified-files.outputs.only_non_code_files == 'false' && github.event.pull_request.draft == false }}
if: ${{ needs.check-modified-files.outputs.only_non_code_files == 'false' }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest, ubuntu-latest]

steps:
- name: Check if PR is draft
id: check_draft
run: |
if [ "$GITHUB_EVENT_NAME" = "pull_request" ] && [ "$GITHUB_EVENT_PULL_REQUEST_DRAFT" = "true" ]; then
echo "PR is draft, skipping CI"
echo "::set-output name=skip::true"
else
echo "PR is not draft, running CI"
echo "::set-output name=skip::false"
fi
- name: Show Base
run: |
echo "Current directory: $(pwd)"
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# BizyAir
- [2024/10/30] 🌩️ BizyAir Segment-Anything nodes has been released. [text_guided_segment-anything](./examples/bizyair_text_guided_segment-anything.json) and [box_point_guided_segment-anything](./examples/bizyair_box_point_guided_segment-anything.json)
- [2024/10/24] 🌩️ BizyAir supports stable Diffusion 3.5. [Stable Diffusion 3.5 Text to Image](./examples/bizyair_sd3_5_txt2img.json)
- [2024/10/21] 🌩️ BizyAir supports VLModels. We add a tutorial for utilizing the VLM node. [AI Assistant](https://siliconflow.github.io/BizyAir/ai-assistants/introduce.html)
- [2024/10/11] 🌩️ BizyAir supports PuLID for Flux. [FLUX PuLID workflow](./examples/bizyair_flux_pulid.json)
Expand Down
2 changes: 2 additions & 0 deletions __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
nodes,
nodes_controlnet_aux,
nodes_controlnet_union_sdxl,
segment_anything,
showcase,
supernode,
)
Expand All @@ -34,6 +35,7 @@ def update_mappings(module):
update_mappings(nodes_controlnet_aux)
update_mappings(nodes_controlnet_union_sdxl)
update_mappings(mzkolors)
update_mappings(segment_anything)

# bizy_server
bizyair_adv_is_not_installed = False
Expand Down
262 changes: 262 additions & 0 deletions docs/docs/examples/bizyair_box_point_guided_segment-anything.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,262 @@
{
"last_node_id": 21,
"last_link_id": 18,
"nodes": [
{
"id": 3,
"type": "PreviewImage",
"pos": {
"0": 1574,
"1": 392,
"2": 0,
"3": 0,
"4": 0,
"5": 0,
"6": 0,
"7": 0,
"8": 0,
"9": 0
},
"size": {
"0": 210,
"1": 246
},
"flags": {},
"order": 2,
"mode": 0,
"inputs": [
{
"name": "images",
"type": "IMAGE",
"link": 17
}
],
"outputs": [],
"properties": {
"Node name for S&R": "PreviewImage"
}
},
{
"id": 12,
"type": "PreviewImage",
"pos": {
"0": 1855,
"1": 389,
"2": 0,
"3": 0,
"4": 0,
"5": 0,
"6": 0,
"7": 0,
"8": 0,
"9": 0
},
"size": {
"0": 210,
"1": 246
},
"flags": {},
"order": 4,
"mode": 0,
"inputs": [
{
"name": "images",
"type": "IMAGE",
"link": 10
}
],
"outputs": [],
"properties": {
"Node name for S&R": "PreviewImage"
}
},
{
"id": 11,
"type": "MaskToImage",
"pos": {
"0": 1810,
"1": 310,
"2": 0,
"3": 0,
"4": 0,
"5": 0,
"6": 0,
"7": 0,
"8": 0,
"9": 0
},
"size": {
"0": 264.5999755859375,
"1": 26
},
"flags": {},
"order": 3,
"mode": 0,
"inputs": [
{
"name": "mask",
"type": "MASK",
"link": 18
}
],
"outputs": [
{
"name": "IMAGE",
"type": "IMAGE",
"links": [
10
],
"slot_index": 0,
"shape": 3
}
],
"properties": {
"Node name for S&R": "MaskToImage"
}
},
{
"id": 20,
"type": "BizyAirSegmentAnythingPointBox",
"pos": {
"0": 1124,
"1": 375,
"2": 0,
"3": 0,
"4": 0,
"5": 0,
"6": 0,
"7": 0,
"8": 0,
"9": 0
},
"size": {
"0": 307.80706787109375,
"1": 338
},
"flags": {},
"order": 0,
"mode": 0,
"inputs": [],
"outputs": [
{
"name": "IMAGE",
"type": "IMAGE",
"links": [
17
],
"slot_index": 0,
"shape": 3
},
{
"name": "MASK",
"type": "MASK",
"links": [
18
],
"slot_index": 1,
"shape": 3
}
],
"properties": {
"Node name for S&R": "BizyAirSegmentAnythingPointBox"
},
"widgets_values": [
"0804.png",
true,
"image"
]
},
{
"id": 19,
"type": "Note",
"pos": {
"0": 1114,
"1": 43,
"2": 0,
"3": 0,
"4": 0,
"5": 0,
"6": 0,
"7": 0,
"8": 0,
"9": 0
},
"size": [
532.1334686279297,
232.066650390625
],
"flags": {},
"order": 1,
"mode": 0,
"inputs": [],
"outputs": [],
"properties": {},
"widgets_values": [
"SAM EDITOR功能:\n\n可选模式:point模式和box模式\n\n使用步骤:☁️BizyAir Point-Box Guided SAM 节点上通过is_point选择分割模式,true为point模式,false为box模式,右键选择Open in SAM EDITOR,可以通过Select mode按钮切换分割模式(注意要与is_point一致,否则会出错),point模式下通过鼠标左键单击选择抠图区域,box模式下拖动鼠标进行框选\n\n【注意】服务器断开后重连需要重新选择抠图区域,否则会出错;\n\nPoint mode按钮: 工作在point mode下,point mode按钮精准控制分割区域,点中区域是想保留得区域(remain)或者要去除得区域(remove)\n\nClear按钮:清除画布上得所有选择抠图区域\n\nUndo按钮:撤销上次选择得抠图区域\n\nCancel:清除画布上得所有选择抠图区域并退出\n\nSave to node: 保存\n\n"
],
"color": "#432",
"bgcolor": "#653"
}
],
"links": [
[
10,
11,
0,
12,
0,
"IMAGE"
],
[
17,
20,
0,
3,
0,
"IMAGE"
],
[
18,
20,
1,
11,
0,
"MASK"
]
],
"groups": [
{
"title": "选择抠图区域",
"bounding": [
1114,
309,
351,
410
],
"color": "#A88",
"font_size": 24
},
{
"title": "抠图结果",
"bounding": [
1490,
308,
642,
341
],
"color": "#b58b2a",
"font_size": 24
}
],
"config": {},
"extra": {
"ds": {
"scale": 1,
"offset": [
-689.6000213623047,
116.26676940917969
]
}
},
"version": 0.4
}
Loading

0 comments on commit 33dd528

Please sign in to comment.