diff --git a/edit/FlowEdit/Data/Images/bear.png b/edit/FlowEdit/Data/Images/bear.png new file mode 100644 index 0000000000000000000000000000000000000000..26feeea0cbc4c01ba3f7499154bde354ec374637 --- /dev/null +++ b/edit/FlowEdit/Data/Images/bear.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:dcc08df49db283d7ab4f272888f2a930b03a1cdffb2994123c62529b52118d41 +size 2090888 diff --git a/edit/FlowEdit/Data/Images/bear_grass.png b/edit/FlowEdit/Data/Images/bear_grass.png new file mode 100644 index 0000000000000000000000000000000000000000..f623f560ab0a43c57cfc538c5744a462f4df5f71 --- /dev/null +++ b/edit/FlowEdit/Data/Images/bear_grass.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6e612ed0c2b96b25f34bcdcc034c282be241a65582701478f9e4dc3375d0fe9e +size 2243846 diff --git a/edit/FlowEdit/Data/Images/beer_glass.png b/edit/FlowEdit/Data/Images/beer_glass.png new file mode 100644 index 0000000000000000000000000000000000000000..a47acedb9ba08cc0ea91ac75b90c9c3ac7a19fdb --- /dev/null +++ b/edit/FlowEdit/Data/Images/beer_glass.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a89872e9cf746bae3284f17552bf93dfdf8d8b4d084b3c3160d20b5e77dbb35d +size 543201 diff --git a/edit/FlowEdit/Data/Images/bikes.png b/edit/FlowEdit/Data/Images/bikes.png new file mode 100644 index 0000000000000000000000000000000000000000..626d923aba30e0a5de2834c1ed1cddca979eee89 --- /dev/null +++ b/edit/FlowEdit/Data/Images/bikes.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:51498aa1880e5fe27135aaede98adeac1c85825725b722d43c29db8eeb7faa99 +size 1818141 diff --git a/edit/FlowEdit/Data/Images/boat_silhouette.png b/edit/FlowEdit/Data/Images/boat_silhouette.png new file mode 100644 index 0000000000000000000000000000000000000000..26c16353d48ee79aa525c65f2aadac4830ca9aa3 --- /dev/null +++ b/edit/FlowEdit/Data/Images/boat_silhouette.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:eb43f5aa48752a4fa811a051a3226dc6b386218988b49ad87b3ba265e1575ed6 +size 1225461 diff --git a/edit/FlowEdit/Data/Images/brown_owl.png b/edit/FlowEdit/Data/Images/brown_owl.png new file mode 100644 index 0000000000000000000000000000000000000000..1c47cbaa0219fc33e01ca9bbe691b2dd7e8b32c4 --- /dev/null +++ b/edit/FlowEdit/Data/Images/brown_owl.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fa34f34282d5cc8666f3326bb49cdee56c6c717f2dfd8ac978caed270b3e1b53 +size 1519556 diff --git a/edit/FlowEdit/Data/Images/bus.png b/edit/FlowEdit/Data/Images/bus.png new file mode 100644 index 0000000000000000000000000000000000000000..fbd6dd2e3d526402eaa82a4204670181e342b81c --- /dev/null +++ b/edit/FlowEdit/Data/Images/bus.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:84ee666810558a637e1831851442996171ebb2b5fb07edd146e9c725c2c94d8d +size 1818385 diff --git a/edit/FlowEdit/Data/Images/butterflies.png b/edit/FlowEdit/Data/Images/butterflies.png new file mode 100644 index 0000000000000000000000000000000000000000..8414e780ff01bf32e9557261bf8e0e6971d0a544 --- /dev/null +++ b/edit/FlowEdit/Data/Images/butterflies.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d922a547a47095b35aa4935ca7465c877011321a8b212610355839ea917148ef +size 1345025 diff --git a/edit/FlowEdit/Data/Images/butterfly.png b/edit/FlowEdit/Data/Images/butterfly.png new file mode 100644 index 0000000000000000000000000000000000000000..2b291104c770746a45807e2c533ad28896f36cf5 --- /dev/null +++ b/edit/FlowEdit/Data/Images/butterfly.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4d1233d1848c9696a9961a260fefeccfea0748c90362645cbe451760e30db93f +size 700410 diff --git a/edit/FlowEdit/Data/Images/cake.png b/edit/FlowEdit/Data/Images/cake.png new file mode 100644 index 0000000000000000000000000000000000000000..7d5e5961e6898950ecd96564d37b6fb08b28aa7c --- /dev/null +++ b/edit/FlowEdit/Data/Images/cake.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:75a235986966b76886462f14ea3c076ab89a69c4cc53dc2d27b263d8496c1fdb +size 1241726 diff --git a/edit/FlowEdit/Data/Images/cake_red_blueberries.png b/edit/FlowEdit/Data/Images/cake_red_blueberries.png new file mode 100644 index 0000000000000000000000000000000000000000..bfdc331164310f57c6862a4555113209bf825f9c --- /dev/null +++ b/edit/FlowEdit/Data/Images/cake_red_blueberries.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fd73506ced813fcce1ddea5e9e48554d61e4ae3d40275eea1d022c15b455810f +size 1394629 diff --git a/edit/FlowEdit/Data/Images/castle.png b/edit/FlowEdit/Data/Images/castle.png new file mode 100644 index 0000000000000000000000000000000000000000..2a57306c0a97c07708ad973e1ba5cd545d363026 --- /dev/null +++ b/edit/FlowEdit/Data/Images/castle.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1e8136fe794604f460c40ca6001e2e3fcb36044d3452e272f2f197f481d3d064 +size 1286198 diff --git a/edit/FlowEdit/Data/Images/cat.png b/edit/FlowEdit/Data/Images/cat.png new file mode 100644 index 0000000000000000000000000000000000000000..a4d86e9e44ff8125aa022c2f3419e44ec232ff12 --- /dev/null +++ b/edit/FlowEdit/Data/Images/cat.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b47c5a05e46848a1dffb6cfad7680e1305522da8489219be22e5a81c076d3b2e +size 1283297 diff --git a/edit/FlowEdit/Data/Images/cat_and_dog.png b/edit/FlowEdit/Data/Images/cat_and_dog.png new file mode 100644 index 0000000000000000000000000000000000000000..5ed5536ebd412dda27d4b78cea10e06434acc761 --- /dev/null +++ b/edit/FlowEdit/Data/Images/cat_and_dog.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5b26292c4096d8886da77abab6f4084cc8564833f0b0e8455223ad7484a24347 +size 902284 diff --git a/edit/FlowEdit/Data/Images/cat_and_dog2.png b/edit/FlowEdit/Data/Images/cat_and_dog2.png new file mode 100644 index 0000000000000000000000000000000000000000..4925f11e7af05ecfb70ab2c1197eb94c73eb9d7e --- /dev/null +++ b/edit/FlowEdit/Data/Images/cat_and_dog2.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:be873839933b1c8e530f5566cbcf3954f66f0443d637a5403d3727763d5c5e9a +size 1318916 diff --git a/edit/FlowEdit/Data/Images/cat_crown.png b/edit/FlowEdit/Data/Images/cat_crown.png new file mode 100644 index 0000000000000000000000000000000000000000..efffd4dc45f21eada288ab8028962efce52ff93f --- /dev/null +++ b/edit/FlowEdit/Data/Images/cat_crown.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:abd517a6dea18a5494b56056cac2d18efb8d07eed9e1cb33613ffe62b844e57d +size 919279 diff --git a/edit/FlowEdit/Data/Images/cat_dog_car.png b/edit/FlowEdit/Data/Images/cat_dog_car.png new file mode 100644 index 0000000000000000000000000000000000000000..7cbfdce2ce5b54087351de46331813dad85d45f8 --- /dev/null +++ b/edit/FlowEdit/Data/Images/cat_dog_car.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:519d858dc87dca212c888a987193b81845245b9fc2ead3a7581805a3696c8246 +size 1555703 diff --git a/edit/FlowEdit/Data/Images/cat_ginger.png b/edit/FlowEdit/Data/Images/cat_ginger.png new file mode 100644 index 0000000000000000000000000000000000000000..73694c9ec4f3e4e04fead9e17b58a0a118a555c3 --- /dev/null +++ b/edit/FlowEdit/Data/Images/cat_ginger.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e3e50a12c3fb824468d328caf39e62a6af3ee34af2f1f78ac1d8b81925908bc0 +size 1117544 diff --git a/edit/FlowEdit/Data/Images/cat_stone.png b/edit/FlowEdit/Data/Images/cat_stone.png new file mode 100644 index 0000000000000000000000000000000000000000..90054aa85827cc3ed5cfc3aad342604a8a45e517 --- /dev/null +++ b/edit/FlowEdit/Data/Images/cat_stone.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ac15f7c989a670469a3b280137492b87510316c4e46734714d927870900640c8 +size 1252104 diff --git a/edit/FlowEdit/Data/Images/clown_fish.png b/edit/FlowEdit/Data/Images/clown_fish.png new file mode 100644 index 0000000000000000000000000000000000000000..dcf495f1f4ae66905a5d0132265ba6fb4c7981a7 --- /dev/null +++ b/edit/FlowEdit/Data/Images/clown_fish.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:52d2f467e7d5f21ddda6ef6fbf46c43c4c8e23a1be2060cb6b2ee2b093bb553a +size 1722438 diff --git a/edit/FlowEdit/Data/Images/coconut.png b/edit/FlowEdit/Data/Images/coconut.png new file mode 100644 index 0000000000000000000000000000000000000000..bc0d15c69b775bb96d99f49a5a8dfabef59c616a --- /dev/null +++ b/edit/FlowEdit/Data/Images/coconut.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:81f7b519783147672a995d207effde19ac5c774b9c293a2f67f85e20110161d3 +size 1657854 diff --git a/edit/FlowEdit/Data/Images/corgi.png b/edit/FlowEdit/Data/Images/corgi.png new file mode 100644 index 0000000000000000000000000000000000000000..8cc8eb2525a96cb4b14f568d1222f734af33029a --- /dev/null +++ b/edit/FlowEdit/Data/Images/corgi.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1dfd5b1769db32474b8ffb8d425e87021ad560594916ce3303c38b07dd978d47 +size 1041539 diff --git a/edit/FlowEdit/Data/Images/cupcake.png b/edit/FlowEdit/Data/Images/cupcake.png new file mode 100644 index 0000000000000000000000000000000000000000..9293c2158020670cebd5e3f89f25417d0a35cc51 --- /dev/null +++ b/edit/FlowEdit/Data/Images/cupcake.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5ecf57b562b4ae590b0f2e9c748f7cba9a411b0e1bdc94912553c7627599407e +size 1467174 diff --git a/edit/FlowEdit/Data/Images/dalmatian.png b/edit/FlowEdit/Data/Images/dalmatian.png new file mode 100644 index 0000000000000000000000000000000000000000..73e0a452c8e8614fa06d6eafa4561574a5f01100 --- /dev/null +++ b/edit/FlowEdit/Data/Images/dalmatian.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5994fc39b7b9c97dc838782640ea8e8d52d3acc1a9128f0baca022296c96641c +size 594236 diff --git a/edit/FlowEdit/Data/Images/deer_silhouette.png b/edit/FlowEdit/Data/Images/deer_silhouette.png new file mode 100644 index 0000000000000000000000000000000000000000..4e0cc372cd44b87a050953ef5eb79e25fa966473 --- /dev/null +++ b/edit/FlowEdit/Data/Images/deer_silhouette.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:108c54b069658742c8d5d2a4d6343cd29c81a4156f015034cf9a4119f2e4e21d +size 849579 diff --git a/edit/FlowEdit/Data/Images/dog.png b/edit/FlowEdit/Data/Images/dog.png new file mode 100644 index 0000000000000000000000000000000000000000..c454316c99a39614372af9fe448d5ab586161ef3 --- /dev/null +++ b/edit/FlowEdit/Data/Images/dog.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:df337a0f829b6e9a9cc63e6ec67eac0391f3667c2fbc64432fe75f245ccd6518 +size 1307566 diff --git a/edit/FlowEdit/Data/Images/dog_snow.png b/edit/FlowEdit/Data/Images/dog_snow.png new file mode 100644 index 0000000000000000000000000000000000000000..295c1b1d73755a660631c9d6c035bffbf4824d16 --- /dev/null +++ b/edit/FlowEdit/Data/Images/dog_snow.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:84f5b2eb8b369b4d38f8d420bdfe753f22a1fd14dc0952dffec317b003d01dd5 +size 1375778 diff --git a/edit/FlowEdit/Data/Images/dogs.png b/edit/FlowEdit/Data/Images/dogs.png new file mode 100644 index 0000000000000000000000000000000000000000..88949009843788e4a8322050392808689a34a71f --- /dev/null +++ b/edit/FlowEdit/Data/Images/dogs.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4f109f0eb5c679ffd9e3b70de0fd732f11daa839041e41132879973fde769c38 +size 1415043 diff --git a/edit/FlowEdit/Data/Images/dogs2.png b/edit/FlowEdit/Data/Images/dogs2.png new file mode 100644 index 0000000000000000000000000000000000000000..c22d8850256420285088e09227ba50beae5123c6 --- /dev/null +++ b/edit/FlowEdit/Data/Images/dogs2.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fb7057e3596429fa86eee9a1320fee092a657ad548501cd0e851975ad2ca19f0 +size 1860066 diff --git a/edit/FlowEdit/Data/Images/drawing_horse.png b/edit/FlowEdit/Data/Images/drawing_horse.png new file mode 100644 index 0000000000000000000000000000000000000000..bbed4820ce9957a3d39e4994e8de466a4b016ca0 --- /dev/null +++ b/edit/FlowEdit/Data/Images/drawing_horse.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3f2bc7d3e80986aadccc613d2e1142fbf52d1bc4bc1f375071891b1361a2ac83 +size 578236 diff --git a/edit/FlowEdit/Data/Images/duck.png b/edit/FlowEdit/Data/Images/duck.png new file mode 100644 index 0000000000000000000000000000000000000000..f337b7aef155fba0e13bb449f008e7bb3669c700 --- /dev/null +++ b/edit/FlowEdit/Data/Images/duck.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:01a8598152b338ac0a44d399f680569cc6cab66c5d2e3c0305ae885778293058 +size 1117685 diff --git a/edit/FlowEdit/Data/Images/flowers.png b/edit/FlowEdit/Data/Images/flowers.png new file mode 100644 index 0000000000000000000000000000000000000000..887c8823ed0c803ef3a04e01024c1a6f0f2c6798 --- /dev/null +++ b/edit/FlowEdit/Data/Images/flowers.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:14097d1505ccbea75d43731591f7adbc44a429992934a16644b790c8902f2a71 +size 1421064 diff --git a/edit/FlowEdit/Data/Images/flowers_draw.png b/edit/FlowEdit/Data/Images/flowers_draw.png new file mode 100644 index 0000000000000000000000000000000000000000..34206f6580c9d3ef4215f8bf225f4028533c997f --- /dev/null +++ b/edit/FlowEdit/Data/Images/flowers_draw.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:db27623d1a01a882f7d553912a3ea071391e8509ac6d4f91a44ee00638571f73 +size 1134104 diff --git a/edit/FlowEdit/Data/Images/free_wifi.png b/edit/FlowEdit/Data/Images/free_wifi.png new file mode 100644 index 0000000000000000000000000000000000000000..55e06055d15bce0156b498f4b4c83a3e5788c87c --- /dev/null +++ b/edit/FlowEdit/Data/Images/free_wifi.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9e52245ca42e689c83e13c5ab9f768d4f4cdd90498249c596b29f88e9e904e48 +size 1365780 diff --git a/edit/FlowEdit/Data/Images/gas_station.png b/edit/FlowEdit/Data/Images/gas_station.png new file mode 100644 index 0000000000000000000000000000000000000000..84715663a1917b796d708a71b94f7bf3d8b7477b --- /dev/null +++ b/edit/FlowEdit/Data/Images/gas_station.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:633754e02947653ed33ab741c86c40c8d21170a771cd4aced6250ba23e7c25bf +size 1096302 diff --git a/edit/FlowEdit/Data/Images/geese.png b/edit/FlowEdit/Data/Images/geese.png new file mode 100644 index 0000000000000000000000000000000000000000..6c2e80c50acc68acdbce895e3d7c4d63ae18d19a --- /dev/null +++ b/edit/FlowEdit/Data/Images/geese.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9c2431ad90fd705d693cced14802ce26db812237139fed75815437eeec5e4fe3 +size 1367752 diff --git a/edit/FlowEdit/Data/Images/gray_bird.png b/edit/FlowEdit/Data/Images/gray_bird.png new file mode 100644 index 0000000000000000000000000000000000000000..b404ae892cdff40a77876a5ca3623d8f59045c09 --- /dev/null +++ b/edit/FlowEdit/Data/Images/gray_bird.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6f0797b37c6bbe27eee2af697eb369937be5e073c03446259715ccf5ec8965b7 +size 998169 diff --git a/edit/FlowEdit/Data/Images/groceries.png b/edit/FlowEdit/Data/Images/groceries.png new file mode 100644 index 0000000000000000000000000000000000000000..c2e8b5401ae34ebdde77e4289ed419e894e3f776 --- /dev/null +++ b/edit/FlowEdit/Data/Images/groceries.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f589b77966284c0d459e96aa96fb9e53dc089f44f7f3038b06948af53979564e +size 961531 diff --git a/edit/FlowEdit/Data/Images/horse.png b/edit/FlowEdit/Data/Images/horse.png new file mode 100644 index 0000000000000000000000000000000000000000..8ea6cd09b72d98665b0e44892dadc6f4da2ccdcb --- /dev/null +++ b/edit/FlowEdit/Data/Images/horse.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:eeb3d2918e194ebd17d3c1d7eabb0102c2d7516e057c18f2cae2049e9452816a +size 1631312 diff --git a/edit/FlowEdit/Data/Images/horse_silhouette.png b/edit/FlowEdit/Data/Images/horse_silhouette.png new file mode 100644 index 0000000000000000000000000000000000000000..a7b0d0880bf2e4d2b41c8b67821664dc3e9f0353 --- /dev/null +++ b/edit/FlowEdit/Data/Images/horse_silhouette.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4ee56343d9a644fdd7a4999ddd92110e38ffcb479d67fc1d40a7da200c8ac9f3 +size 79280 diff --git a/edit/FlowEdit/Data/Images/iguana.png b/edit/FlowEdit/Data/Images/iguana.png new file mode 100644 index 0000000000000000000000000000000000000000..a1ed0dffe0647887c017b93744d07a7d4d5d0c05 --- /dev/null +++ b/edit/FlowEdit/Data/Images/iguana.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d9a345d957930f4a9d32539c24513f2da8ed09eed2d69048b6e342b2f0652c89 +size 1203114 diff --git a/edit/FlowEdit/Data/Images/japanese_castle.png b/edit/FlowEdit/Data/Images/japanese_castle.png new file mode 100644 index 0000000000000000000000000000000000000000..a3b919767c9f70a024a7a37f8c2d1a484374827b --- /dev/null +++ b/edit/FlowEdit/Data/Images/japanese_castle.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:58bb344e3f6573b02333c7414db0a3c2e328dc9fe13754bdaca37665fa989b6d +size 1677202 diff --git a/edit/FlowEdit/Data/Images/jump_kick.png b/edit/FlowEdit/Data/Images/jump_kick.png new file mode 100644 index 0000000000000000000000000000000000000000..5e5ffd21698562e48be969c7458390835f566da8 --- /dev/null +++ b/edit/FlowEdit/Data/Images/jump_kick.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f49b88100dd2afee651a389431b607418152ac533f383ee6d96206f7dd657790 +size 1367892 diff --git a/edit/FlowEdit/Data/Images/jump_yay.png b/edit/FlowEdit/Data/Images/jump_yay.png new file mode 100644 index 0000000000000000000000000000000000000000..bcd3b26267258e3aafc494aed2ae319fb372dcd3 --- /dev/null +++ b/edit/FlowEdit/Data/Images/jump_yay.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7f0fa2b8780890c6a3ec3dd3be35503161ebfdcd45b41a8b9343b49d36366e46 +size 741010 diff --git a/edit/FlowEdit/Data/Images/kid_running.png b/edit/FlowEdit/Data/Images/kid_running.png new file mode 100644 index 0000000000000000000000000000000000000000..240068dff25020305dba9f90d51c33ee215d9a1c --- /dev/null +++ b/edit/FlowEdit/Data/Images/kid_running.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b1a89baf3350e3577fe107dfcfcf256f7c9cf68ca195d6375b5f0d3f0323ae80 +size 1461170 diff --git a/edit/FlowEdit/Data/Images/lighthouse.png b/edit/FlowEdit/Data/Images/lighthouse.png new file mode 100644 index 0000000000000000000000000000000000000000..af34661e59e34764c91afa5973abb1e43dfd4220 --- /dev/null +++ b/edit/FlowEdit/Data/Images/lighthouse.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a9646ab72ee23b202f0dbbf4aecda6546c1317ba66376b44ee7b9860f91ff0a7 +size 1564584 diff --git a/edit/FlowEdit/Data/Images/luna.png b/edit/FlowEdit/Data/Images/luna.png new file mode 100644 index 0000000000000000000000000000000000000000..ff5a53a6536fec97dd5fc2a27b02666abbe37560 --- /dev/null +++ b/edit/FlowEdit/Data/Images/luna.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6c496e2d7f94ea19dc6c709eb9fb062ad9ab06708ec80df3faf170689d26d847 +size 1574174 diff --git a/edit/FlowEdit/Data/Images/meditation.png b/edit/FlowEdit/Data/Images/meditation.png new file mode 100644 index 0000000000000000000000000000000000000000..56c274200abe3ae73b580ec7d07cc9be506444d6 --- /dev/null +++ b/edit/FlowEdit/Data/Images/meditation.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c8dd1494576a66ebccae046026ef7dd87389672a84dcc877a49698cd610e746a +size 775338 diff --git a/edit/FlowEdit/Data/Images/meditation2.png b/edit/FlowEdit/Data/Images/meditation2.png new file mode 100644 index 0000000000000000000000000000000000000000..773a9039357715359eda1a77732ae8c4f4b1c5f7 --- /dev/null +++ b/edit/FlowEdit/Data/Images/meditation2.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:faecd91e5347f0ff464dd700aaa00bebf999c09b22f1a8759a05a5007eeb5919 +size 1815299 diff --git a/edit/FlowEdit/Data/Images/milk.png b/edit/FlowEdit/Data/Images/milk.png new file mode 100644 index 0000000000000000000000000000000000000000..cf1242aba55366a9c9063b4b947b6523f41abe5c --- /dev/null +++ b/edit/FlowEdit/Data/Images/milk.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:13d6c99aa55f3ed748225f6835eff820a59c495d9728d8f76a1ed78a98c2ce0b +size 1237232 diff --git a/edit/FlowEdit/Data/Images/mountain_black.png b/edit/FlowEdit/Data/Images/mountain_black.png new file mode 100644 index 0000000000000000000000000000000000000000..828fea5bd34351ab4cf9cda6bc1d3ace427a2618 --- /dev/null +++ b/edit/FlowEdit/Data/Images/mountain_black.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ac75a13fdc2f3a8478194691770015ef6981c85c1b8aa6a7a7fdb74cc838ea57 +size 975637 diff --git a/edit/FlowEdit/Data/Images/muffins.png b/edit/FlowEdit/Data/Images/muffins.png new file mode 100644 index 0000000000000000000000000000000000000000..5a85dd2ea81d5bea9f4f0ff7733fbe6465f2eb1a --- /dev/null +++ b/edit/FlowEdit/Data/Images/muffins.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:66f7352eecb6529a75ac4e4f4159237aec87245d0f2704b93bff842d163cbeb7 +size 1130862 diff --git a/edit/FlowEdit/Data/Images/parrot.png b/edit/FlowEdit/Data/Images/parrot.png new file mode 100644 index 0000000000000000000000000000000000000000..e75fce7b4f624793f138e9e229ed2df585a645f3 --- /dev/null +++ b/edit/FlowEdit/Data/Images/parrot.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:63376f1a1217a5367153a51eecc2fb8e9ed4e0e932cbeb6cec2ff55d6de507ae +size 1339446 diff --git a/edit/FlowEdit/Data/Images/parrot2.png b/edit/FlowEdit/Data/Images/parrot2.png new file mode 100644 index 0000000000000000000000000000000000000000..4719114fa1341ddc17697c782d572432590e174b --- /dev/null +++ b/edit/FlowEdit/Data/Images/parrot2.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:25f99cc9e9463cd48b6ca81e000c3d454af461b18e3f7d343cf6c59607102772 +size 1190552 diff --git a/edit/FlowEdit/Data/Images/parrots.png b/edit/FlowEdit/Data/Images/parrots.png new file mode 100644 index 0000000000000000000000000000000000000000..75bb6d2664515507f62bc5e3b2a9437791809f44 --- /dev/null +++ b/edit/FlowEdit/Data/Images/parrots.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2e5dd9389743d31093869dd3081b8c707999e467c5d8a71dfadfc2be402c638b +size 1335680 diff --git a/edit/FlowEdit/Data/Images/parrots2.png b/edit/FlowEdit/Data/Images/parrots2.png new file mode 100644 index 0000000000000000000000000000000000000000..1be743eb6e4ac49dd72fd0597515069b3374a51d --- /dev/null +++ b/edit/FlowEdit/Data/Images/parrots2.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c2b198f4ef8a4685a424a991dca511734a92cd6b08441a753d0c9c55a52c8b0d +size 2200973 diff --git a/edit/FlowEdit/Data/Images/penguins.png b/edit/FlowEdit/Data/Images/penguins.png new file mode 100644 index 0000000000000000000000000000000000000000..080a52e6315f77b4a6f7ebe3629aaaeadf76b862 --- /dev/null +++ b/edit/FlowEdit/Data/Images/penguins.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9dd65334e5b975b572569873359712c3516554799e4908d74acd38091833a9a7 +size 1386297 diff --git a/edit/FlowEdit/Data/Images/piece_of_cake.png b/edit/FlowEdit/Data/Images/piece_of_cake.png new file mode 100644 index 0000000000000000000000000000000000000000..61e934603f6484e34da3bdcb47dd8b7177e94c3b --- /dev/null +++ b/edit/FlowEdit/Data/Images/piece_of_cake.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:725cd4c579a898d5d6048c86958436274bbccdc9866c3615c1d3e51c29c107b2 +size 1214591 diff --git a/edit/FlowEdit/Data/Images/pizza.png b/edit/FlowEdit/Data/Images/pizza.png new file mode 100644 index 0000000000000000000000000000000000000000..cd4a5030067bd92e248b6a09a036e423514c67f6 --- /dev/null +++ b/edit/FlowEdit/Data/Images/pizza.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b43630e74c5491701a3b2857ec46cd53e8fba488d388179060e082c64e5bead7 +size 1433892 diff --git a/edit/FlowEdit/Data/Images/pizza_board.png b/edit/FlowEdit/Data/Images/pizza_board.png new file mode 100644 index 0000000000000000000000000000000000000000..80666e95160362b6e9903acee33eb326570d331c --- /dev/null +++ b/edit/FlowEdit/Data/Images/pizza_board.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4eaec9471e9e296793ce10c4b69f20bb7dcee6bdac6a1f2b91042905e7e845a5 +size 2150220 diff --git a/edit/FlowEdit/Data/Images/pizza_slice.png b/edit/FlowEdit/Data/Images/pizza_slice.png new file mode 100644 index 0000000000000000000000000000000000000000..53eed9a5f901a8fe22146490803a45f267e49a65 --- /dev/null +++ b/edit/FlowEdit/Data/Images/pizza_slice.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ea772876d964056cfa803dfbeda67c2d502939718af174f3f64e88bcd37fb51c +size 1298061 diff --git a/edit/FlowEdit/Data/Images/pizza_tomato_olive.png b/edit/FlowEdit/Data/Images/pizza_tomato_olive.png new file mode 100644 index 0000000000000000000000000000000000000000..696c87165375cc40a02f75f1f0fc63d84b340e4a --- /dev/null +++ b/edit/FlowEdit/Data/Images/pizza_tomato_olive.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1fd337ef7f265554c203a81ff9db2d9ffa88dcc9997ac86d3ffb93f720a16c0b +size 1797258 diff --git a/edit/FlowEdit/Data/Images/puppies.png b/edit/FlowEdit/Data/Images/puppies.png new file mode 100644 index 0000000000000000000000000000000000000000..fcdbe7de74314d5ca48101030fe67a968b52486d --- /dev/null +++ b/edit/FlowEdit/Data/Images/puppies.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:dc808eadb72d93952380213cf6605af095921ac62343100972f7d471fe0277b3 +size 1150979 diff --git a/edit/FlowEdit/Data/Images/rabbit.png b/edit/FlowEdit/Data/Images/rabbit.png new file mode 100644 index 0000000000000000000000000000000000000000..611bba75136440631dcd479a7a87d8e0d416b141 --- /dev/null +++ b/edit/FlowEdit/Data/Images/rabbit.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9147db8e314bc01c7e3e30d005f93616a8cb5bc55f7f4468ddec9023569dc36b +size 1580280 diff --git a/edit/FlowEdit/Data/Images/rocks.png b/edit/FlowEdit/Data/Images/rocks.png new file mode 100644 index 0000000000000000000000000000000000000000..96c8093fef0e52789257df14e27595a5560bb835 --- /dev/null +++ b/edit/FlowEdit/Data/Images/rocks.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:02c2d58d392786ba366ca3d10fda91585e91bee6079c24a2c04b53837d5462c9 +size 1015964 diff --git a/edit/FlowEdit/Data/Images/rooster.png b/edit/FlowEdit/Data/Images/rooster.png new file mode 100644 index 0000000000000000000000000000000000000000..50fa081c659532eb72e5956f41cb15ea2742d33e --- /dev/null +++ b/edit/FlowEdit/Data/Images/rooster.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:eae9b029e63af0de89f8beeb06103588486beb7f4243fe9bfd5c16ed3a78ccf2 +size 1510522 diff --git a/edit/FlowEdit/Data/Images/sign.png b/edit/FlowEdit/Data/Images/sign.png new file mode 100644 index 0000000000000000000000000000000000000000..acca46530969bec784089a2a0ae2c7b4c601347a --- /dev/null +++ b/edit/FlowEdit/Data/Images/sign.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:680c4a98e56dd733e43729d4b9cf8d74852fbeaefda1934b7bb6457533ad21bb +size 999340 diff --git a/edit/FlowEdit/Data/Images/steak.png b/edit/FlowEdit/Data/Images/steak.png new file mode 100644 index 0000000000000000000000000000000000000000..e74b1c38455a47ba44f882a90f13efb937cbef6e --- /dev/null +++ b/edit/FlowEdit/Data/Images/steak.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fba767c642eb9fca67bcaf20b0f6c2f8081e4076958ffe3af4ce05ab8b1dcdff +size 1385919 diff --git a/edit/FlowEdit/Data/Images/steak_dinner.png b/edit/FlowEdit/Data/Images/steak_dinner.png new file mode 100644 index 0000000000000000000000000000000000000000..9d1556265cbdc33c38184c5a717607f280aa11ca --- /dev/null +++ b/edit/FlowEdit/Data/Images/steak_dinner.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4f1ab095161871ae560216b27dd84881fc16e8a2d1ff73ed72d7f3bd48d3c31e +size 725008 diff --git a/edit/FlowEdit/Data/Images/stop.png b/edit/FlowEdit/Data/Images/stop.png new file mode 100644 index 0000000000000000000000000000000000000000..d96d3869da7538621cf97d8ec37f0c41c0640fa6 --- /dev/null +++ b/edit/FlowEdit/Data/Images/stop.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ff2e71a4744b2b85a6bef6b982d7094e890aa31e50844798b73d4d4ec9059ac8 +size 512801 diff --git a/edit/FlowEdit/Data/Images/stop_arrow.png b/edit/FlowEdit/Data/Images/stop_arrow.png new file mode 100644 index 0000000000000000000000000000000000000000..fa038a2213b46eb3a54c4b60bea8a7691dadefe2 --- /dev/null +++ b/edit/FlowEdit/Data/Images/stop_arrow.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6d6a8653cc88d8b3f00d0c9c50219210fbf333fd6801aff5dce7a36d674bafdb +size 788180 diff --git a/edit/FlowEdit/Data/Images/stop_sticker.png b/edit/FlowEdit/Data/Images/stop_sticker.png new file mode 100644 index 0000000000000000000000000000000000000000..51cecda8c7b08083f89285fd2ae29002dd367d7c --- /dev/null +++ b/edit/FlowEdit/Data/Images/stop_sticker.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:29899fd01a6020dd433c8a31a2ad11629aab33d66a464d60dd64f16c9ed85bde +size 945722 diff --git a/edit/FlowEdit/Data/Images/this_must_be_the_place.png b/edit/FlowEdit/Data/Images/this_must_be_the_place.png new file mode 100644 index 0000000000000000000000000000000000000000..560a0e207b15d21561f9bd236af6b4033e528bb6 --- /dev/null +++ b/edit/FlowEdit/Data/Images/this_must_be_the_place.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b9f507b12a69ac77ded3529e7a18b6422ba282fae87e0b6c889632bd39423d6a +size 740020 diff --git a/edit/FlowEdit/Data/Images/tiger.png b/edit/FlowEdit/Data/Images/tiger.png new file mode 100644 index 0000000000000000000000000000000000000000..636d091a68b9908ec8851c80d3fbe05a0be52dc1 --- /dev/null +++ b/edit/FlowEdit/Data/Images/tiger.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e82c88606bb8096b0267082208c900a628c5f8440b02d040d8101f546c85e126 +size 1923251 diff --git a/edit/FlowEdit/Data/Images/tree_reflect.png b/edit/FlowEdit/Data/Images/tree_reflect.png new file mode 100644 index 0000000000000000000000000000000000000000..2a5394cdde1b236805af511c28b19361cae665d3 --- /dev/null +++ b/edit/FlowEdit/Data/Images/tree_reflect.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:70fb5e62b04a7f96e66fbc383f1921b934db0d8fe1b4b4f3cca0585e2fa610bc +size 814410 diff --git a/edit/FlowEdit/Data/Images/wolf_silhouette.png b/edit/FlowEdit/Data/Images/wolf_silhouette.png new file mode 100644 index 0000000000000000000000000000000000000000..19e3f85f29e9121158c2e50b43006b151157943d --- /dev/null +++ b/edit/FlowEdit/Data/Images/wolf_silhouette.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b2019766f1427d6fa8a6847f7320085e2f04b555ccea93441e4323ffc6b158ad +size 923497 diff --git a/edit/FlowEdit/Data/Images/yellow_bulldog.png b/edit/FlowEdit/Data/Images/yellow_bulldog.png new file mode 100644 index 0000000000000000000000000000000000000000..801a556d40390bf77bfe242535e479fb4782534c --- /dev/null +++ b/edit/FlowEdit/Data/Images/yellow_bulldog.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5968515ae012147bb10c12cc44a13a588c21b6ca81709f0fe1078912863a238b +size 1104219 diff --git a/edit/FlowEdit/Data/README.md b/edit/FlowEdit/Data/README.md new file mode 100644 index 0000000000000000000000000000000000000000..0ada25d4193097ae17e481f1f714b3603afecd78 --- /dev/null +++ b/edit/FlowEdit/Data/README.md @@ -0,0 +1,14 @@ +# FlowEdit Data + +This directory contains all the assets used in FlowEdit numerical evalutions: + +- **Images** located in the `Images` subdirectory. +- **Source and target prompts** defined in the `flowedit.yaml` file. + +These images are sourced from the [DIV2K dataset](https://data.vision.ee.ethz.ch/cvl/DIV2K/) and from the Internet, mainly from royality-free websites, including [pexels](https://www.pexels.com/), [pixabay](https://pixabay.com/) and [pxhere](https://pxhere.com/). + +**All images retain the licensing terms of their origimal sources. This dataset is intended for academic use only, and copyright remains with the original owners.** + +The `dataset.csv` file provides URLs for most of the images (listed in the same order as they appear in the `Images` subdirectory) and indicates wheter each image was sourced from DIV2K. + +The URLs points to the original images. The images included in the FlowEdit dataset (located in the `Images` subdirectory) were cropped and resized to $$1024 \times 1024$$ pixels. Resizing was perfromed using Pillow [`Image.resize`](https://pillow.readthedocs.io/en/stable/reference/Image.html#PIL.Image.Image.resize) method with its default parameters. diff --git a/edit/FlowEdit/Data/dataset.csv b/edit/FlowEdit/Data/dataset.csv new file mode 100644 index 0000000000000000000000000000000000000000..fba6fe34228f9b45f99063f07d94123dc019cd6c --- /dev/null +++ b/edit/FlowEdit/Data/dataset.csv @@ -0,0 +1,78 @@ +name,url ,dataset +bear,https://www.pexels.com/photo/bear-in-river-18991898/, +bear_grass,https://www.pexels.com/photo/bear-walking-meadow-into-wild-23502166/, +beer_glass,https://www.pexels.com/photo/close-up-of-a-glass-of-beer-4968299/, +bikes,https://commons.wikimedia.org/wiki/File:Brennan_Ehrhardt_2015_(Unsplash).jpg,div2k +boat_silhouette,https://pixabay.com/illustrations/travel-ocean-boat-island-sunset-6058120/, +brown_owl,https://www.pexels.com/photo/white-and-black-hawk-selective-focus-photography-2115984/, +bus,https://pixabay.com/photos/volkswagen-vintage-car-2590588/,div2k +butterflies,https://commons.wikimedia.org/wiki/File:Regal_butterflies_on_an_orange_flower_(Unsplash).jpg,div2k +butterly,https://www.pexels.com/photo/butterfly-perched-on-purple-flower-1067202/, +cake,https://www.pexels.com/photo/shallow-focus-of-white-icing-covered-cake-on-white-ceramic-plate-1721934/, +cake_red_blueberries,https://www.pexels.com/photo/slice-of-cake-with-blueberries-23470991/, +castle,,div2k +cat,https://www.pexels.com/photo/tabby-kitten-sitting-on-the-grass-669015/, +cat_and_dog,https://www.pexels.com/photo/dog-lying-down-and-cat-sitting-20816519/, +cat_and_dog2,https://www.pexels.com/photo/dog-and-cat-on-the-floor-4214919/, +cat_crown,https://www.pexels.com/photo/beige-cat-with-gold-colored-crown-1314550/, +cat_dog_car,https://www.pexels.com/photo/dog-next-to-a-gray-audi-a1-and-a-cat-lying-on-the-hood-18595609/, +cat_ginger,https://pixabay.com/photos/red-cat-cat-ginger-pet-belly-2248705/, +cat_stone,https://www.pexels.com/photo/black-tabby-cat-on-gray-concrete-floor-13973029/, +clown_fish,https://pxhere.com/en/photo/1270397,div2k +cocount,, +corgi,https://www.pexels.com/photo/pembroke-welsh-corgi-photography-976924/, +cupcake,https://www.pexels.com/photo/cupcake-with-pink-icing-on-white-table-10019254/, +dalmatian,https://www.pexels.com/photo/dalmatian-sitting-white-surface-933498/, +deer_silhoutte,https://pixabay.com/photos/deer-silhouettes-lake-water-2021157/, +dog,https://www.pexels.com/photo/black-and-brown-rottweiler-puppy-1307630/, +dogs,,div2k +dogs2,https://www.pexels.com/photo/purebred-dogs-in-remote-countryside-highlands-3772350/, +dog_snow,https://www.pexels.com/photo/german-shepherd-outdoors-in-snow-15279807/, +drawing_horse,https://pixabay.com/photos/illustration-a-horse-the-animal-2016288/, +duck,https://pixabay.com/photos/duck-river-swamp-water-beautiful-2591955/,div2k +flowers,,div2k +flowers_draw,, +free_wifi,https://www.pexels.com/photo/marketing-sign-internet-technology-7563691/, +gas_station,https://www.pexels.com/photo/photo-of-vehicle-on-gasoline-station-3027794/, +geese,,div2k +gray_bird,https://www.pexels.com/photo/grey-bird-perched-on-a-tree-branch-2662434/, +groceries,https://www.pexels.com/photo/bread-hand-notes-eggs-4057737/, +horse,https://www.pexels.com/photo/white-horse-on-green-grass-1996333/, +horse_silhoeutte,https://pxhere.com/en/photo/1458157, +iguana,https://www.pexels.com/photo/orange-iguana-standing-on-rocks-1190690/, +japanese_castle,https://commons.wikimedia.org/wiki/File:Himeji_Castle_Keep_Tower_after_restoration_2014.jpg,div2k +jump_kick,https://www.pexels.com/photo/woman-wearing-white-karati-g-under-blue-sky-3023756/, +jump_yay,https://www.pexels.com/photo/low-angle-photography-of-man-jumping-2923156/, +kid_running,https://www.pexels.com/photo/boy-running-during-sunset-1416736/, +lighthouse,,div2k +luna,https://www.pexels.com/photo/luna-neon-signage-on-top-of-building-entrance-1528348/, +meditation,https://www.pexels.com/photo/woman-doing-yoga-inside-a-room-3094215/, +meditation2,https://www.pexels.com/photo/man-meditating-under-rock-1241348/, +milk,https://www.pexels.com/photo/photo-of-glass-of-milk-on-table-1675976/, +mountain_black,https://www.pexels.com/photo/maelifell-volcano-on-iceland-27244376/, +muffins,https://www.pexels.com/photo/tasty-dessert-served-on-plate-with-raspberry-6025814/, +parrot,https://www.pexels.com/photo/blue-orange-and-green-parrot-resting-on-brown-branch-53104/, +parrot2,https://www.pexels.com/photo/blue-orange-and-green-bird-on-yellow-flower-105808/, +parrots,https://www.pexels.com/photo/zoologico-27202409/, +parrots2,https://www.pexels.com/photo/zoologico-27202409/, +penguings,,div2k +piece_of_cake,https://www.pexels.com/photo/slice-cake-1854652/, +pizza,https://www.pexels.com/photo/wooden-platter-with-freshly-baked-khachapuri-17849431/, +pizza_board,https://www.pexels.com/photo/photo-of-pizza-on-wooden-board-10341047/, +pizza_slice,https://www.pexels.com/photo/woman-hand-holding-pizza-slice-18437688/, +pizza_tomato_olive,https://www.pexels.com/photo/delicious-pizza-with-black-olive-and-cherry-tomato-slices-6493112/, +puppies,https://www.pexels.com/photo/two-yellow-labrador-retriever-puppies-1108099/, +rabbit,https://www.pexels.com/photo/white-and-brown-rabbit-on-green-grass-field-372166/, +rocks,https://www.pexels.com/photo/pile-of-rock-near-lake-355863/, +rooster,https://commons.wikimedia.org/wiki/File:Junglefowl_on_tree.jpg,div2k +sign,https://www.pexels.com/photo/love-is-all-you-need-signage-788662/, +steak,https://www.pexels.com/photo/shallow-focus-photography-of-meat-dish-and-leaves-1251208/, +steak_dinner,https://www.pexels.com/photo/sliced-steak-on-plate-299348/, +stop,https://www.pexels.com/photo/red-stop-sign-39080/, +stop_arrow,https://www.pexels.com/photo/road-signs-12274676/, +stop_stikcer,https://www.pexels.com/photo/red-and-yellow-stop-sticker-1749900/, +this_must_be_the_place,https://www.pexels.com/photo/photo-of-led-signage-on-the-wall-942317/, +tiger,,div2k +tree_reflect,https://pxhere.com/en/photo/711470, +wolf_silhouette,https://pixabay.com/illustrations/wolf-wolves-moonlight-animal-black-3691971/, +yellow_buldog,https://www.pexels.com/photo/yellow-figurine-bulldog-7186448/, diff --git a/edit/FlowEdit/Data/flowedit.yaml b/edit/FlowEdit/Data/flowedit.yaml new file mode 100644 index 0000000000000000000000000000000000000000..73f31e84243e925a3f1eb814de2440e0f2f524c6 --- /dev/null +++ b/edit/FlowEdit/Data/flowedit.yaml @@ -0,0 +1,1340 @@ +- + init_img: flowedit_data/bear.png + + source_prompt: A large brown bear walking through a stream of water. + The stream appears to be shallow, as the bear is able to walk through it without any difficulty. + + target_prompts: + - A large black bear walking through a stream of water. The stream appears to be shallow, as the black bear is able to walk through it without any difficulty. + - A large panda bear walking through a stream of water. The stream appears to be shallow, as the panda bear is able to walk through it without any difficulty. + - A large polar bear walking through a stream of water. The stream appears to be shallow, as the polar bear is able to walk through it without any difficulty. + - A large sculpture of a brown bear walking through a stream of water. The stream appears to be shallow, as the sculpture of the bear is able to walk through it without any difficulty. + + target_codes: + - 1_black_bear + - 2_panda_bear + - 3_polar_bear + - 4_sculpture + +- + + init_img: flowedit_data/bear_grass.png + source_prompt: A large brown bear walking through a grassy field. + + target_prompts: + - A large black bear walking through a grassy field. + - A large panda bear walking through a grassy field. + - A large polar bear walking through a grassy field. + - A large sculpture of a brown bear walking through a grassy field. + - A large lion walking through a grassy field. + - A large tiger walking through a grassy field. + + target_codes: + - 1_black_bear + - 2_panda_bear + - 3_polar_bear + - 4_sculpture + - 5_lion + - 6_tiger + +- + + init_img: flowedit_data/beer_glass.png + source_prompt: A wine glass filled with beer. + + target_prompts: + - A wine glass filled with a vibrant red cocktail, garnished with an orange wedge. + + target_codes: + - 1_cocktail + +- + + init_img: flowedit_data/bikes.png + source_prompt: A bicycle parked on the sidewalk in front of a red brick building. + The bicycle is positioned close to the door of the building, making + it easily accessible for the owner. The building has a red brick exterior, giving + it a distinctive appearance. + + target_prompts: + - A motorcycle parked on the sidewalk in front of a red brick building. + The motorcycle is positioned close to the door of the building, making + it easily accessible for the owner. The building has a red brick exterior, giving + it a distinctive appearance. + - A scooter parked on the sidewalk in front of a red brick building. + The scooter is positioned close to the door of the building, making + it easily accessible for the owner. The building has a red brick exterior, giving + it a distinctive appearance. + - A harley davidson motorcycle parked on the sidewalk in front of a red brick building. + The harley davidson motorcycle is positioned close to the door of the building, making + it easily accessible for the owner. The building has a red brick exterior, giving + it a distinctive appearance. + - A vespa scooter parked on the sidewalk in front of a red brick building. + The vespa scooter is positioned close to the door of the building, making + it easily accessible for the owner. The building has a red brick exterior, giving + it a distinctive appearance. + - A green bicycle parked on the sidewalk in front of a red brick building. + The bicycle is positioned close to the door of the building, making + it easily accessible for the owner. The building has a red brick exterior, giving + it a distinctive appearance. + - A yellow bicycle parked on the sidewalk in front of a red brick building. + The bicycle is positioned close to the door of the building, making + it easily accessible for the owner. The building has a red brick exterior, giving + it a distinctive appearance. + + target_codes: + - 1_motorcycle + - 2_scooter + - 3_harley_davidson + - 4_vespa + - 5_green_bicycle + - 6_yellow_bicycle + +- + + init_img: flowedit_data/boat_silhouette.png + source_prompt: A serene scene of a lake with a silhouette of a sailboat floating on the water. + The silhouette of the boat is positioned in the middle of the lake, slightly to the left. The sun is setting in the background, casting a warm glow over the scene. + + target_prompts: + - A serene scene of a lake with a sailboat floating on the water. The sailboat has white sails and red hull. + The boat is positioned in the middle of the lake, slightly to the left. The sun is setting in the background, casting a warm glow over the scene. + - A serene scene of a lake with a silhouette of a paper boat floating on the water. + The silhouette of the paper boat is positioned in the middle of the lake, slightly to the left. The sun is setting in the background, casting a warm glow over the scene. + + target_codes: + - 1_sailboat_white_sails_red_hull + - 2_paper_boat + +- + + init_img: flowedit_data/brown_owl.png + source_prompt: A small, brown owl standing on a patch of grass. + + target_prompts: + - A small, white owl standing on a patch of grass. + - A small glass sculpture of a brown owl standing on a patch of grass. + - A small origami owl standing on a patch of grass. + - A pigeon standing on a patch of grass. + + target_codes: + - 1_white_owl + - 2_glass_sculpture + - 3_origami_owl + - 4_pigeon + +- + + init_img: flowedit_data/bus.png + source_prompt: A yellow van parked in front of a house, outside a garage. The van is of a classic model. The house has a brown exterior, and there is a tree nearby. There is a spare tire hanged between the headlights of the van. + + target_prompts: + - A SUV parked in front of a house, outside a garage. The SUV is of a modern model, possibly electric. The house has a brown exterior, and there is a tree nearby. + - A yellow van parked in front of a house, outside a garage. The van is of a classic model. The house has a brown exterior, and there is a tree nearby. There is a big Volkswagen logo on the front of the van, between its headlights. + - A pink van parked in front of a house, outside a garage. The van is of a classic model. The house has a brown exterior, and there is a tree nearby. There is a spare tire hanged between the headlights of the van. + - A military jeep parked in front of a house, outside a garage. The van is of a classic model. The house has a brown exterior, and there is a tree nearby.There is a spare tire hanged between the headlights of the van. + + target_codes: + - 1_SUV + - 2_volkswagen_logo + - 3_pink_van + - 4_military_jeep + +- + init_img: flowedit_data/butterflies.png + source_prompt: A vibrant orange flower with two black and white + butterflies perched on it. The butterflies are positioned on opposite sides of the + flower, with one butterfly on the left side and the other on the right side. The + butterflies appear to be resting or possibly feeding on the flower, creating a captivating + scene. + + target_prompts: + - A vibrant orange flower with two yellow + butterflies perched on it. The butterflies are positioned on opposite sides of the + flower, with one butterfly on the left side and the other on the right side. The + butterflies appear to be resting or possibly feeding on the flower, creating a captivating + scene. + + target_codes: + - 1_yellow + +- + + init_img: flowedit_data/butterfly.png + source_prompt: A beautiful purple flower with a white and black butterfly perched on top of it. The butterfly is positioned towards the left side of the flower. + + target_prompts: + - A beautiful purple flower with an orange butterfly perched on top of it. The butterfly is positioned towards the right side of the flower. + - A beautiful red flower with a white and black butterfly perched on top of it. The butterfly is positioned towards the right side of the flower. + - A beautiful purple flower with a hummingbird perched on top of it. The hummingbird is positioned towards the right side of the flower. + + target_codes: + - 1_orange_butterfly + - 2_red_flower + - 3_hummingbird + +- + + init_img: flowedit_data/cake.png + source_prompt: A three-layer cake with white frosting, placed on a wooden table. The cake is adorned with a variety of fruits. The cake is presented on a white plate. + + target_prompts: + - A three-layer cake with white frosting, placed on a wooden table. The cake is adorned with a variety of berries. The cake is presented on a white plate. + - A three-layer cake with chocolate frosting, placed on a wooden table. The cake is adorned with a variety of berries. The cake is presented on a white plate. + - A three-layer wedding cake with white frosting, placed on a wooden table. The cake is presented on a white plate. + - A three-layer wedding cake with white frosting, placed on a wooden table. The cake is adorned with a lot of strawberries. The cake is presented on a white plate. + + target_codes: + - 1_berries + - 2_chocolate_berries + - 3_wedding_cake + - 4_strawberries + +- + + init_img: flowedit_data/cake_red_blueberries.png + source_prompt: A slice of red velvet cake with white frosting, topped with blueberries. + + target_prompts: + - A slice of chocolate cake with white frosting, topped with blueberries. + - A slice of red velvet cake with white frosting, topped with raspberries. + + target_codes: + - 1_chocolate + - 2_raspberries + +- + + init_img: flowedit_data/castle.png + source_prompt: A majestic castle with a tall, pointed roof, situated on a hillside. The sky above the castle is filled with clouds, creating a dramatic atmosphere. + There are several windows on the castle, with some located on the lower levels and others on the upper levels. + + target_prompts: + - A majestic castle made out of lego bricks with a tall, pointed roof, situated on a hillside. The sky above the lego castle is filled with clouds, creating a dramatic atmosphere. + There are several windows on the lego castle, with some located on the lower levels and others on the upper levels. + + target_codes: + - 1_lego_castle + +- + init_img: flowedit_data/cat_and_dog.png + source_prompt: A dog and a cat sitting together on a sidewalk. The dog is positioned on the left side of the scene, while the cat is on the right side. Both animals appear to be relaxed and enjoying each other''s company. + + target_prompts: + - A dog and a cat made out of lego sitting together on a sidewalk. The lego dog is positioned on the left side of the scene, while the lego cat is on the right side. Both animals appear to be relaxed and enjoying each other''s company. + - A bronze sculpture of a dog and a cat sitting together on a sidewalk. The dog is positioned on the left side of the scene, while the cat is on the right side. Both animals appear to be relaxed and enjoying each other''s company. + + target_codes: + - 1_lego + - 2_bronze + +- + + init_img: flowedit_data/cat_and_dog2.png + source_prompt: A gray cat and a brown dog on a floor, some distance between them. The dog is laying on the floor, while the cat is sitting. + The cat is positioned on the left side of the scene, while the dog is on the right side. Both pets looking at the camera. + + target_prompts: + - A tiger and a brown dog on a floor, some distance between them. The dog is laying on the floor, while the tiger is sitting. + The tiger is positioned on the left side of the scene, while the dog is on the right side. Both animals looking at the camera. + - A raccoon and a brown dog on a floor, some distance between them. The dog is laying on the floor, while the raccoon is sitting. + The raccoon is positioned on the left side of the scene, while the dog is on the right side. Both animals looking at the camera. + - A koala and a brown dog on a floor, some distance between them. The dog is laying on the floor, while the koala is sitting. + The koala is positioned on the left side of the scene, while the dog is on the right side. Both animals looking at the camera. + - A red panda and a brown dog on a floor, some distance between them. The dog is laying on the floor, while the red panda is sitting. + The red panda is positioned on the left side of the scene, while the dog is on the right side. Both animals looking at the camera. + - A tiger and a brown bear on a floor, some distance between them. The bear is laying on the floor, while the tiger is sitting. + The tiger is positioned on the left side of the scene, while the bear is on the right side. Both animals looking at the camera. + - A lion and a brown bear on a floor, some distance between them. The bear is laying on the floor, while the lion is sitting. + The lion is positioned on the left side of the scene, while the bear is on the right side. Both animals looking at the camera. + + target_codes: + - 1_tiger_dog + - 2_raccoon_dog + - 3_koala_dog + - 4_red_panda_dog + - 5_tiger_bear + - 6_lion_bear + +- + + init_img: flowedit_data/cat_crown.png + source_prompt: A gray cat sitting on a black cloth, wearing a crown. The crown is placed on the cat''s head. + + target_prompts: + - A gray cat sitting on a black cloth, wearing a top hat. The top hat is placed on the cat''s head. + - A lioness sitting on a black cloth, wearing a top hat. The top hat is placed on the lioness'' head. + - A rabbit sitting on a black cloth, wearing a top hat. The top hat is placed on the rabbit''s head. + + target_codes: + - 1_black_top_hat + - 2_lioness_top_hat + - 3_rabbit_top_hat + +- + + init_img: flowedit_data/cat.png + source_prompt: A small, fluffy kitten sitting in a grassy field. The kitten is positioned in the center of the scene, surrounded by a field. + The kitten appears to be looking at something in the field. + + target_prompts: + - A small puppy sitting in a grassy field. The puppy is positioned in the center of the scene, surrounded by a field. + The puppy appears to be looking at something in the field. + - A small lion cub sitting in a grassy field. The lion cub is positioned in the center of the scene, surrounded by a field. + The lion cub appears to be looking at something in the field. + - A small tiger cub sitting in a grassy field. The tiger cub is positioned in the center of the scene, surrounded by a field. + The tiger cub appears to be looking at something in the field. + - A small bear cub sitting in a grassy field. The bear cub is positioned in the center of the scene, surrounded by a field. + The bear cub appears to be looking at something in the field. + - A small fluffy fox sitting in a grassy field. The small fox is positioned in the center of the scene, surrounded by a field. + The small appears to be looking at something in the field. + - A small, fluffy poodle puppy sitting in a grassy field. The poodle puppy is positioned in the center of the scene, surrounded by a field. + The poodle puppy appears to be looking at something in the field. + - A small wooden sculpture of a kitten sitting in a grassy field. The wooden sculpture of a kitten is positioned in the center of the scene, surrounded by a field. + The wooden sculpture of a kitten appears to be looking at something in the field. + + + target_codes: + - 1_puppy + - 2_lion_cub + - 3_tiger_cub + - 4_bear_cub + - 5_fox + - 6_poodle_puppy + - 7_wooden_sculpture + +- + + init_img: flowedit_data/cat_dog_car.png + source_prompt: A blue-gray Audi car parked in a grassy area. A white dog sitting on the grass, next to the car. A cat laying on the hood of the car. + + target_prompts: + - A blue-gray Audi car parked in a grassy area. A Husky dog sitting on the grass, next to the car. A tiger cab laying on the hood of the car. + - A blue-gray Audi car parked in a grassy area. A Husky dog sitting on the grass, next to the car. A lion cab laying on the hood of the car. + - A blue-gray Audi car parked in a grassy area. A gray wolf sitting on the grass, next to the car. A tiger cab laying on the hood of the car. + - A blue-gray Audi car parked in a grassy area. A gray wolf sitting on the grass, next to the car. A lion cab laying on the hood of the car. + - A blue-gray Audi car parked in a grassy area. A Dalmatian dog sitting on the grass, next to the car. A tiger cab laying on the hood of the car. + - A blue-gray Audi car parked in a grassy area. A Dalmatian dog sitting on the grass, next to the car. A lion cab laying on the hood of the car. + - A blue-gray Audi car parked in a grassy area. A Dalmatian dog sitting on the grass, next to the car. + - A blue-gray Audi car parked in a grassy area. A Husky dog sitting on the grass, next to the car. + - A blue-gray Audi car parked in a grassy area. A wolf sitting on the grass, next to the car. + + target_codes: + - 1_husky_tiger + - 2_husky_lion + - 3_wolf_tiger + - 4_wolf_lion + - 5_dalmatian_tiger + - 6_dalmatian_lion + - 7_dalmatian_no_cat + - 8_husky_no_cat + - 9_wolf_no_cat + +- + + init_img: flowedit_data/cat_ginger.png + source_prompt: An orange and white cat sitting. + + target_prompts: + - A silver cat sculpture. + - A tiger sitting. + + target_codes: + - 1_silver + - 2_tiger + +- + + init_img: flowedit_data/cat_stone.png + source_prompt: A small gray kitten sitting on a stone ledge. The ledge is located near a wall, and there is a cement block nearby. + + target_prompts: + - A small black kitten sitting on a stone ledge. The ledge is located near a wall, and there is a cement block nearby. + - A small puppy sitting on a stone ledge. The ledge is located near a wall, and there is a cement block nearby. + - A small sculpture of a kitten sitting on a stone ledge. The ledge is located near a wall, and there is a cement block nearby. + - A small tiger sitting on a stone ledge. The ledge is located near a wall, and there is a cement block nearby. + - A small lion sitting on a stone ledge. The ledge is located near a wall, and there is a cement block nearby. + - A small pig sitting on a stone ledge. The ledge is located near a wall, and there is a cement block nearby. + + target_codes: + - 1_black_kitten + - 2_puppy + - 3_sculpture + - 4_tiger + - 5_lion + - 6_pig + +- + + init_img: flowedit_data/clown_fish.png + source_prompt: A vibrant underwater scene with a clownfish swimming among various coral reefs. The clownfish is positioned towards the left side of the image, surrounded by a diverse array of coral and sea plants. + + target_prompts: + - A vibrant underwater scene with a goldfish swimming among various coral reefs. The goldfish is positioned towards the left side of the image, surrounded by a diverse array of coral and sea plants. + - A vibrant underwater scene with a small sea turtle swimming among various coral reefs. The small sea turtle is positioned towards the left side of the image, surrounded by a diverse array of coral and sea plants. + - A vibrant underwater scene with a shark swimming among various coral reefs. The shark is positioned towards the left side of the image, surrounded by a diverse array of coral and sea plants. + - A vibrant underwater scene with a seahorse swimming among various coral reefs. The seahorse is positioned towards the left side of the image, surrounded by a diverse array of coral and sea plants. + + target_codes: + - 1_goldfish + - 2_sea_turtle + - 3_shark + - 4_seahorse + +- + init_img: flowedit_data/coconut.png + source_prompt: The image features a coconut shell filled with water, creating a unique and artistic scene. The water in the coconut shell is splashing, adding to the visual appeal. The coconut shell is placed on a table, next to an apple. + + target_prompts: + - The image features a human head filled with water, creating a unique and artistic scene. The water in the human head is splashing, adding to the visual appeal. The human head is placed on a table, next to an apple. + - The image features a baseball filled with water, creating a unique and artistic scene. The water in the baseball is splashing, adding to the visual appeal. The baseball is placed on a table, next to an apple. + - The image features a giant cup filled with water, creating a unique and artistic scene. The water in the giant cup is splashing, adding to the visual appeal. The giant cup is placed on a table, next to an apple. + + target_codes: + - 1_head + - 2_baseball + - 3_cup + +- + + init_img: flowedit_data/corgi.png + source_prompt: A brown and white dog sitting on a dirt ground near a body of water. The dog appears to be enjoying the outdoors, possibly in a park. + The dog is wearing a red collar. In the background, there are a few trees, providing a natural setting for the dog''s outdoor adventure. + + target_prompts: + - A brown and white dog made out of lego bricks sitting on a dirt ground near a body of water. The dog appears to be enjoying the outdoors, possibly in a park. + The dog is wearing a red collar. In the background, there are a few trees, providing a natural setting for the dog''s outdoor adventure. + - A wooden sculpture of a brown and white dog made sitting on a dirt ground near a body of water. The wooden sculpture of a dog appears to be enjoying the outdoors, possibly in a park. + In the background, there are a few trees, providing a natural setting for the wooden sculpture''s outdoor adventure. + - A red fox sitting on a dirt ground near a body of water. The fox appears to be enjoying the outdoors, possibly in a park. The fox is wearing a red collar. + In the background, there are a few trees, providing a natural setting for the fox''es outdoor adventure. + + target_codes: + - 1_lego_bricks + - 2_wooden_sculpture + - 3_red_fox + +- + + init_img: flowedit_data/cupcake.png + source_prompt: A small chocolate cupcake with light brown whipped cream on top. + + target_prompts: + - A small vanilla cupcake with whipped cream on top. + - A small red velvet cupcake with whipped cream on top. + + target_codes: + - 1_vanilla + - 2_red_velvet + +- + + init_img: flowedit_data/dalmatian.png + source_prompt: A Dalmatian dog sitting on a white background. The dog is wearing a bandana, which adds a touch of color to the scene. + The dog is looking up, possibly at something interesting or engaging, with its mouth open. + + target_prompts: + - A Dalmatian dog sitting on a white background. The dog is wearing a bandana, which adds a touch of color to the scene. The dog is looking to the camera. + - A cheetah sitting on a white background. The cheetah is wearing a bandana, which adds a touch of color to the scene. The cheetah is looking to the camera. + - A crochet Dalmatian dog sitting on a white background. The crochet dog is wearing a bandana, which adds a touch of color to the scene. The crochet dog is looking to the camera. + + target_codes: + - 1_looking_camera + - 2_cheetah_looking_camera + - 3_crochet_dog_looking_camera + +- + + init_img: flowedit_data/deer_silhouette.png + source_prompt: A silhouette of a deer standing on a grassy bank near a lake. The scene is set during sunset, with the sun casting a warm glow over it. + + target_prompts: + - A silhouette of a male deer with beautiful antlers standing on a grassy bank near a lake. The scene is set during sunset, with the sun casting a warm glow over it. + + target_codes: + - 1_male_deer_antlers + +- + + init_img: flowedit_data/dog.png + source_prompt: A small black and brown dog sitting on a lush green field. + + target_prompts: + - A small black and brown dog standing on a lush green field. + - A small black and brown dog puppet sitting on a lush green field. + - A small black and brown crochet dog sitting on a lush green field. + - A small black and brown sculpture of a dog sitting on a lush green field. + - A small black and brown dog made out of lego bricks sitting on a lush green field. + - A small black and brown dog sitting on a lush green field. The dog is wearing a red top hat. + - A small black and brown dog sitting on a lush green field. The dog is wearing a jeweled crown. + - A small black and brown poodle sitting on a lush green field. + + target_codes: + - 1_standing + - 2_puppet + - 3_crochet + - 4_sculpture + - 5_lego_bricks + - 6_red_top_hat + - 7_jeweled_crown + - 8_poodle + +- + + init_img: flowedit_data/dog_snow.png + source_prompt: A German Shepherd dog standing in a snowy field. + + target_prompts: + - A wooden sculpture of a dog standing in a snowy field. + - A wolf standing in a snowy field. + - A fox standing in a snowy field. + - A Husky dog standing in a snowy field. + - A Golden Retriever dog standing in a snowy field. + - A bear standing in a snowy field. + - A baby deer standing in a snowy field. + + target_codes: + - 1_wooden_sculpture + - 2_wolf + - 3_fox + - 4_husky + - 5_golden + - 6_bear + - 7_baby_deer + +- + init_img: flowedit_data/dogs.png + source_prompt: Two dingo dogs standing close to each other in a wooded area. They appear to be sniffing each other, possibly engaging in a playful interaction. + + + target_prompts: + - Two red foxes standing close to each other in a wooded area. They appear to be sniffing each other, possibly engaging in a playful interaction. + - Two wolves standing close to each other in a wooded area. They appear to be sniffing each other, possibly engaging in a playful interaction. + - Two Huskies standing close to each other in a wooded area. They appear to be sniffing each other, possibly engaging in a playful interaction. + + target_codes: + - 1_red_foxes + - 2_wolves + - 3_huskies + +- + + init_img: flowedit_data/dogs2.png + source_prompt: Two dogs standing on a grassy hillside. One dog positioned to the right of the other. This dog has light brown spots on his face, legs and tail. + + target_prompts: + - Two wolves standing on a grassy hillside. One wolf positioned to the right of the other. + + target_codes: + - 1_wolf + +- + + init_img : flowedit_data/drawing_horse.png + source_prompt: A black and white sketch of a horse, showcasing its grace and beauty. The horse is positioned in the center of the image, with its head slightly tilted to the left. + + target_prompts: + - A black and white sketch of a unicorn, showcasing its grace and beauty. The unicorn is positioned in the center of the image, with its head slightly tilted to the left. + + target_codes: + - 1_unicorn + +- + + init_img: flowedit_data/duck.png + source_prompt: A brown duck swimming in a lake. The duck is floating on the surface of the water, surrounded by a few ripples. The duck is preening its feathers. + The scene is set against a black background, which emphasizes the duck''s presence in the water. + + target_prompts: + - A colorful duck swimming in a lake. The duck is floating on the surface of the water, surrounded by a few ripples. + The scene is set against a black background, which emphasizes the duck''s presence in the water. + - A black swan swimming in a lake. The black swan is floating on the surface of the water, surrounded by a few ripples. The black swan is preening its feathers. + The scene is set against a black background, which emphasizes the black swan''s presence in the water. + - A white swan swimming in a lake. The white swan is floating on the surface of the water, surrounded by a few ripples. + The scene is set against a black background, which emphasizes the white swan''s presence in the water. + - A goose swimming in a lake. The goose is floating on the surface of the water, surrounded by a few ripples. The goose is preening its feathers. + The scene is set against a black background, which emphasizes the goose''s presence in the water. + + target_codes: + - 1_colorful_duck + - 2_black_swan + - 3_white_swan + - 4_goose + +- + + init_img: flowedit_data/flowers_draw.png + + source_prompt: A painting of three red flowers, each with a long stem. The painting is done in watercolor, giving it a vibrant appearance + + target_prompts: + - A painting of three sunflowers, each with a long stem. The painting is done in watercolor, giving it a vibrant appearance + - A painting of three tulips, each with a long stem. The painting is done in watercolor, giving it a vibrant appearance + + target_codes: + - 1_sunflowers + - 2_tulips + +- + + init_img: flowedit_data/flowers.png + source_prompt: A vase filled with a beautiful bouquet of pink, red and white flowers. + + target_prompts: + - A vase filled with a beautiful bouquet of orange, yellow and white flowers. + - A vase filled with a beautiful bouquet of blue, purple and white flowers. + + target_codes: + - 1_orange_yellow_white + - 2_blue_purple_white + +- + + init_img: flowedit_data/free_wifi.png + source_prompt: A wooden table with a black board on it. The board displays the words "FREE WIFI" in white letters. The table is positioned in the center of the scene, and the board is placed on top of it. + + target_prompts: + - A wooden table with a black board on it. The board displays the words "FREE BEER" in white letters. The table is positioned in the center of the scene, and the board is placed on top of it. + - A wooden table with a black board on it. The board displays the words "FREE HUGS" in white letters. The table is positioned in the center of the scene, and the board is placed on top of it. + + + target_codes: + - 1_free_beer + - 2_free_hugs + +- + + init_img: flowedit_data/gas_station.png + source_prompt: A gas station with a white and red sign that reads "CAFE" There are several cars parked in front of the gas station, including a white car and a van. + + target_prompts: + - A gas station with a white and red sign that reads "CVPR" There are several cars parked in front of the gas station, including a white car and a van. + - A gas station with a white and red sign that reads "ICCV" There are several cars parked in front of the gas station, including a white car and a van. + - A gas station with a white and red sign that reads "ECCV" There are several cars parked in front of the gas station, including a white car and a van. + - A gas station with a white and red sign that reads "FOOD" There are several cars parked in front of the gas station, including a white car and a van. + - A gas station with a white and red sign that reads "LOVE" There are several cars parked in front of the gas station, including a white car and a van. + - A gas station with a white and red sign that reads "FREE" There are several cars parked in front of the gas station, including a white car and a van. + + target_codes: + - 1_cvpr + - 2_iccv + - 3_eccv + - 4_food + - 5_love + - 6_free + +- + + init_img: flowedit_data/geese.png + source_prompt: A flock of geese flying together in the sky. There are several geese, spread across the scene, with some flying higher and others lower. The geese are flying in a cloudy sky. + + target_prompts: + - A flock of ducks flying together in the sky. There are several ducks, spread across the scene, with some flying higher and others lower. The ducks are flying in a cloudy sky. + - A flock of swans flying together in the sky. There are several swans, spread across the scene, with some flying higher and others lower. The swans are flying in a cloudy sky. + - A flock of flamingos flying together in the sky. There are several flamingos, spread across the scene, with some flying higher and others lower. The flamingos are flying in a cloudy sky. + + target_codes: + - 1_ducks + - 2_swans + - 3_flamingos + +- + + init_img: flowedit_data/gray_bird.png + source_prompt: A small blue and gray bird perched on a wooden fence or post. The bird is positioned towards the left side of the image + + target_prompts: + - A small blue and gray origami bird perched on a wooden fence or post. The origami bird is positioned towards the left side of the image + - A small red and gray bird perched on a wooden fence or post. The bird is positioned towards the left side of the image + - A small sculpture of a blue and gray bird perched on a wooden fence or post. The sculpture is positioned towards the left side of the image + - A small golden sculpture of a bird perched on a wooden fence or post. The golden sculpture is positioned towards the left side of the image + + target_codes: + - 1_origami_bird + - 2_red_bird + - 3_sculpture + - 4_golden_sculpture + +- + + init_img: flowedit_data/groceries.png + source_prompt: A grocery list writing on a piece of brown paper with a black marker, which includes BREAD, EGGS, and MILK. The grocery list is attached to a wall or refrigerator with a magnet. + The magnet is red and white, possibly in the shape of a phone booth in London. + + target_prompts: + - A grocery list writing on a piece of brown paper with a black marker, which includes BACON, BREAD, EGGS, and MILK. The grocery list is attached to a wall or refrigerator with a magnet. + The magnet is red and white, possibly in the shape of a phone booth in London. + - A grocery list writing on a piece of brown paper with a black marker, which includes BREAD, COFFEE, and MILK. The grocery list is attached to a wall or refrigerator with a magnet. + The magnet is red and white, possibly in the shape of a phone booth in London. + - A grocery list writing on a piece of brown paper with a black marker, which includes CVPR, EGGS, and MILK. The grocery list is attached to a wall or refrigerator with a magnet. + The magnet is red and white, possibly in the shape of a phone booth in London. + - A grocery list writing on a piece of brown paper with a black marker, which includes ECCV, EGGS, and MILK. The grocery list is attached to a wall or refrigerator with a magnet. + The magnet is red and white, possibly in the shape of a phone booth in London. + - A grocery list writing on a piece of brown paper with a black marker, which includes ICCV, EGGS, and MILK. The grocery list is attached to a wall or refrigerator with a magnet. + The magnet is red and white, possibly in the shape of a phone booth in London. + + target_codes: + - 1_bacon + - 2_coffee + - 3_cvpr + - 4_eccv + - 5_iccv + +- + + init_img: flowedit_data/horse_silhouette.png + source_prompt: A black silhouette of a horse, showcasing its elegant and powerful form. The horse is captured in motion, with its front legs raised and its head held high. + + target_prompts: + - A black silhouette of a unicorn, showcasing its elegant and powerful form. The unicorn is captured in motion, with its front legs raised and its head held high. + + target_codes: + - 1_unicorn + +- + + init_img: flowedit_data/horse.png + source_prompt: A white horse running through a grassy field. The horse appears to be galloping, creating a sense of motion and energy in the image. + The field is surrounded by a forest, with trees visible in the background. The overall atmosphere of the scene is lively and dynamic, capturing the horse''s freedom and grace as it moves through the natural environment. + + target_prompts: + - A white unicorn running through a grassy field. The unicorn appears to be galloping, creating a sense of motion and energy in the image. + The field is surrounded by a forest, with trees visible in the background. The overall atmosphere of the scene is lively and dynamic, capturing the unicorn''s freedom and grace as it moves through the natural environment. + - A pink toy horse running through a grassy field. The pink toy horse appears to be galloping, creating a sense of motion and energy in the image. + The field is surrounded by a forest, with trees visible in the background. The overall atmosphere of the scene is lively and dynamic, capturing the pink toy horse''s freedom and grace as it moves through the natural environment. + - A sculpture bronze horse running through a grassy field. The horse appears to be galloping, creating a sense of motion and energy in the image. + The field is surrounded by a forest, with trees visible in the background. The overall atmosphere of the scene is lively and dynamic, capturing the horse''s freedom and grace as it moves through the natural environment. + - A brown horse running through a grassy field. The horse appears to be galloping, creating a sense of motion and energy in the image. + The field is surrounded by a forest, with trees visible in the background. The overall atmosphere of the scene is lively and dynamic, capturing the horse''s freedom and grace as it moves through the natural environment. + + target_codes: + - 1_unicorn + - 2_pink_toy_horse + - 3_bronze_sculpture + - 4_brown_horse + +- + + init_img: flowedit_data/iguana.png + source_prompt: A large orange lizard sitting on a rock near the ocean. The lizard is positioned in the center of the scene, with the ocean waves visible in the background. The rock is located close to the water, providing a picturesque setting for the lizard''s resting spot. + + target_prompts: + - A large green lizard sitting on a rock near the ocean. The green lizard is positioned in the center of the scene, with the ocean waves visible in the background. The rock is located close to the water, providing a picturesque setting for the green lizard''s resting spot. + - A large blue lizard sitting on a rock near the ocean. The blue lizard is wearing a top hat. The blue lizard is positioned in the center of the scene, with the ocean waves visible in the background. The rock is located close to the water, providing a picturesque setting for the blue lizard''s resting spot. + - A large frog sitting on a rock near the ocean. The frog is positioned in the center of the scene, with the ocean waves visible in the background. The rock is located close to the water, providing a picturesque setting for the frog''s resting spot. + - A large crocodile sitting on a rock near the ocean. The crocodile is positioned in the center of the scene, with the ocean waves visible in the background. The rock is located close to the water, providing a picturesque setting for the crocodile''s resting spot. + - A large dragon sitting on a rock near the ocean. The dragon is positioned in the center of the scene, with the ocean waves visible in the background. The rock is located close to the water, providing a picturesque setting for the dragon''s resting spot. + + target_codes: + - 1_green_lizard + - 2_blue_lizard_top_hat + - 3_frog + - 4_crocodile + - 5_dragon + +- + + init_img: flowedit_data/japanese_castle.png + source_prompt: A large, white, Japanese castle with a distinctive pagoda-style roof. The castle is surrounded by green trees. The castle is situated on a hill, giving it a majestic appearance. + + target_prompts: + - A large, white, Japanese castle made out of lego bricks with a distinctive pagoda-style roof. The lego castle is surrounded by green trees, creating a serene and picturesque scene. The lego castle is situated on a hill, giving it a majestic appearance. + + target_codes: + - 1_lego_castle + +- + + init_img: flowedit_data/jump_kick.png + + source_prompt: A woman in a white uniform, kicking in the air. She appears to be in the middle of a karate kick, showcasing her skill and agility. The scene takes place outdoors, in a park. + + target_prompts: + - A shiny silver humanoid robot kicking in the air. It appears to be in the middle of a karate kick, showcasing its skill and agility. The scene takes place outdoors, in a park. + - A bronze statue of a woman kicking in the air. It appears to be in the middle of a karate kick, showcasing her skill and agility. The scene takes place outdoors, in a park. + - A golden sculpture of a woman kicking in the air. It appears to be in the middle of a karate kick, showcasing her skill and agility. The scene takes place outdoors, in a park. + - A marble statue of a woman kicking in the air. It appears to be in the middle of a karate kick, showcasing her skill and agility. The scene takes place outdoors, in a park. + + target_codes: + - 1_robot + - 2_bronze_statue + - 3_golden_statue + - 4_marble_statue + +- + + init_img: flowedit_data/jump_yay.png + + source_prompt: A man wearing a white shirt and black shorts, jumping in the air with his left arm raised. He appears to be enjoying the moment and is smiling. The background consists of a cloudy sky, which adds to the overall atmosphere of the scene. + + target_prompts: + - A shiny silver humanoid robot jumping in the air with its left arm raised. It appears to be enjoying the moment and is smiling. The background consists of a cloudy sky, which adds to the overall atmosphere of the scene. + - A bronze statue of a man jumping in the air with his left arm raised. He appears to be enjoying the moment and is smiling. The background consists of a cloudy sky, which adds to the overall atmosphere of the scene. + - A golden sculpture of a man jumping in the air with his left arm raised. He appears to be enjoying the moment and is smiling. The background consists of a cloudy sky, which adds to the overall atmosphere of the scene. + - Superman jumping in the air with his left arm raised. He appears to be enjoying the moment and is smiling. The background consists of a cloudy sky, which adds to the overall atmosphere of the scene. + + target_codes: + - 1_robot + - 2_bronze_statue + - 3_golden_statue + - 4_superman + +- + + init_img: flowedit_data/kid_running.png + source_prompt: A young boy running through a grassy field. He appears to be enjoying his time outdoors. The field is surrounded by trees, providing a natural and serene environment. + + target_prompts: + - A shiny silver robot running through a grassy field. It appears to be enjoying its time outdoors. The field is surrounded by trees, providing a natural and serene environment. + - A futuristic robot running through a grassy field. It appears to be enjoying its time outdoors. The field is surrounded by trees, providing a natural and serene environment. + - A sculpture of a young boy running through a grassy field. He appears to be enjoying his time outdoors. The field is surrounded by trees, providing a natural and serene environment. + - A wooden sculpture of a young boy running through a grassy field. He appears to be enjoying his time outdoors. The field is surrounded by trees, providing a natural and serene environment. + + target_codes: + - 1_robot + - 2_futuristic_robot + - 3_sculpture + - 4_wooden_sculpture + +- + + init_img: flowedit_data/lighthouse.png + source_prompt: The image features a tall white lighthouse standing prominently on a hill, with a beautiful blue sky in the background. The lighthouse is illuminated by a bright light, making it a prominent landmark in the scene. + + target_prompts: + - The image features a space rocket prominently on a hill, with a beautiful blue sky in the background. The space rocket is illuminated by a bright light, making it a prominent landmark in the scene. + - The image features Rapunzel's tower standing prominently on a hill, with a beautiful blue sky in the background. The Rapunzel's tower is illuminated by a bright light, making it a prominent landmark in the scene. + - The image features the Eiffel tower standing prominently on a hill, with a beautiful blue sky in the background. The Eiffel tower is illuminated by a bright light, making it a prominent landmark in the scene. + - The image features a tall obelisk standing prominently on a hill, with a beautiful blue sky in the background. The obelisk is illuminated by a bright light, making it a prominent landmark in the scene. + - The image features Big ben clock tower standing prominently on a hill, with a beautiful blue sky in the background. The Big ben clock tower is illuminated by a bright light, making it a prominent landmark in the scene. + + target_codes: + - 1_space_rocket + - 2_rapunzel_tower + - 3_eiffel_tower + - 4_obelisk + - 5_big_ben + +- + + init_img: flowedit_data/luna.png + source_prompt: A neon sign for a restaurant called Luna, which is located on a street corner. The sign is illuminated with red and orange colors. + + target_prompts: + - A neon sign for a restaurant called Sol, which is located on a street corner. The sign is illuminated with red and orange colors. + - A neon sign for a restaurant called CVPR, which is located on a street corner. The sign is illuminated with red and orange colors. + - A neon sign for a restaurant called ICCV, which is located on a street corner. The sign is illuminated with red and orange colors. + - A neon sign for a restaurant called ECCV, which is located on a street corner. The sign is illuminated with red and orange colors. + - A neon sign for a restaurant with the word WELCOME, which is located on a street corner. The sign is illuminated with red and orange colors. + - A neon sign for a restaurant with the word HI, which is located on a street corner. The sign is illuminated with red and orange colors. + - A neon sign for a restaurant with an heart on it, which is located on a street corner. The sign is illuminated with red and orange colors. + + target_codes: + - 1_sol + - 2_cvpr + - 3_iccv + - 4_eccv + - 5_welcome + - 6_hi + - 7_heart + +- + + init_img: flowedit_data/meditation.png + + source_prompt: A woman sitting on the floor in a room and meditating. + + target_prompts: + - A wooden statue of a woman sitting on the floor in a room and meditating. + + target_codes: + - 1_wooden_statue + +- + + init_img: flowedit_data/meditation1.png + source_prompt: A man sitting on the ground and appears to be in a relaxed position, meditating. + + target_prompts: + - A sand sculpture of man sitting on the ground and appears to be in a relaxed position, meditating. + - A golden sculpture of buddha sitting on the ground and appears to be in a relaxed position, meditating. + - A wooden statue of a buddha sitting on the ground and appears to be in a relaxed position, meditating. + - A golden sculpture of man sitting on the ground and appears to be in a relaxed position, meditating. + - A wooden sculpture of man sitting on the ground and appears to be in a relaxed position, meditating. + + target_codes: + - 1_sand_sculpture + - 2_golden_buddha_statue + - 3_wooden_buddha_statue + - 4_golden_statue + - 5_wooden_statue + +- + + init_img: flowedit_data/milk.png + source_prompt: A glass of milk placed on a wooden table. The glass is filled with milk, and a straw is inserted into it. + + target_prompts: + - A glass of chocolate milk placed on a wooden table. The glass is filled with chocolate milk, and a straw is inserted into it. + - A glass of beer placed on a wooden table. The glass is filled with beer, and a straw is inserted into it. The table is surrounded by a grassy area, giving the scene a natural and relaxing atmosphere. + - A glass of milkshake placed on a wooden table. The glass is filled with milkshake, and a straw is inserted into it. There is cream on top of the milkshake and a cherry on top of the cream. + - A glass of milk placed on a wooden table. The glass is filled with milk, and a straw is inserted into it. There is whipped cream on top of the milk. + + target_codes: + - 1_chocolate_milk + - 2_beer + - 3_milkshake + - 4_whipped_cream + +- + + init_img: flowedit_data/mountain_black.png + source_prompt: A large, green, hill in the middle of a vast, black, and barren landscape. + + target_prompts: + - A large egyptian pyramid in the middle of a vast, black, and barren landscape. + - A large mesoamerican pyramid in the middle of a vast, black, and barren landscape. + - A large, elegant wedding cake with multiple tiers, beautifully decorated with roses and intricate ornaments in the middle of a vast, black, and barren landscape. + - A kugelhopf cake powdered with sugar in the middle of a vast, black, and barren landscape. + - A large volcano, during a violent eruption with a ot of black smoke and lava, in the middle of a vast, black, and barren landscape. + + target_codes: + - 1_egyptian_pyramid + - 2_mesoamerican_pyramid + - 3_wedding_cake + - 4_kugelhopf + - 5_volcano + +- + + init_img: flowedit_data/muffins.png + source_prompt: A plate of white muffins, decorated with a few raspberries. + + target_prompts: + - A plate of white muffins, decorated with a few strawberries. + + target_codes: + - 1_strawberries + +- + + init_img: flowedit_data/parrot.png + source_prompt: A colorful parrot perched on a tree branch. The parrot is predominantly blue, with a mix of red, green, and yellow colors. + It sitting comfortably on the branch. The tree itself is filled with green leaves, creating a lush and vibrant backdrop for the parrot. + + target_prompts: + - A glass sculpture of a colorful parrot perched on a tree branch. The glass sculpture of the parrot is predominantly red, with a mix of blue, green, and yellow colors. + It sitting comfortably on the branch. The tree itself is filled with green leaves, creating a lush and vibrant backdrop for the glass sculpture of the parrot. + - An origami of a colorful parrot perched on a tree branch. The origami of the parrot is predominantly red, with a mix of blue, green, and yellow colors. + It sitting comfortably on the branch. The tree itself is filled with green leaves, creating a lush and vibrant backdrop for the origami of the parrot. + - A gray pigeon perched on a tree branch. The pigeon is predominantly gray. It sitting comfortably on the branch. + The tree itself is filled with green leaves, creating a lush and vibrant backdrop for the pigeon. + - A colorful lego parrot perched on a tree branch. The lego parrot is predominantly blue, with a mix of red, green, and yellow colors. + It sitting comfortably on the branch. The tree itself is filled with green leaves, creating a lush and vibrant backdrop for the lego parrot. + + target_codes: + - 1_glass_sculpture + - 2_origami + - 3_gray_pigeon + - 4_lego_parrot + +- + + init_img: flowedit_data/parrot2.png + source_prompt: A colorful parrot perched on top of a tall, brightly colored flower. + The parrot is positioned towards the center of the scene, with its vibrant colors contrasting beautifully with the flower''s hues. + + target_prompts: + - A glass sculpture of a colorful parrot perched on top of a tall, brightly colored flower. + The glass sculpture of the parrot is positioned towards the center of the scene, with its vibrant colors contrasting beautifully with the flower''s hues. + + target_codes: + - 1_glass_sculpture + +- + + init_img: flowedit_data/parrots.png + source_prompt: Two colorful parrots sitting on a wooden stump or log. They are positioned close to each other, with one parrot on the left side and the other on the right side of the stump. The parrot''s wings have blue feathers and their body is yellow. + + target_prompts: + - Two colorful parrots sitting on a wooden stump or log. They are positioned close to each other, with one parrot on the left side and the other on the right side of the stump. The parrot''s wings have blue feathers and their body is yellow. Both parrots have a top hat on their head. + - Two colorful origami parrots sitting on a wooden stump or log. They are positioned close to each other, with one origami parrot on the left side and the other on the right side of the stump. The origami parrot''s wings have blue feathers and their body is yellow. + - A sculpture of two colorful parrots sitting on a wooden stump or log. They are positioned close to each other, with one parrot on the left side and the other on the right side of the stump. The parrot''s wings have blue feathers and their body is yellow. + + target_codes: + - 1_top_hat + - 2_origami + - 3_sculpture + +- + + init_img: flowedit_data/parrots2.png + source_prompt: Two colorful parrots perched on a rocky surface. The parrots are positioned close to each other, with one parrot on the left side and the other on the right side of the rock. The parrot colors are predominantly red. + + target_prompts: + - Two colorful parrots perched on a rocky surface. Both parrots have a crown on their head. The birds are positioned close to each other, with one parrot on the left side and the other on the right side of the rock. The parrot colors are predominantly red. + + target_codes: + - 1_crown + +- + + init_img: flowedit_data/penguins.png + source_prompt: Two penguins standing in a lake. They are positioned close to each other, with one penguin on the left side and the other on the right side of the picture. + + target_prompts: + - Two origami penguins standing in a lake. They are positioned close to each other, with one origami penguin on the left side and the other on the right side of the picture. + - A sculpture of two penguins standing in a lake. They are positioned close to each other, with one penguin on the left side and the other on the right side of the picture. + + target_codes: + - 1_origami + - 2_sculpture + +- + + init_img: flowedit_data/piece_of_cake.png + source_prompt: A delicious chocolate cake with chocolate frosting, sitting on a dining table. + + target_prompts: + - A delicious chocolate cake with chocolate frosting and a cherry on top, sitting on a dining table. + - A delicious red velvet cake with white frosting, sitting on a dining table. + - A delicious matcha cake with green frosting, sitting on a dining table. + + target_codes: + - 1_cherry_on_top + - 2_red_velvet_cake + - 3_matcha_cake + +- + + init_img: flowedit_data/pizza.png + source_prompt: A large, cheesy pizza sitting on a wooden pizza board. + + target_prompts: + - A large, cheesy pizza, topped with pineapple and ham, sitting on a wooden pizza board. + + target_codes: + - 1_pineapple_ham + +- + + init_img: flowedit_data/pizza_board.png + source_prompt: A large pizza with cheese and bits of meat. + + target_prompts: + - A large pizza with cheese and mushrooms. + - A large pizza with cheese and sausages. + - A large pizza with cheese, pineapple and ham. + + target_codes: + - 1_mushrooms + - 2_sausage + - 3_pineapple_ham + +- + + init_img: flowedit_data/pizza_slice.png + source_prompt: A pizza with thick crust, topped with graded cheese and basil. + + target_prompts: + - A pizza with thick crust, topped with graded cheese, basil and pepperoni. + - A pizza with thick crust, topped with graded cheese, basil and mushrooms. + + target_codes: + - 1_pepperoni + - 2_mushrooms + +- + + init_img: flowedit_data/pizza_tomato_olive.png + source_prompt: A large pizza, topped with cheese, black olive, sliced tomatoes. + + target_prompts: + - A large pizza, topped with cheese, black olive, sliced tomatoes and a lot of pepperoni. + - A large pizza, topped with cheese, black olive, sliced tomatoes and mushrooms. + + target_codes: + - 1_pepperoni + - 2_mushrooms + +- + + init_img: flowedit_data/puppies.png + + source_prompt: Two adorable golden retriever puppies sitting in a grassy field. They are positioned close to each other, with one dog on the left and the other on the right. Both dogs have their mouths open, possibly panting. + + target_prompts: + - Two adorable husky puppies sitting in a grassy field. They are positioned close to each other, with one dog on the left and the other on the right. Both dogs have their mouths open, possibly panting or enjoying the outdoor environment. + - Two adorable bear cubs sitting in a grassy field. They are positioned close to each other, with one wold cub on the left and the other on the right. Both cubs have their mouths open, possibly panting or enjoying the outdoor environment. + - Two adorable puppets of golden retriever puppies sitting in a grassy field. They are positioned close to each other, with one puppet on the left and the other on the right. Both puppets have their mouths open, possibly panting or enjoying the outdoor environment. + - Two adorable golden retriever puppies laying in a grassy field. They are positioned close to each other, with one dog on the left and the other on the right. Both dogs have their mouths open, possibly panting or enjoying the outdoor environment. + + target_codes: + - 1_husky_puppies + - 2_bear_cubs + - 3_puppets + - 4_laying + +- + + init_img: flowedit_data/rabbit.png + source_prompt: A small brown and white rabbit sitting in a grassy field. The rabbit is surrounded by a variety of white flowers. + + target_prompts: + - A small sculpture of a rabbit sitting in a grassy field. The rabbit is surrounded by a variety of white flowers. + - A small puppy sitting in a grassy field. The puppy is surrounded by a variety of white flowers. + - A small kitten sitting in a grassy field. The kitten is surrounded by a variety of white flowers. + + target_codes: + - 1_sculpture + - 2_puppy + - 3_kitten + +- + + init_img: flowedit_data/rocks.png + source_prompt: A stack of gray rocks, laying on top of each other on a brown and gray beach. + The rocks are arranged in a pyramid shape, creating an impressive and natural display. The brown and gray beach setting provides a serene and picturesque backdrop for this unique rock formation. + + target_prompts: + - A stack of colorful macarons, laying on top of each other on a brown and gray beach.The colorful macarons are arranged in a pyramid shape, creating an impressive display. + The brown and gray beach setting provides a serene and picturesque backdrop for this unique colorful macarons formation on a brown and gray beach. + - A stack of oreo cookies, laying on top of each other on a brown and gray beach. + The oreo cookies are arranged in a pyramid shape, creating an impressive display. The brown and gray beach setting provides a serene and picturesque backdrop for this unique oreo cookies formation on a brown and gray beach. + - A tower on a brown and gray beach. The brown and gray beach setting provides a serene and picturesque backdrop for this tower. + - A bonsai tree on a brown and gray beach. The brown and gray beach setting provides a serene and picturesque backdrop for this bonsai tree. + - A jenga tower game on a brown and gray beach. The brown and gray beach setting provides a serene and picturesque backdrop for this jenga tower. + - A stack of colorful wooden blocks, laying on top of each other on a brown and gray beach. The colorful wooden blocks are arranged in a pyramid shape, creating an impressive + and natural display. The brown and gray beach setting provides a serene and picturesque backdrop for this unique colorful wooden blocks formation. + + target_codes: + - 1_macarons + - 2_oreo_cookies + - 3_tower + - 4_bonsai_tree + - 5_jenga_tower + - 6_colorful_wooden_blocks + +- + + init_img : flowedit_data/rooster.png + source_prompt: A large, colorful rooster standing on a tree branch. + + target_prompts: + - A large, colorful glass sculpture of a rooster standing on a tree branch. + - A large, colorful origami rooster standing on a tree branch. + + target_codes: + - 1_glass_sculpture + - 2_origami + +- + + init_img: flowedit_data/sign.png + source_prompt: A large white billboard with a bold message written in black letters. The message reads, "LOVE IS ALL YOU NEED." The billboard is prominently displayed in the scene, capturing the viewer''s attention. + + target_prompts: + - A large white billboard with a bold message written in black letters. The message reads, "CVPR IS ALL YOU NEED." The billboard is prominently displayed in the scene, capturing the viewer''s attention. + - A large white billboard with a bold message written in black letters. The message reads, "ECCV IS ALL YOU NEED." The billboard is prominently displayed in the scene, capturing the viewer''s attention. + - A large white billboard with a bold message written in black letters. The message reads, "ICCV IS ALL YOU NEED." The billboard is prominently displayed in the scene, capturing the viewer''s attention. + - A large white billboard with a bold message written in black letters. The message reads, "FLOW IS ALL YOU NEED." The billboard is prominently displayed in the scene, capturing the viewer''s attention. + + target_codes: + - 1_cvpr + - 2_eccv + - 3_iccv + - 4_flow + +- + + init_img: flowedit_data/steak.png + source_prompt: A steak accompanied by a side of leaf salad. + + target_prompts: + - A bread roll accompanied by a side of leaf salad. + - A schnitzel accompanied by a side of leaf salad. + - A lobster tail accompanied by a side of leaf salad. + - A crab cake accompanied by a side of leaf salad. + - A chocolate cake accompanied by a side of leaf salad. + - A raw steak accompanied by a side of leaf salad. + - A quiche accompanied by a side of leaf salad. + - Shrimps accompanied by a side of leaf salad. + + target_codes: + - 1_bread_roll + - 2_schnitzel + - 3_lobster_tail + - 4_crab_cake + - 5_chocolate_cake + - 6_raw_steak + - 7_quiche + - 8_shrimps + +- + + init_img: flowedit_data/steak_dinner.png + source_prompt: A delicious meal consisting of sliced steak, vegetables, and sauce. + + target_prompts: + - A delicious meal consisting of sliced grilled salmon, vegetables, and sauce. + + target_codes: + - 1_salmon + +- + + init_img: flowedit_data/stop.png + source_prompt: A stop sign prominently placed in a field of yellow flowers. + + target_prompts: + - A sign that says CVPR prominently placed in a field of yellow flowers. + - A sign that says ICCV prominently placed in a field of yellow flowers. + - A sign that says ECCV prominently placed in a field of yellow flowers. + + target_codes: + - 1_cvpr + - 2_iccv + - 3_eccv + +- + + init_img: flowedit_data/stop_arrow.png + source_prompt: A stop sign above a blue sign with arrow pointing up. + + target_prompts: + - A sign that says CVPR above a blue sign with arrow pointing up. + - A sign that says ICCV above a blue sign with arrow pointing up. + - A sign that says ECCV above a blue sign with arrow pointing up. + - A sign that says LOVE above a blue sign with arrow pointing up. + - A sign that says HOME above a blue sign with arrow pointing up. + - A sign that says BEER above a blue sign with arrow pointing up. + + target_codes: + - 1_cvpr + - 2_iccv + - 3_eccv + - 4_love + - 5_home + - 6_beer + +- + + init_img: flowedit_data/stop_sticker.png + source_prompt: A STOP! sticker with a red and yellow color scheme which is placed on a white background. + + target_prompts: + - A CVPR! sticker with a red and yellow color scheme which is placed on a white background. + - A ECCV! sticker with a red and yellow color scheme which is placed on a white background. + - A ICCV! sticker with a red and yellow color scheme which is placed on a white background. + + target_codes: + - 1_cvpr + - 2_eccv + - 3_iccv + +- + + init_img: flowedit_data/this_must_be_the_place.png + source_prompt: A large, colorful wall with a neon sign that reads "this must be the place." + + target_prompts: + - A large, colorful wall with a neon sign that reads "home must be the place." + - A large, colorful wall with a neon sign that reads "cvpr must be the place." + - A large, colorful wall with a neon sign that reads "eccv must be the place." + - A large, colorful wall with a neon sign that reads "iccv must be the place." + + target_codes: + - 1_home + - 2_cvpr + - 3_eccv + - 4_iccv + +- + + init_img: flowedit_data/tiger.png + source_prompt: A large tiger standing in a swamp. The tiger is positioned towards the left side of the scene, with its legs submerged in the water. The water is covered with green algae. + + target_prompts: + - A large lion standing in a swamp. The lion is positioned towards the left side of the scene, with its legs submerged in the water. The water is covered with green algae. + - A large crochet tiger standing in a swamp. The crochet tiger is positioned towards the left side of the scene, with its legs submerged in the water. The water is covered with green algae. + - A large wolf standing in a swamp. The wolf is positioned towards the left side of the scene, with its legs submerged in the water. The water is covered with green algae. + + target_codes: + - 1_lion + - 2_crochet_tiger + - 3_wolf + +- + + init_img: flowedit_data/tree_reflect.png + source_prompt: A lone tree standing in a field at night. The tree reflection can be seen in the water below it. The tree is surrounded by a serene and peaceful atmosphere, with the night sky serving as a beautiful backdrop. + + target_prompts: + - A lone decorated christmas tree standing in a field at night. The christmas tree reflection can be seen in the water below it. The christmas tree is surrounded by a serene and peaceful atmosphere, with the night sky serving as a beautiful backdrop. + - A lone cherry blossom tree standing in a field at night. The cherry blossom tree reflection can be seen in the water below it. The cherry blossom tree is surrounded by a serene and peaceful atmosphere, with the night sky serving as a beautiful backdrop. + - A lone tree standing in a field at night with a tent next to it. The tree and the tent reflections can be seen in the water below them.The tree and tent are surrounded by a serene and peaceful atmosphere, with the night sky serving as a beautiful backdrop. + + target_codes: + - 1_christmas_tree + - 2_cherry_blossom_tree + - 3_tent + +- + + init_img : flowedit_data/wolf_silhouette.png + source_prompt : A silhouette of a wolf standing on a rocky cliff, looking up at the moon. The wolf appears to be howling at the moon, creating a captivating scene. + + target_prompts: + - A silhouette of a robot wolf standing on a rocky cliff, looking up at the moon. The robot wolf appears to be howling at the moon, creating a captivating scene. + - A Husky dog standing on a rocky cliff. The Husky dog appears to be looking. + - A silhouette of a wolf standing on a rocky cliff. The wolf appears to be looking. + + target_codes: + - 1_robot_wolf + - 2_husky_dog_looking + - 3_wolf_looking + +- + + init_img: flowedit_data/yellow_bulldog.png + source_prompt: A small, yellow, shiny dog figurine positioned in the center of the scene, and it appears to be a decorative piece. + + target_prompts: + - A small, yellow, lion figurine positioned in the center of the scene, and it appears to be a decorative piece. + - A small, yellow, cat figurine positioned in the center of the scene, and it appears to be a decorative piece. + - A small, yellow, bear figurine positioned in the center of the scene, and it appears to be a decorative piece. + - A small, yellow, deer figurine positioned in the center of the scene, and it appears to be a decorative piece. + - A small, yellow, rabbit figurine positioned in the center of the scene, and it appears to be a decorative piece. + - A small, yellow, wolf figurine positioned in the center of the scene, and it appears to be a decorative piece. + - A small, yellow, cow figurine positioned in the center of the scene, and it appears to be a decorative piece. + - A small, yellow, horse figurine positioned in the center of the scene, and it appears to be a decorative piece. + - A small, yellow, unicorn figurine positioned in the center of the scene, and it appears to be a decorative piece. + - A small, yellow, origami lion positioned in the center of the scene, and it appears to be a decorative piece. + - A small, yellow, origami cat positioned in the center of the scene, and it appears to be a decorative piece. + - A small, yellow, origami bear positioned in the center of the scene, and it appears to be a decorative piece. + - A small, yellow, origami deer positioned in the center of the scene, and it appears to be a decorative piece. + - A small, yellow, origami rabbit positioned in the center of the scene, and it appears to be a decorative piece. + - A small, yellow, origami wolf positioned in the center of the scene, and it appears to be a decorative piece. + - A small, yellow, origami cow positioned in the center of the scene, and it appears to be a decorative piece. + - A small, yellow, origami horse positioned in the center of the scene, and it appears to be a decorative piece. + + + target_codes: + - 1_lion + - 2_cat + - 3_bear + - 4_deer + - 5_rabbit + - 6_wolf + - 7_cow + - 8_horse + - 9_unicorn + - 10_origami_lion + - 11_origami_cat + - 12_origami_bear + - 13_origami_deer + - 14_origami_rabbit + - 15_origami_wolf + - 16_origami_cow + - 17_origami_horse + diff --git a/edit/FlowEdit/FLUX_exp.yaml b/edit/FlowEdit/FLUX_exp.yaml new file mode 100644 index 0000000000000000000000000000000000000000..a4a41817623b7f2627790a19413498c3f6f10827 --- /dev/null +++ b/edit/FlowEdit/FLUX_exp.yaml @@ -0,0 +1,12 @@ +- + exp_name: "FlowEdit_FLUX" + dataset_yaml: edits.yaml + model_type: "FLUX" + sampler_type: "FlowEditFLUX" + T_steps: 28 + n_avg: 1 + src_guidance_scale: 1.5 + tar_guidance_scale: 5.5 + n_min: 0 + n_max: 24 + seed: 10 diff --git a/edit/FlowEdit/FlowEdit_utils.py b/edit/FlowEdit/FlowEdit_utils.py new file mode 100644 index 0000000000000000000000000000000000000000..1ef49b79c0945599f9b085ed1f57d972bc1aabc5 --- /dev/null +++ b/edit/FlowEdit/FlowEdit_utils.py @@ -0,0 +1,404 @@ +from typing import Optional, Tuple, Union +import torch +from diffusers import FlowMatchEulerDiscreteScheduler +from tqdm import tqdm +import numpy as np + +from diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion import retrieve_timesteps + + + +def scale_noise( + scheduler, + sample: torch.FloatTensor, + timestep: Union[float, torch.FloatTensor], + noise: Optional[torch.FloatTensor] = None, +) -> torch.FloatTensor: + """ + Foward process in flow-matching + + Args: + sample (`torch.FloatTensor`): + The input sample. + timestep (`int`, *optional*): + The current timestep in the diffusion chain. + + Returns: + `torch.FloatTensor`: + A scaled input sample. + """ + # if scheduler.step_index is None: + scheduler._init_step_index(timestep) + + sigma = scheduler.sigmas[scheduler.step_index] + sample = sigma * noise + (1.0 - sigma) * sample + + return sample + + +# for flux +def calculate_shift( + image_seq_len, + base_seq_len: int = 256, + max_seq_len: int = 4096, + base_shift: float = 0.5, + max_shift: float = 1.16, +): + m = (max_shift - base_shift) / (max_seq_len - base_seq_len) + b = base_shift - m * base_seq_len + mu = image_seq_len * m + b + return mu + + + +def calc_v_sd3(pipe, src_tar_latent_model_input, src_tar_prompt_embeds, src_tar_pooled_prompt_embeds, src_guidance_scale, tar_guidance_scale, t): + # broadcast to batch dimension in a way that's compatible with ONNX/Core ML + timestep = t.expand(src_tar_latent_model_input.shape[0]) + # joint_attention_kwargs = {} + # # add timestep to joint_attention_kwargs + # joint_attention_kwargs["timestep"] = timestep[0] + # joint_attention_kwargs["timestep_idx"] = i + + + with torch.no_grad(): + # # predict the noise for the source prompt + noise_pred_src_tar = pipe.transformer( + hidden_states=src_tar_latent_model_input, + timestep=timestep, + encoder_hidden_states=src_tar_prompt_embeds, + pooled_projections=src_tar_pooled_prompt_embeds, + joint_attention_kwargs=None, + return_dict=False, + )[0] + + # perform guidance source + if pipe.do_classifier_free_guidance: + src_noise_pred_uncond, src_noise_pred_text, tar_noise_pred_uncond, tar_noise_pred_text = noise_pred_src_tar.chunk(4) + noise_pred_src = src_noise_pred_uncond + src_guidance_scale * (src_noise_pred_text - src_noise_pred_uncond) + noise_pred_tar = tar_noise_pred_uncond + tar_guidance_scale * (tar_noise_pred_text - tar_noise_pred_uncond) + + return noise_pred_src, noise_pred_tar + + + +def calc_v_flux(pipe, latents, prompt_embeds, pooled_prompt_embeds, guidance, text_ids, latent_image_ids, t): + # broadcast to batch dimension in a way that's compatible with ONNX/Core ML + timestep = t.expand(latents.shape[0]) + # joint_attention_kwargs = {} + # # add timestep to joint_attention_kwargs + # joint_attention_kwargs["timestep"] = timestep[0] + # joint_attention_kwargs["timestep_idx"] = i + + + with torch.no_grad(): + # # predict the noise for the source prompt + noise_pred = pipe.transformer( + hidden_states=latents, + timestep=timestep / 1000, + guidance=guidance, + encoder_hidden_states=prompt_embeds, + txt_ids=text_ids, + img_ids=latent_image_ids, + pooled_projections=pooled_prompt_embeds, + joint_attention_kwargs=None, + return_dict=False, + )[0] + + return noise_pred + + + +@torch.no_grad() +def FlowEditSD3(pipe, + scheduler, + x_src, + src_prompt, + tar_prompt, + negative_prompt, + T_steps: int = 50, + n_avg: int = 1, + src_guidance_scale: float = 3.5, + tar_guidance_scale: float = 13.5, + n_min: int = 0, + n_max: int = 15,): + + device = x_src.device + + timesteps, T_steps = retrieve_timesteps(scheduler, T_steps, device, timesteps=None) + + num_warmup_steps = max(len(timesteps) - T_steps * scheduler.order, 0) + pipe._num_timesteps = len(timesteps) + pipe._guidance_scale = src_guidance_scale + + # src prompts + ( + src_prompt_embeds, + src_negative_prompt_embeds, + src_pooled_prompt_embeds, + src_negative_pooled_prompt_embeds, + ) = pipe.encode_prompt( + prompt=src_prompt, + prompt_2=None, + prompt_3=None, + negative_prompt=negative_prompt, + do_classifier_free_guidance=pipe.do_classifier_free_guidance, + device=device, + ) + + # tar prompts + pipe._guidance_scale = tar_guidance_scale + ( + tar_prompt_embeds, + tar_negative_prompt_embeds, + tar_pooled_prompt_embeds, + tar_negative_pooled_prompt_embeds, + ) = pipe.encode_prompt( + prompt=tar_prompt, + prompt_2=None, + prompt_3=None, + negative_prompt=negative_prompt, + do_classifier_free_guidance=pipe.do_classifier_free_guidance, + device=device, + ) + + # CFG prep + src_tar_prompt_embeds = torch.cat([src_negative_prompt_embeds, src_prompt_embeds, tar_negative_prompt_embeds, tar_prompt_embeds], dim=0) + src_tar_pooled_prompt_embeds = torch.cat([src_negative_pooled_prompt_embeds, src_pooled_prompt_embeds, tar_negative_pooled_prompt_embeds, tar_pooled_prompt_embeds], dim=0) + + # initialize our ODE Zt_edit_1=x_src + zt_edit = x_src.clone() + + for i, t in tqdm(enumerate(timesteps)): + + if T_steps - i > n_max: + continue + + t_i = t/1000 + if i+1 < len(timesteps): + t_im1 = (timesteps[i+1])/1000 + else: + t_im1 = torch.zeros_like(t_i).to(t_i.device) + + if T_steps - i > n_min: + + # Calculate the average of the V predictions + V_delta_avg = torch.zeros_like(x_src) + for k in range(n_avg): + + fwd_noise = torch.randn_like(x_src).to(x_src.device) + + zt_src = (1-t_i)*x_src + (t_i)*fwd_noise + + zt_tar = zt_edit + zt_src - x_src + + src_tar_latent_model_input = torch.cat([zt_src, zt_src, zt_tar, zt_tar]) if pipe.do_classifier_free_guidance else (zt_src, zt_tar) + + Vt_src, Vt_tar = calc_v_sd3(pipe, src_tar_latent_model_input,src_tar_prompt_embeds, src_tar_pooled_prompt_embeds, src_guidance_scale, tar_guidance_scale, t) + + V_delta_avg += (1/n_avg) * (Vt_tar - Vt_src) # - (hfg-1)*( x_src)) + + # propagate direct ODE + zt_edit = zt_edit.to(torch.float32) + + zt_edit = zt_edit + (t_im1 - t_i) * V_delta_avg + + zt_edit = zt_edit.to(V_delta_avg.dtype) + + else: # i >= T_steps-n_min # regular sampling for last n_min steps + + if i == T_steps-n_min: + # initialize SDEDIT-style generation phase + fwd_noise = torch.randn_like(x_src).to(x_src.device) + xt_src = scale_noise(scheduler, x_src, t, noise=fwd_noise) + xt_tar = zt_edit + xt_src - x_src + + src_tar_latent_model_input = torch.cat([xt_tar, xt_tar, xt_tar, xt_tar]) if pipe.do_classifier_free_guidance else (xt_src, xt_tar) + + _, Vt_tar = calc_v_sd3(pipe, src_tar_latent_model_input,src_tar_prompt_embeds, src_tar_pooled_prompt_embeds, src_guidance_scale, tar_guidance_scale, t) + + xt_tar = xt_tar.to(torch.float32) + + prev_sample = xt_tar + (t_im1 - t_i) * (Vt_tar) + + prev_sample = prev_sample.to(noise_pred_tar.dtype) + + xt_tar = prev_sample + + return zt_edit if n_min == 0 else xt_tar + + + +@torch.no_grad() +def FlowEditFLUX(pipe, + scheduler, + x_src, + src_prompt, + tar_prompt, + negative_prompt, + T_steps: int = 28, + n_avg: int = 1, + src_guidance_scale: float = 1.5, + tar_guidance_scale: float = 5.5, + n_min: int = 0, + n_max: int = 24,): + + device = x_src.device + orig_height, orig_width = x_src.shape[2]*pipe.vae_scale_factor//2, x_src.shape[3]*pipe.vae_scale_factor//2 + num_channels_latents = pipe.transformer.config.in_channels // 4 + + pipe.check_inputs( + prompt=src_prompt, + prompt_2=None, + height=orig_height, + width=orig_width, + callback_on_step_end_tensor_inputs=None, + max_sequence_length=512, + ) + + x_src, latent_src_image_ids = pipe.prepare_latents(batch_size= x_src.shape[0], num_channels_latents=num_channels_latents, height=orig_height, width=orig_width, dtype=x_src.dtype, device=x_src.device, generator=None,latents=x_src) + x_src_packed = pipe._pack_latents(x_src, x_src.shape[0], num_channels_latents, x_src.shape[2], x_src.shape[3]) + latent_tar_image_ids = latent_src_image_ids + + # 5. Prepare timesteps + sigmas = np.linspace(1.0, 1 / T_steps, T_steps) + image_seq_len = x_src_packed.shape[1] + mu = calculate_shift( + image_seq_len, + scheduler.config.base_image_seq_len, + scheduler.config.max_image_seq_len, + scheduler.config.base_shift, + scheduler.config.max_shift, + ) + timesteps, T_steps = retrieve_timesteps( + scheduler, + T_steps, + device, + timesteps=None, + sigmas=sigmas, + mu=mu, + ) + + num_warmup_steps = max(len(timesteps) - T_steps * pipe.scheduler.order, 0) + pipe._num_timesteps = len(timesteps) + + + # src prompts + ( + src_prompt_embeds, + src_pooled_prompt_embeds, + src_text_ids, + + ) = pipe.encode_prompt( + prompt=src_prompt, + prompt_2=None, + device=device, + ) + + # tar prompts + pipe._guidance_scale = tar_guidance_scale + ( + tar_prompt_embeds, + tar_pooled_prompt_embeds, + tar_text_ids, + ) = pipe.encode_prompt( + prompt=tar_prompt, + prompt_2=None, + device=device, + ) + + # handle guidance + if pipe.transformer.config.guidance_embeds: + src_guidance = torch.tensor([src_guidance_scale], device=device) + src_guidance = src_guidance.expand(x_src_packed.shape[0]) + tar_guidance = torch.tensor([tar_guidance_scale], device=device) + tar_guidance = tar_guidance.expand(x_src_packed.shape[0]) + else: + src_guidance = None + tar_guidance = None + + # initialize our ODE Zt_edit_1=x_src + zt_edit = x_src_packed.clone() + + for i, t in tqdm(enumerate(timesteps)): + + if T_steps - i > n_max: + continue + + scheduler._init_step_index(t) + t_i = scheduler.sigmas[scheduler.step_index] + if i < len(timesteps): + t_im1 = scheduler.sigmas[scheduler.step_index + 1] + else: + t_im1 = t_i + + if T_steps - i > n_min: + + # Calculate the average of the V predictions + V_delta_avg = torch.zeros_like(x_src_packed) + + for k in range(n_avg): + + + fwd_noise = torch.randn_like(x_src_packed).to(x_src_packed.device) + + zt_src = (1-t_i)*x_src_packed + (t_i)*fwd_noise + + zt_tar = zt_edit + zt_src - x_src_packed + + # Merge in the future to avoid double computation + Vt_src = calc_v_flux(pipe, + latents=zt_src, + prompt_embeds=src_prompt_embeds, + pooled_prompt_embeds=src_pooled_prompt_embeds, + guidance=src_guidance, + text_ids=src_text_ids, + latent_image_ids=latent_src_image_ids, + t=t) + + Vt_tar = calc_v_flux(pipe, + latents=zt_tar, + prompt_embeds=tar_prompt_embeds, + pooled_prompt_embeds=tar_pooled_prompt_embeds, + guidance=tar_guidance, + text_ids=tar_text_ids, + latent_image_ids=latent_tar_image_ids, + t=t) + + V_delta_avg += (1/n_avg) * (Vt_tar - Vt_src) # - (hfg-1)*( x_src)) + + # propagate direct ODE + zt_edit = zt_edit.to(torch.float32) + + zt_edit = zt_edit + (t_im1 - t_i) * V_delta_avg + + zt_edit = zt_edit.to(V_delta_avg.dtype) + + else: # i >= T_steps-n_min # regular sampling last n_min steps + + if i == T_steps-n_min: + # initialize SDEDIT-style generation phase + fwd_noise = torch.randn_like(x_src_packed).to(x_src_packed.device) + xt_src = scale_noise(scheduler, x_src_packed, t, noise=fwd_noise) + xt_tar = zt_edit + xt_src - x_src_packed + + Vt_tar = calc_v_flux(pipe, + latents=xt_tar, + prompt_embeds=tar_prompt_embeds, + pooled_prompt_embeds=tar_pooled_prompt_embeds, + guidance=tar_guidance, + text_ids=tar_text_ids, + latent_image_ids=latent_tar_image_ids, + t=t) + + + xt_tar = xt_tar.to(torch.float32) + + prev_sample = xt_tar + (t_im1 - t_i) * (Vt_tar) + + prev_sample = prev_sample.to(Vt_tar.dtype) + xt_tar = prev_sample + out = zt_edit if n_min == 0 else xt_tar + unpacked_out = pipe._unpack_latents(out, orig_height, orig_width, pipe.vae_scale_factor) + return unpacked_out + + diff --git a/edit/FlowEdit/LICENSE b/edit/FlowEdit/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..437829b12df2c805bd9c6cc22eaf2a1b6f7bb0fb --- /dev/null +++ b/edit/FlowEdit/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2024 Vladimir Kulikov + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/edit/FlowEdit/README.md b/edit/FlowEdit/README.md new file mode 100644 index 0000000000000000000000000000000000000000..c19a531adf88a1f25153b4bddfb4fca43689fe88 --- /dev/null +++ b/edit/FlowEdit/README.md @@ -0,0 +1,75 @@ +[![Zero-Shot Image Editing](https://img.shields.io/badge/zero%20shot-image%20editing-Green)]([https://github.com/topics/video-editing](https://github.com/topics/text-guided-image-editing)) +[![Python](https://img.shields.io/badge/python-3.8+-blue?python-3670A0?style=for-the-badge&logo=python&logoColor=ffdd54)](https://www.python.org/downloads/release/python-38/) +![PyTorch](https://img.shields.io/badge/torch-2.0.0-red?PyTorch-%23EE4C2C.svg?style=for-the-badge&logo=PyTorch&logoColor=white) + +# FlowEdit + +[Project](https://matankleiner.github.io/flowedit/) | [Arxiv](https://arxiv.org/abs/2412.08629) | [Proceedings](https://openaccess.thecvf.com/content/ICCV2025/html/Kulikov_FlowEdit_Inversion-Free_Text-Based_Editing_Using_Pre-Trained_Flow_Models_ICCV_2025_paper.html) | [Demo](https://huggingface.co/spaces/fallenshock/FlowEdit) | [ComfyUI](#comfyui-implementation-for-different-models) | [Data](https://github.com/fallenshock/FlowEdit/tree/main/Data) + +#### [Recorded Talk](https://www.youtube.com/live/2fEDy-uTAII?si=_NRbANcqgX9wyvcI&t=17998) + +### [ICCV 2025 Best Student Paper] Official Pytorch implementation of the paper: "FlowEdit: Inversion-Free Text-Based Editing Using Pre-Trained Flow Models" + + +![](imgs/teaser.png) + +## Installation +1. Clone the repository + +2. Install the required dependencies using `pip install torch diffusers transformers accelerate sentencepiece protobuf`
+ * New version of diffusers may have compatibility issues, try install `diffusers==0.30.1` + * Tested with CUDA version 12.4 and diffusers 0.30.0 + +## Running examples +Run editing with Stable Diffusion 3: `python run_script.py --exp_yaml SD3_exp.yaml` + +Run editing with Flux: `python run_script.py --exp_yaml FLUX_exp.yaml` + +## Usage - your own examples + +* Upload images to `example_images` folder. + +* Create an edits file that specifies: (a) a path to the input image, (b) a source prompt, (c) target prompts, and (d) target codes. The target codes summarize the changes between the source and target prompts and will appear in the output filename.
+See `edits.yaml` for example. + +* Create an experiment file containing the hyperparamaters needed for running FlowEdit, such as `n_max`, `n_min`. This file also includes the path to the `edits.yaml` file
+See `FLUX_exp.yaml` for FLUX usage example and `SD3_exp.yaml` for Stable Diffusion 3 usage example.
+For a detailed discussion on the impact of different hyperparameters and the values we used, please refer to our paper. + +Run `python run_script.py --exp_yaml ` + +## ComfyUI implementation for different models + +* [FLUX](https://github.com/logtd/ComfyUI-Fluxtapoz) +* [HunyuanLoom](https://github.com/logtd/ComfyUI-HunyuanLoom) + +Implemented by [logtd](https://x.com/logtdx/status/1869095838016012462?s=48&t=6Yj6BZKooDOmH_JWRWjtHg) + +LTX-Video ComfyUI implementation can be found in LTX-Video [official repository](https://github.com/Lightricks/ComfyUI-LTXVideo/tree/master?tab=readme-ov-file#flow-edit). + +## Community and Follow-Up Work + +* [Training-Free-WAN-Editing🤗](https://github.com/KyujinHan/Awesome-Training-Free-WAN2.1-Editing), combines [WAN2.1](https://github.com/Wan-Video/Wan2.1) with FlowEdit to extend training-free to video editing. If you are interested in video editing, please feel free to take a look. Implemented by [Kyujinpy](https://github.com/KyujinHan). + +* DNAEdit refines the Gaussian noise in the noise domain, improving image and video editing (NeurIPS 2025 Spotlight). [Project](https://xiechenxi99.github.io/DNAEdit/) | [Code](https://github.com/xiechenxi99/DNAEdit_code) | [Arxiv](https://arxiv.org/abs/2506.01430) | [Proceedings](https://neurips.cc/virtual/2025/loc/san-diego/poster/118684) + +* FlowAlign add optimal control-based trajectory control to the inversion free process (ICLR 2026). [Code](https://github.com/FlowAlign/FlowAlign) | [Arxiv](https://arxiv.org/abs/2505.23145) | [Proceedings](https://openreview.net/forum?id=nyttIJfwW7) + +* DynaEdit extened FlowEdit for dynmaic video editing. [Project](https://dynaedit.github.io/) | [Arxiv](https://arxiv.org/abs/2603.17989) + +## License +This project is licensed under the [MIT License](LICENSE). + + +### Citation +If you use this code for your research, please cite our paper: + +``` +@inproceedings{kulikov2025flowedit, + title={Flowedit: Inversion-free text-based editing using pre-trained flow models}, + author={Kulikov, Vladimir and Kleiner, Matan and Huberman-Spiegelglas, Inbar and Michaeli, Tomer}, + booktitle={Proceedings of the IEEE/CVF International Conference on Computer Vision}, + pages={19721--19730}, + year={2025} +} +``` diff --git a/edit/FlowEdit/SD3_exp.yaml b/edit/FlowEdit/SD3_exp.yaml new file mode 100644 index 0000000000000000000000000000000000000000..0dcb3a2719624ca302f3428a750aa81cb01e0338 --- /dev/null +++ b/edit/FlowEdit/SD3_exp.yaml @@ -0,0 +1,13 @@ +- + exp_name: "FlowEdit_SD3" + dataset_yaml: edits.yaml + model_type: "SD3" + sampler_type: "FlowEditSD3" + T_steps: 50 + n_avg: 1 + src_guidance_scale: 3.5 + tar_guidance_scale: 13.5 + n_min: 0 + n_max: 33 + seed: 42 + diff --git a/edit/FlowEdit/__pycache__/FlowEdit_utils.cpython-310.pyc b/edit/FlowEdit/__pycache__/FlowEdit_utils.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..da87b6b8166fa31850b53ac888a2061ae48ce9a0 Binary files /dev/null and b/edit/FlowEdit/__pycache__/FlowEdit_utils.cpython-310.pyc differ diff --git a/edit/FlowEdit/edits.yaml b/edit/FlowEdit/edits.yaml new file mode 100644 index 0000000000000000000000000000000000000000..6e6e66c456c33a252586d8d23c6eef0c34a29e7c --- /dev/null +++ b/edit/FlowEdit/edits.yaml @@ -0,0 +1,28 @@ +- + input_img: example_images/gas_station.png + source_prompt: A gas station with a white and red sign that + reads "CAFE" There are several cars parked in front of the gas station, including + a white car and a van. + + target_prompts: + - A gas station with a white and red sign that + reads "CVPR" There are several cars parked in front of the gas station, including + a white car and a van. + + target_codes: + - cvpr + +- + + input_img: example_images/lighthouse.png + source_prompt: The image features a tall white lighthouse standing prominently + on a hill, with a beautiful blue sky in the background. The lighthouse is illuminated + by a bright light, making it a prominent landmark in the scene. + + target_prompts: + - The image features Big ben clock tower standing prominently + on a hill, with a beautiful blue sky in the background. The Big ben clock tower is illuminated + by a bright light, making it a prominent landmark in the scene. + + target_codes: + - big_ben diff --git a/edit/FlowEdit/example_images/gas_station.png b/edit/FlowEdit/example_images/gas_station.png new file mode 100644 index 0000000000000000000000000000000000000000..84715663a1917b796d708a71b94f7bf3d8b7477b --- /dev/null +++ b/edit/FlowEdit/example_images/gas_station.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:633754e02947653ed33ab741c86c40c8d21170a771cd4aced6250ba23e7c25bf +size 1096302 diff --git a/edit/FlowEdit/example_images/lighthouse.png b/edit/FlowEdit/example_images/lighthouse.png new file mode 100644 index 0000000000000000000000000000000000000000..af34661e59e34764c91afa5973abb1e43dfd4220 --- /dev/null +++ b/edit/FlowEdit/example_images/lighthouse.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a9646ab72ee23b202f0dbbf4aecda6546c1317ba66376b44ee7b9860f91ff0a7 +size 1564584 diff --git a/edit/FlowEdit/imgs/teaser.png b/edit/FlowEdit/imgs/teaser.png new file mode 100644 index 0000000000000000000000000000000000000000..6b70262e290899cd2abb468212758df3fda20530 --- /dev/null +++ b/edit/FlowEdit/imgs/teaser.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1186c422fe551a09e027be407cc3c2a83b88997223581f50cbb3ff2ff4daab2e +size 7082919 diff --git a/edit/FlowEdit/run_script.py b/edit/FlowEdit/run_script.py new file mode 100644 index 0000000000000000000000000000000000000000..a2809435c2967a7c0f79060e3c0c0a079d1be63d --- /dev/null +++ b/edit/FlowEdit/run_script.py @@ -0,0 +1,150 @@ +import torch +from diffusers import StableDiffusion3Pipeline +from diffusers import FluxPipeline +from PIL import Image +import argparse +import random +import numpy as np +import yaml +import os +from FlowEdit_utils import FlowEditSD3, FlowEditFLUX + + + +if __name__ == "__main__": + + parser = argparse.ArgumentParser() + parser.add_argument("--device_number", type=int, default=0, help="device number to use") + parser.add_argument("--exp_yaml", type=str, default="FLUX_exp.yaml", help="experiment yaml file") + + args = parser.parse_args() + + # set device + device_number = args.device_number + device = torch.device(f"cuda:{device_number}" if torch.cuda.is_available() else "cpu") + + # load exp yaml file to dict + exp_yaml = args.exp_yaml + with open(exp_yaml) as file: + exp_configs = yaml.load(file, Loader=yaml.FullLoader) + + device = torch.device(f"cuda:{device_number}" if torch.cuda.is_available() else "cpu") + model_type = exp_configs[0]["model_type"] # currently only one model type per run + + if model_type == 'FLUX': + # pipe = FluxPipeline.from_pretrained("black-forest-labs/FLUX.1-schnell", torch_dtype=torch.float16) + pipe = FluxPipeline.from_pretrained("black-forest-labs/FLUX.1-dev", torch_dtype=torch.float16) + elif model_type == 'SD3': + pipe = StableDiffusion3Pipeline.from_pretrained("stabilityai/stable-diffusion-3-medium-diffusers", torch_dtype=torch.float16) + else: + raise NotImplementedError(f"Model type {model_type} not implemented") + + scheduler = pipe.scheduler + pipe = pipe.to(device) + + for exp_dict in exp_configs: + + exp_name = exp_dict["exp_name"] + # model_type = exp_dict["model_type"] + T_steps = exp_dict["T_steps"] + n_avg = exp_dict["n_avg"] + src_guidance_scale = exp_dict["src_guidance_scale"] + tar_guidance_scale = exp_dict["tar_guidance_scale"] + n_min = exp_dict["n_min"] + n_max = exp_dict["n_max"] + seed = exp_dict["seed"] + + # set seed + random.seed(seed) + np.random.seed(seed) + torch.manual_seed(seed) + torch.cuda.manual_seed_all(seed) + dataset_yaml = exp_dict["dataset_yaml"] + with open(dataset_yaml) as file: + dataset_configs = yaml.load(file, Loader=yaml.FullLoader) + + # check dataset_configs + for data_dict in dataset_configs: + tar_prompts = data_dict["target_prompts"] + + for data_dict in dataset_configs: + + src_prompt = data_dict["source_prompt"] + tar_prompts = data_dict["target_prompts"] + negative_prompt = "" # optionally add support for negative prompts (SD3) + image_src_path = data_dict["input_img"] + + # load image + image = Image.open(image_src_path) + # crop image to have both dimensions divisibe by 16 - avoids issues with resizing + image = image.crop((0, 0, image.width - image.width % 16, image.height - image.height % 16)) + image_src = pipe.image_processor.preprocess(image) + # cast image to half precision + image_src = image_src.to(device).half() + with torch.autocast("cuda"), torch.inference_mode(): + x0_src_denorm = pipe.vae.encode(image_src).latent_dist.mode() + x0_src = (x0_src_denorm - pipe.vae.config.shift_factor) * pipe.vae.config.scaling_factor + # send to cuda + x0_src = x0_src.to(device) + + for tar_num, tar_prompt in enumerate(tar_prompts): + + if model_type == 'SD3': + x0_tar = FlowEditSD3(pipe, + scheduler, + x0_src, + src_prompt, + tar_prompt, + negative_prompt, + T_steps, + n_avg, + src_guidance_scale, + tar_guidance_scale, + n_min, + n_max,) + + elif model_type == 'FLUX': + x0_tar = FlowEditFLUX(pipe, + scheduler, + x0_src, + src_prompt, + tar_prompt, + negative_prompt, + T_steps, + n_avg, + src_guidance_scale, + tar_guidance_scale, + n_min, + n_max,) + else: + raise NotImplementedError(f"Sampler type {model_type} not implemented") + + + x0_tar_denorm = (x0_tar / pipe.vae.config.scaling_factor) + pipe.vae.config.shift_factor + with torch.autocast("cuda"), torch.inference_mode(): + image_tar = pipe.vae.decode(x0_tar_denorm, return_dict=False)[0] + image_tar = pipe.image_processor.postprocess(image_tar) + + src_prompt_txt = data_dict["input_img"].split("/")[-1].split(".")[0] + + tar_prompt_txt = str(tar_num) + + # make sure to create the directories before saving + save_dir = f"outputs/{exp_name}/{model_type}/src_{src_prompt_txt}/tar_{tar_prompt_txt}" + os.makedirs(save_dir, exist_ok=True) + + image_tar[0].save(f"{save_dir}/output_T_steps_{T_steps}_n_avg_{n_avg}_cfg_enc_{src_guidance_scale}_cfg_dec{tar_guidance_scale}_n_min_{n_min}_n_max_{n_max}_seed{seed}.png") + # also save source and target prompt in txt file + with open(f"{save_dir}/prompts.txt", "w") as f: + f.write(f"Source prompt: {src_prompt}\n") + f.write(f"Target prompt: {tar_prompt}\n") + f.write(f"Seed: {seed}\n") + f.write(f"Sampler type: {model_type}\n") + + + + + + print("Done") + + # %% diff --git a/edit/chordedit/.gitignore b/edit/chordedit/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..860f418f55d16b974310897aa1a88fce5a7e879e --- /dev/null +++ b/edit/chordedit/.gitignore @@ -0,0 +1,2 @@ +.DS_Store +.vscode/ \ No newline at end of file diff --git a/edit/chordedit/LICENSE b/edit/chordedit/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..4233ca90543b3dddb9dd5afa202da4d060600240 --- /dev/null +++ b/edit/chordedit/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2026 Liangsi Lu + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/edit/chordedit/README.md b/edit/chordedit/README.md new file mode 100644 index 0000000000000000000000000000000000000000..92323d7f89b399d585b8a5ae3f1642b6976a4bc0 --- /dev/null +++ b/edit/chordedit/README.md @@ -0,0 +1,72 @@ +
+

[CVPR 2026 Oral] ChordEdit: One-Step Low-Energy Transport for Image Editing

+
+ Liangsi Lu1, Xuhang Chen2, Minzhe Guo1, Shichu Li3, Jingchao Wang4, Yang Shi1†
+ 1 Guangdong University of Technology, 2 Huizhou University, 3 Shenzhen University, 4 Peking University
Corresponding author
+
+ + + + + ChordEdit demo +
+ +## 1. Environment +- Python 3.12 +- PyTorch 2.5.0 +- This repository requires the `sd-turbo` weights: https://huggingface.co/stabilityai/sd-turbo +- Model root should contain: + - `unet/` + - `scheduler/` + - `text_encoder/` + - `tokenizer/` + - `vae/` + +## 2. Install Dependencies +```bash +pip install -r requirement.txt +``` + +## 3. Run the Web Demo +Launch the interactive demo: +```bash +python app.py --model-root /path/to/sd-turbo --server-port 7860 +``` + +Running `python app.py` now launches a local Gradio web app. +- Left panel: upload the original image, set source prompt, target prompt, and tuning parameters. +- Right panel: view the edited output image. +- Bottom section: click built-in examples (image + source prompt + target prompt) to auto-fill inputs. + +ChordEdit app + +## 4. Run PIE Benchmark Export +Run PIE-Bench export with: +```bash +python run_pie_bench.py --model-root /path/to/sd-turbo --pie-root /path/to/pie_bench +``` +`--pie-root` should point to a PIE-Bench folder containing at least: + +1. `annotation_images/` — original PIE-Bench images (subfolders keep the official naming). +2. `mapping_file.json` — the mapping metadata describing prompts, instructions, and masks. + +Example layout: +``` +pie_bench +|-annotation_images +|-mapping_file.json +``` + +For PIE-Bench data preparation and protocol details, please refer to: +https://github.com/cure-lab/PnPInversion + +# Citation +If you find our work helpful, please **star 🌟** this repo and **cite 📑** our paper. Thanks for your support! +``` +@article{lu2026chordedit, + title={ChordEdit: One-Step Low-Energy Transport for Image Editing}, + author={Lu, Liangsi and Chen, Xuhang and Guo, Minzhe and Li, Shichu and Wang, Jingchao and Shi, Yang}, + journal={arXiv preprint arXiv:2602.19083}, + year={2026} +} +``` diff --git a/edit/chordedit/__pycache__/pipeline_chord.cpython-312.pyc b/edit/chordedit/__pycache__/pipeline_chord.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..2afe26a729b304d09148c26e2e38d58615364a72 Binary files /dev/null and b/edit/chordedit/__pycache__/pipeline_chord.cpython-312.pyc differ diff --git a/edit/chordedit/app.py b/edit/chordedit/app.py new file mode 100644 index 0000000000000000000000000000000000000000..7145f58b57b71e43d27c8e115933c46c0578023b --- /dev/null +++ b/edit/chordedit/app.py @@ -0,0 +1,437 @@ +from __future__ import annotations + +import argparse +import json +import logging +from pathlib import Path +from typing import Any, Dict, List, Optional + +import gradio as gr +import torch +from PIL import Image + +from pipeline_chord import ChordEditPipeline +from utils import DEFAULT_DATA_ROOT + + +LOGGER = logging.getLogger("chord_app") + + +# Model root and component layout. +COMPONENT_SUBDIRS: Dict[str, str] = { + "unet_path": "unet", + "scheduler_path": "scheduler", + "text_encoder_path": "text_encoder", + "tokenizer_path": "tokenizer", + "vae_path": "vae", +} +DEFAULT_MODEL_ROOT = "/sd-turbo" +DEFAULT_COMPONENT_PATHS: Dict[str, str] = { + key: str(Path(DEFAULT_MODEL_ROOT) / subdir) for key, subdir in COMPONENT_SUBDIRS.items() +} + +DEFAULT_EDIT_CONFIG: Dict[str, Any] = { + "noise_samples": 1, + "n_steps": 1, + "t_start": 0.90, + "t_end": 0.30, + "t_delta": 0.15, + "step_scale": 1.0, + "cleanup": True, +} + +DEFAULT_SEED = 42 +DEFAULT_PRECISION = "fp32" +DEFAULT_IMAGE_SIZE = 512 +DEFAULT_MAX_EXAMPLES = 24 +DEFAULT_SERVER_NAME = "127.0.0.1" +DEFAULT_SERVER_PORT = 7860 +DEFAULT_CENTER_CROP = True +DEFAULT_USE_ATTENTION_MASK = False +DEFAULT_USE_SAFETY_CHECKER = False +_IMAGE_EXTENSIONS = {".jpg", ".jpeg", ".png", ".bmp", ".webp"} +SQUARE_PREVIEW_CSS = """ +#source-image-input { + width: 100% !important; +} + +#source-image-input .image-container, +#source-image-input [data-testid="image"] { + aspect-ratio: 1 / 1 !important; + overflow: hidden !important; + background: #00000008 !important; +} + +#source-image-input img, +#source-image-input canvas { + width: 100% !important; + height: 100% !important; + object-fit: cover !important; + object-position: center center !important; + display: block !important; + background: transparent !important; +} + +#editor-main-row { + align-items: center !important; +} + +#source-prompt textarea, +#target-prompt textarea { + height: 112px !important; + max-height: 112px !important; + overflow-y: auto !important; + resize: none !important; +} + +.panel-note p { + margin: 0 0 12px 0 !important; + line-height: 1.4 !important; + font-size: 0.95rem !important; + color: #666 !important; +} +""" + + +def parse_args() -> argparse.Namespace: + parser = argparse.ArgumentParser(description="Launch ChordEdit web app.") + parser.add_argument( + "--model-root", + type=str, + default=DEFAULT_MODEL_ROOT, + help="Root folder containing unet/scheduler/text_encoder/tokenizer/vae subfolders.", + ) + parser.add_argument("--server-port", type=int, default=DEFAULT_SERVER_PORT, help="Web server port.") + return parser.parse_args() + + +def _dtype_from_precision(value: Optional[str]) -> torch.dtype: + precision = (value or DEFAULT_PRECISION).lower() + mapping = { + "fp32": torch.float32, + "fp16": torch.float16, + "bf16": torch.bfloat16, + } + if precision not in mapping: + raise ValueError(f"Unsupported precision '{value}'. Choose from {list(mapping)}.") + return mapping[precision] + + +def _paths_from_model_root(model_root: str | Path) -> Dict[str, str]: + root = Path(model_root).expanduser().resolve() + return {key: str((root / subdir).resolve()) for key, subdir in COMPONENT_SUBDIRS.items()} + + +def _expand_paths(path_map: Dict[str, str | None]) -> Dict[str, str]: + expanded: Dict[str, str] = {} + missing: List[str] = [] + for key in COMPONENT_SUBDIRS: + value = path_map.get(key) + final_value = value if value is not None else DEFAULT_COMPONENT_PATHS.get(key) + if final_value is None: + missing.append(key) + continue + expanded[key] = str(Path(final_value).expanduser().resolve()) + if missing: + raise ValueError( + f"Missing required component paths for: {missing}. " + "Set --model-root or provide per-component paths." + ) + return expanded + + +def _resolve_component_paths(model_root: str | Path) -> Dict[str, str]: + return _expand_paths(_paths_from_model_root(model_root)) + + +def _select_image_file(folder: Path) -> Path: + candidates = [ + p for p in folder.iterdir() if p.is_file() and p.suffix.lower() in _IMAGE_EXTENSIONS + ] + if not candidates: + raise FileNotFoundError(f"No RGB image found inside {folder}") + + preferred = sorted( + (p for p in candidates if p.stem.lower() in {"i", "image", "original"}), + key=lambda p: p.name, + ) + if preferred: + return preferred[0] + return sorted(candidates, key=lambda p: p.name)[0] + + +def load_examples(dataset_root: Path, max_examples: Optional[int]) -> List[List[Any]]: + examples: List[List[Any]] = [] + if not dataset_root.exists(): + LOGGER.warning("Example dataset does not exist: %s", dataset_root) + return examples + + for subdir in sorted(p for p in dataset_root.iterdir() if p.is_dir()): + meta_file = subdir / "meta.jsonl" + if not meta_file.exists(): + continue + + try: + image_path = _select_image_file(subdir) + except FileNotFoundError: + LOGGER.warning("No image found in %s", subdir) + continue + + with meta_file.open("r", encoding="utf-8") as handle: + for line_number, raw_line in enumerate(handle, start=1): + line = raw_line.strip() + if not line: + continue + try: + record = json.loads(line) + except json.JSONDecodeError as exc: + LOGGER.warning("Skipping invalid JSON in %s:%d (%s)", meta_file, line_number, exc) + continue + + src_prompt = str(record.get("original_prompt", "")).strip() + tgt_prompt = str(record.get("edited_prompt", "")).strip() + examples.append([str(image_path), src_prompt, tgt_prompt]) + + if max_examples is not None and len(examples) >= max_examples: + return examples + + return examples + + +def _validate_inputs( + image: Optional[Image.Image], + source_prompt: str, + target_prompt: str, + t_start: float, + t_end: float, + t_delta: float, +) -> None: + if image is None: + raise gr.Error("Please upload a source image first.") + if not source_prompt or not source_prompt.strip(): + raise gr.Error("Please provide the source image prompt.") + if not target_prompt or not target_prompt.strip(): + raise gr.Error("Please provide the target image prompt.") + if t_start <= t_end: + raise gr.Error("Invalid parameters: t_start must be greater than t_end.") + if t_delta < 0: + raise gr.Error("Invalid parameters: t_delta must be greater than or equal to 0.") + + +def build_demo( + pipeline: ChordEditPipeline, + default_seed: int, + default_edit_config: Dict[str, Any], + examples: List[List[Any]], +) -> gr.Blocks: + def run_edit( + image: Optional[Image.Image], + source_prompt: str, + target_prompt: str, + seed: float, + n_samples: float, + t_start: float, + t_end: float, + t_delta: float, + step_scale: float, + ) -> Image.Image: + _validate_inputs(image, source_prompt, target_prompt, t_start, t_end, t_delta) + + seed_int = int(seed) + edit_config = { + "noise_samples": int(n_samples), + "n_steps": int(default_edit_config.get("n_steps", 1)), + "t_start": float(t_start), + "t_end": float(t_end), + "t_delta": float(t_delta), + "step_scale": float(step_scale), + "cleanup": bool(default_edit_config.get("cleanup", True)), + } + + try: + result = pipeline( + image=image, + source_prompt=source_prompt.strip(), + target_prompt=target_prompt.strip(), + edit_config=edit_config, + seed=seed_int, + ) + except Exception as exc: + LOGGER.exception("Editing failed.") + raise gr.Error(f"Editing failed: {exc}") from exc + + images = result.images + if not isinstance(images, list): + raise gr.Error("The pipeline did not return PIL images. Please check output_type.") + if not images: + raise gr.Error("The pipeline returned no output image.") + return images[0] + + with gr.Blocks(title="ChordEdit App", css=SQUARE_PREVIEW_CSS) as demo: + gr.Markdown("# ChordEdit App") + gr.Markdown( + 'To study artifacts and background leakage of the one-step editor without Chord Control, set `t_delta` to `0`.\n' + 'Images shown in the paper are available in the "Examples" list below.', + elem_classes=["panel-note"], + ) + + with gr.Row(elem_id="editor-main-row"): + with gr.Column(scale=5, elem_id="left-input-panel"): + with gr.Group(): + with gr.Row(): + with gr.Column(scale=1, min_width=280): + input_image = gr.Image( + type="pil", + label="Source Image", + sources=["upload", "clipboard"], + elem_id="source-image-input", + height=320, + ) + with gr.Column(scale=1, min_width=280): + source_prompt = gr.Textbox( + label="Source Prompt", + lines=4, + max_lines=4, + placeholder="Example: A cat on a sofa", + elem_id="source-prompt", + ) + target_prompt = gr.Textbox( + label="Target Prompt", + lines=4, + max_lines=4, + placeholder="Example: A cat wearing sunglasses", + elem_id="target-prompt", + ) + + gr.Markdown("### Parameters") + n_samples_default = int( + default_edit_config.get("n_samples", default_edit_config.get("noise_samples", 1)) + ) + with gr.Row(): + seed_input = gr.Number(label="Seed", value=int(default_seed), precision=0) + n_samples_input = gr.Slider( + label="n_samples", + minimum=1, + maximum=16, + step=1, + value=n_samples_default, + ) + step_scale_input = gr.Slider( + label="step_scale", + minimum=0.1, + maximum=5.0, + step=0.1, + value=float(default_edit_config.get("step_scale", 1.0)), + ) + with gr.Row(): + t_start_input = gr.Slider( + label="t_start", + minimum=0.01, + maximum=1.0, + step=0.01, + value=float(default_edit_config.get("t_start", 0.90)), + ) + t_end_input = gr.Slider( + label="t_end", + minimum=0.0, + maximum=0.99, + step=0.01, + value=float(default_edit_config.get("t_end", 0.30)), + ) + t_delta_input = gr.Slider( + label="t_delta", + minimum=0.0, + maximum=0.5, + step=0.01, + value=float(default_edit_config.get("t_delta", 0.15)), + ) + + run_button = gr.Button("Run Edit", variant="primary") + + with gr.Column(scale=5, elem_id="right-output-panel"): + with gr.Group(): + output_image = gr.Image( + type="pil", + label="Editing Result", + elem_id="result-image-output", + height=440, + ) + + run_inputs = [ + input_image, + source_prompt, + target_prompt, + seed_input, + n_samples_input, + t_start_input, + t_end_input, + t_delta_input, + step_scale_input, + ] + + run_button.click(fn=run_edit, inputs=run_inputs, outputs=output_image) + target_prompt.submit(fn=run_edit, inputs=run_inputs, outputs=output_image) + + if examples: + gr.Markdown("## Examples") + gr.Examples( + examples=examples, + inputs=[input_image, source_prompt, target_prompt], + label="Click an example to auto-fill the left-side inputs.", + ) + else: + gr.Markdown("## Examples") + gr.Markdown("No valid examples were found under the current dataset path.") + + return demo + + +def main() -> None: + args = parse_args() + + logging.basicConfig( + level=logging.INFO, + format="%(asctime)s | %(levelname)s | %(name)s | %(message)s", + ) + + component_paths = _resolve_component_paths(model_root=args.model_root) + edit_config = dict(DEFAULT_EDIT_CONFIG) + seed = DEFAULT_SEED + torch_dtype = _dtype_from_precision(DEFAULT_PRECISION) + compute_dtype = torch.float32 + + dataset_root = DEFAULT_DATA_ROOT + examples = load_examples(dataset_root=dataset_root, max_examples=DEFAULT_MAX_EXAMPLES) + + LOGGER.info("Loaded %d example records from %s", len(examples), dataset_root) + LOGGER.info("Seed: %s | Default edit config: %s", seed, edit_config) + LOGGER.info("Component paths: %s", component_paths) + + pipeline = ChordEditPipeline.from_local_weights( + component_paths=component_paths, + default_edit_config=edit_config, + device=None, + torch_dtype=torch_dtype, + image_size=DEFAULT_IMAGE_SIZE, + use_center_crop=DEFAULT_CENTER_CROP, + compute_dtype=compute_dtype, + use_attention_mask=DEFAULT_USE_ATTENTION_MASK, + use_safety_checker=DEFAULT_USE_SAFETY_CHECKER, + ) + + demo = build_demo( + pipeline=pipeline, + default_seed=seed, + default_edit_config=edit_config, + examples=examples, + ) + + demo.queue(api_open=False) + demo.launch( + server_name=DEFAULT_SERVER_NAME, + server_port=args.server_port, + ) + + +if __name__ == "__main__": + main() diff --git a/edit/chordedit/chord_app.png b/edit/chordedit/chord_app.png new file mode 100644 index 0000000000000000000000000000000000000000..daeb69e268865710eee3e422de00d49c1a5ed6e7 --- /dev/null +++ b/edit/chordedit/chord_app.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9ee7cfe1e8d7c82e4646482e4e77130ae58ce41785416bf1373238ecf6ed29a4 +size 1985354 diff --git a/edit/chordedit/chord_show.gif b/edit/chordedit/chord_show.gif new file mode 100644 index 0000000000000000000000000000000000000000..f424d6fbcb6391d9ed0cabf090ea3d38cbdc84f8 --- /dev/null +++ b/edit/chordedit/chord_show.gif @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f1f541f0c89af4846a2c4b18c685ee466bf8d4c52ff275180c5da15d0dbff1a8 +size 5730430 diff --git a/edit/chordedit/images/001/i.jpg b/edit/chordedit/images/001/i.jpg new file mode 100644 index 0000000000000000000000000000000000000000..b67cffd6d1fa1fd8cdb7c4e873702eaf9145b536 --- /dev/null +++ b/edit/chordedit/images/001/i.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f4aaff9d1ffbd4685eebf82ce1704cf819bc038101e5f1f44b044bd330ec3bfa +size 325385 diff --git a/edit/chordedit/images/001/meta.jsonl b/edit/chordedit/images/001/meta.jsonl new file mode 100644 index 0000000000000000000000000000000000000000..b2199f7753af520d763822f4b3675370b6f43622 --- /dev/null +++ b/edit/chordedit/images/001/meta.jsonl @@ -0,0 +1,3 @@ +{"edit_id":"e1","original_prompt":"A man wearing a dark suit, blue shirt, light blue tie, and a flat cap, standing outdoors with a neutral expression.","edited_prompt":"A man with a large beard wearing a dark suit, blue shirt, light blue tie, and a flat cap, standing outdoors with a neutral expression.","edit_prompt":"Added a large beard to the man’s face.","task_type":"object"} + + diff --git a/edit/chordedit/images/002/i.jpg b/edit/chordedit/images/002/i.jpg new file mode 100644 index 0000000000000000000000000000000000000000..72e01168e2ac70dfe77e35438c6078c80b617317 --- /dev/null +++ b/edit/chordedit/images/002/i.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4d5b893f0a75d013b8764966598a0c9a456290b9acfc6992e5af42b786504db1 +size 898143 diff --git a/edit/chordedit/images/002/meta.jsonl b/edit/chordedit/images/002/meta.jsonl new file mode 100644 index 0000000000000000000000000000000000000000..c01608348645f420e898121927bc85436e719cd8 --- /dev/null +++ b/edit/chordedit/images/002/meta.jsonl @@ -0,0 +1,2 @@ +{"edit_id":"e1","original_prompt":"A plate of rolled wraps, topped with diced tomatoes and greens, served with orange sauce on a beige plate.","edited_prompt":"A plate with a cooked steak served with orange sauce on a beige plate.","edit_prompt":"Replaced the rolled wraps with a steak as the main dish.","task_type":"object"} + diff --git a/edit/chordedit/images/003/i.jpg b/edit/chordedit/images/003/i.jpg new file mode 100644 index 0000000000000000000000000000000000000000..e64c3783b323223d901277cd1c924303ec6b9a28 --- /dev/null +++ b/edit/chordedit/images/003/i.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:eccca5ec781b772f1800d6f226720ee2f089986660ae7583788d7c8283677b3d +size 985649 diff --git a/edit/chordedit/images/003/meta.jsonl b/edit/chordedit/images/003/meta.jsonl new file mode 100644 index 0000000000000000000000000000000000000000..9a678751996b66861e45524bc4747742519135e1 --- /dev/null +++ b/edit/chordedit/images/003/meta.jsonl @@ -0,0 +1 @@ +{"edit_id":"e1","original_prompt":"A white horse with a light mane is running gracefully across a grassy field, surrounded by dark green foliage in the background. Sunlight highlights parts of the grass and the horse’s body.","edited_prompt":"A white unicorn with a glowing silver horn is running gracefully across the same grassy field, surrounded by dark green foliage in the background. The sunlight remains consistent.","edit_prompt":"Replace the horse with a unicorn featuring a glowing silver horn. Preserve background foliage, composition, and lighting.","task_type":"object"} diff --git a/edit/chordedit/images/004/i.jpg b/edit/chordedit/images/004/i.jpg new file mode 100644 index 0000000000000000000000000000000000000000..0640e35a10e7c2cf72a0cc90df477eb01f42db9a --- /dev/null +++ b/edit/chordedit/images/004/i.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:dd900f3d9fc6862f757c5662313fc2596fe653937596e8560455d9db3d7bf4bf +size 924446 diff --git a/edit/chordedit/images/004/meta.jsonl b/edit/chordedit/images/004/meta.jsonl new file mode 100644 index 0000000000000000000000000000000000000000..f5d6e6c435becd23d841b92c2cd4658e08ba0d96 --- /dev/null +++ b/edit/chordedit/images/004/meta.jsonl @@ -0,0 +1,3 @@ +{"edit_id":"e1","original_prompt":"A fox stands on a rocky ledge with a soft mountain background and pale sky, gazing forward with alert eyes.","edited_prompt":"A dog stands on a rocky ledge with a soft mountain background and pale sky, gazing forward with a calm expression. The lighting and perspective remain natural and consistent with the original setting.","edit_prompt":"Replace the fox with a realistic dog in the same position, matching the lighting, angle, and natural environment.","task_type":"object"} + + diff --git a/edit/chordedit/images/005/i.jpg b/edit/chordedit/images/005/i.jpg new file mode 100644 index 0000000000000000000000000000000000000000..813e12986d39c69a13bf9d069ebbba5b0ae46a42 --- /dev/null +++ b/edit/chordedit/images/005/i.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:00448b6332bacc4634ee42c72671cc6de7f6e16576957606ab64bf2861224c3c +size 517176 diff --git a/edit/chordedit/images/005/meta.jsonl b/edit/chordedit/images/005/meta.jsonl new file mode 100644 index 0000000000000000000000000000000000000000..0e65c1734a2278b3a9779d8c30f23b32aff77685 --- /dev/null +++ b/edit/chordedit/images/005/meta.jsonl @@ -0,0 +1 @@ +{"edit_id":"e1","original_prompt":"Dark background. A cat with golden eyes lies on a dark surface wearing a shiny golden crown and a red ribbon on its back, illuminated by soft warm light.","edited_prompt":"Dark background. A cat with golden eyes lies on a dark surface wearing a red and white Christmas hat and a red ribbon on its back, illuminated by soft warm light, creating a cozy holiday atmosphere.","edit_prompt":"Replace the golden crown on the cat’s head with a red and white Christmas hat. Keep lighting, shadows, and the rest of the scene consistent.","task_type":"object"} \ No newline at end of file diff --git a/edit/chordedit/images/006/i.jpg b/edit/chordedit/images/006/i.jpg new file mode 100644 index 0000000000000000000000000000000000000000..94dd65d5a363faad95d463962c9116fbb8532f75 --- /dev/null +++ b/edit/chordedit/images/006/i.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6449c03f15a93faf4df1009ac8869d8636439204815527dd4d5a6a983e1e6a38 +size 2263637 diff --git a/edit/chordedit/images/006/meta.jsonl b/edit/chordedit/images/006/meta.jsonl new file mode 100644 index 0000000000000000000000000000000000000000..aba71dc1084319ce6989afb18079de9f23566095 --- /dev/null +++ b/edit/chordedit/images/006/meta.jsonl @@ -0,0 +1,2 @@ +{"edit_id":"e1","original_prompt":"A large house with red roofs by a lake surrounded by dense pine trees in autumn colors, reflected in the calm water.","edited_prompt":"A large house with red roofs by a frozen lake surrounded by snow-covered white trees, with snow falling from a cloudy sky.","edit_prompt":"Changed the scene from sunny autumn to snowy winter, making the trees white with snow, freezing the lake, and adding snowfall.","task_type":"object"} + diff --git a/edit/chordedit/images/007/i.jpg b/edit/chordedit/images/007/i.jpg new file mode 100644 index 0000000000000000000000000000000000000000..0b7a8e2e41931f1e8773f2d497dae2288770839d --- /dev/null +++ b/edit/chordedit/images/007/i.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3511586270fa66fc9500482aab3746c71d490cccd82c759de3965d44d98ad45b +size 1213367 diff --git a/edit/chordedit/images/007/meta.jsonl b/edit/chordedit/images/007/meta.jsonl new file mode 100644 index 0000000000000000000000000000000000000000..52fc40ca51f26484f8f1573700d2293a4f97d9f4 --- /dev/null +++ b/edit/chordedit/images/007/meta.jsonl @@ -0,0 +1 @@ +{"edit_id":"e1","original_prompt":"A brown dog running on green grass with a blurred hedge in the background.","edited_prompt":"A gray wolf running on green grass with a blurred hedge in the background.","edit_prompt":"Replaced the dog with a wolf while keeping the running pose and background unchanged.","task_type":"object"} diff --git a/edit/chordedit/images/008/i.jpg b/edit/chordedit/images/008/i.jpg new file mode 100644 index 0000000000000000000000000000000000000000..5b32e5c61c5e983d12ef697a822456b63c2fafc8 --- /dev/null +++ b/edit/chordedit/images/008/i.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:af4df1756b12e175c8bfe14a7ef4975efcda9d42fabb8500cf8699325c2be2b0 +size 758936 diff --git a/edit/chordedit/images/008/meta.jsonl b/edit/chordedit/images/008/meta.jsonl new file mode 100644 index 0000000000000000000000000000000000000000..dd40dbb93dfa9314fbf86d86bc23258f56fab06b --- /dev/null +++ b/edit/chordedit/images/008/meta.jsonl @@ -0,0 +1 @@ +{"edit_id":"e1","original_prompt":"A tall mountain rises under a partly cloudy blue sky, reflected perfectly in a calm body of water in the foreground. A few hikers in colorful jackets walk along the grassy ridge separating the water and the mountain base.","edited_prompt":"A towering volcano dominates the scene, with multiple streams of bright molten lava cascading dramatically down its slopes, glowing orange and red even in daylight. Thick gray smoke and faint ash drift from the crater into the sky. The reflection in the water vividly captures the fiery glow of the lava, while the hikers remain on the grassy ridge, dwarfed by the volcano’s intensity.","edit_prompt":"Transform the mountain into an active volcano with multiple visible lava flows streaming down its slopes, emitting bright orange-red light. Add smoke and ash rising from the crater. Ensure the lava’s glow is reflected in the water while keeping hikers, lighting, and composition consistent.","task_type":"object"} \ No newline at end of file diff --git a/edit/chordedit/outputs/chordedit_smoke_test.png b/edit/chordedit/outputs/chordedit_smoke_test.png new file mode 100644 index 0000000000000000000000000000000000000000..0570ffb7130a367e167385e16cd243bb82a85dac --- /dev/null +++ b/edit/chordedit/outputs/chordedit_smoke_test.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2852c2cf030992b1c8ab11da09a04ef772cad0e32865efdc24a5295d22a4756d +size 400134 diff --git a/edit/chordedit/pipeline_chord.py b/edit/chordedit/pipeline_chord.py new file mode 100644 index 0000000000000000000000000000000000000000..345d84b2145d6e325c6a9f9bcd0b25eb7feb516f --- /dev/null +++ b/edit/chordedit/pipeline_chord.py @@ -0,0 +1,523 @@ +from __future__ import annotations + +import logging +from dataclasses import dataclass +from typing import Any, Dict, List, Optional, Sequence + +import numpy as np +import torch +from PIL import Image, ImageOps +from diffusers import DDPMScheduler, AutoencoderKL, UNet2DConditionModel +from diffusers.pipelines.pipeline_utils import DiffusionPipeline +from diffusers.pipelines.stable_diffusion.safety_checker import StableDiffusionSafetyChecker +from diffusers.utils import BaseOutput +from torchvision import transforms +from torchvision.transforms import InterpolationMode +from transformers import AutoTokenizer, CLIPImageProcessor, CLIPTextModel + +DEFAULT_SEED = 42 +DEFAULT_COMPUTE_DTYPE = torch.float32 +DEFAULT_SAFETY_CHECKER_ID = "CompVis/stable-diffusion-safety-checker" + +LOGGER = logging.getLogger(__name__) + + +# --------------------------------------------------------------------------- +# Pipeline output container +# --------------------------------------------------------------------------- + + +@dataclass +class ChordEditPipelineOutput(BaseOutput): + images: List[Image.Image] | torch.Tensor + latents: torch.Tensor + + +class _CenterSquareCropTransform: + """Center-crop the shorter image dimension before resizing.""" + + def __call__(self, image: Image.Image) -> Image.Image: + width, height = image.size + if width == height: + return image + target = min(width, height) + try: + resample = Image.Resampling.LANCZOS # type: ignore[attr-defined] + except AttributeError: # pragma: no cover + resample = Image.LANCZOS + return ImageOps.fit( + image, + (target, target), + method=resample, + centering=(0.5, 0.5), + ) + + def __repr__(self) -> str: # pragma: no cover - debugging helper + return f"{self.__class__.__name__}()" + + +# --------------------------------------------------------------------------- +# ChordEdit Pipeline +# --------------------------------------------------------------------------- + + +class ChordEditPipeline(DiffusionPipeline): + """Standalone pipeline that wires up diffusers modules with the Chord editor.""" + + def __init__( + self, + unet: UNet2DConditionModel, + scheduler: DDPMScheduler, + vae: AutoencoderKL, + tokenizer, + text_encoder: CLIPTextModel, + default_edit_config: Optional[Dict[str, Any]] = None, + image_size: int = 512, + device: Optional[str | torch.device] = None, + compute_dtype: torch.dtype = DEFAULT_COMPUTE_DTYPE, + use_attention_mask: bool = False, + use_center_crop: bool = True, + use_safety_checker: bool = False, + safety_checker_id: Optional[str] = DEFAULT_SAFETY_CHECKER_ID, + ) -> None: + super().__init__() + self.register_modules( + unet=unet, + scheduler=scheduler, + vae=vae, + tokenizer=tokenizer, + text_encoder=text_encoder, + ) + self._device = torch.device( + device if device is not None else ("cuda" if torch.cuda.is_available() else "cpu") + ) + self._compute_dtype = compute_dtype + self._use_attention_mask = bool(use_attention_mask) + self.to(self._device) + self._set_compute_precision() + + self.default_edit_config = default_edit_config or {} + self.image_size = int(image_size) + self._use_center_crop = bool(use_center_crop) + self._vae_transform = self._build_vae_transform() + self.unet.eval() + self.vae.eval() + self.text_encoder.eval() + self._max_unet_timestep = self.scheduler.config.num_train_timesteps - 1 + self._use_safety_checker = bool(use_safety_checker) + self._safety_checker_id = safety_checker_id + self._safety_checker: Optional[StableDiffusionSafetyChecker] = None + self._safety_feature_extractor: Optional[CLIPImageProcessor] = None + if self._use_safety_checker: + self._init_safety_checker() + + def _set_compute_precision(self) -> None: + modules = (self.unet, self.vae, self.text_encoder) + for module in modules: + if module is not None: + module.to(device=self._device, dtype=self._compute_dtype) + def _init_safety_checker(self) -> None: + if not self._safety_checker_id: + LOGGER.warning("Safety checker requested but no identifier provided; disabling safety checks.") + self._use_safety_checker = False + return + try: + self._safety_checker = StableDiffusionSafetyChecker.from_pretrained( + self._safety_checker_id, + torch_dtype=self._compute_dtype, + ).to(self._device) + self._safety_feature_extractor = CLIPImageProcessor.from_pretrained(self._safety_checker_id) + except Exception as exc: # pragma: no cover - runtime dependency + LOGGER.warning("Failed to initialize safety checker (%s). Safety checks disabled.", exc) + self._safety_checker = None + self._safety_feature_extractor = None + self._use_safety_checker = False + + # ------------------------------------------------------------------ # + # Construction helpers + # ------------------------------------------------------------------ # + @classmethod + def from_local_weights( + cls, + component_paths: Dict[str, str], + *, + default_edit_config: Optional[Dict[str, Any]] = None, + device: Optional[str | torch.device] = None, + torch_dtype: torch.dtype = torch.float32, + image_size: int = 512, + use_center_crop: bool = True, + compute_dtype: torch.dtype = DEFAULT_COMPUTE_DTYPE, + use_attention_mask: bool = False, + use_safety_checker: bool = False, + safety_checker_id: Optional[str] = DEFAULT_SAFETY_CHECKER_ID, + ) -> "ChordEditPipeline": + """Instantiate the pipeline from individual component checkpoints.""" + + unet = UNet2DConditionModel.from_pretrained( + component_paths["unet_path"], + torch_dtype=torch_dtype, + ) + scheduler = DDPMScheduler.from_pretrained(component_paths["scheduler_path"]) + vae = AutoencoderKL.from_pretrained(component_paths["vae_path"], torch_dtype=torch_dtype) + tokenizer = AutoTokenizer.from_pretrained(component_paths["tokenizer_path"]) + text_encoder = CLIPTextModel.from_pretrained( + component_paths["text_encoder_path"], + torch_dtype=torch_dtype, + ) + return cls( + unet=unet, + scheduler=scheduler, + vae=vae, + tokenizer=tokenizer, + text_encoder=text_encoder, + default_edit_config=default_edit_config, + image_size=image_size, + device=device, + compute_dtype=compute_dtype, + use_attention_mask=use_attention_mask, + use_center_crop=use_center_crop, + use_safety_checker=use_safety_checker, + safety_checker_id=safety_checker_id, + ) + + # ------------------------------------------------------------------ # + # Public API + # ------------------------------------------------------------------ # + @torch.no_grad() + def __call__( + self, + image: Image.Image | torch.Tensor, + *, + source_prompt: str, + target_prompt: str, + edit_config: Optional[Dict[str, Any]] = None, + seed: Optional[int] = None, + output_type: str = "pil", + ) -> ChordEditPipelineOutput: + """Run ChordEdit once on a single image.""" + + cfg = dict(self.default_edit_config) + if edit_config: + cfg.update(edit_config) + required_keys = ["noise_samples", "n_steps", "t_start", "t_end", "t_delta", "step_scale"] + missing = [k for k in required_keys if k not in cfg] + if missing: + raise ValueError(f"edit_config is missing required keys: {missing}") + + pixel_values = self._prepare_image_tensor(image) + latents = self._encode_image_to_latent(pixel_values) + src_embed = self.encode_prompt([source_prompt]) + tgt_embed = self.encode_prompt([target_prompt]) + + output_latents: List[torch.Tensor] = [] + decoded_batches: List[torch.Tensor] = [] + + edit_params = self._prepare_edit_params(cfg) + seed_value = int(seed) if seed is not None else DEFAULT_SEED + + noise_list = self._prepare_noise_list( + latents=latents, + seed_value=seed_value, + num_noises=edit_params["noise_samples"], + ) + + x0_pred = self._run_edit( + x_src=latents, + src_embed=src_embed, + edit_embed=tgt_embed, + noise=noise_list, + params=edit_params, + ) + + decoded = self._decode_latent_to_image(x0_pred) + decoded, _ = self._apply_safety_checker(decoded) + output_latents.append(x0_pred.detach().cpu()) + decoded_batches.append(decoded.detach().cpu()) + + images_tensor = torch.cat(decoded_batches, dim=0) + latents_tensor = torch.cat(output_latents, dim=0) + images = self._tensor_to_pil(images_tensor) if output_type == "pil" else images_tensor + + return ChordEditPipelineOutput( + images=images, + latents=latents_tensor, + ) + + def encode_prompt(self, prompts: Sequence[str]) -> torch.Tensor: + """Public helper mirroring diffusers pipelines for text encoding.""" + return self._encode_text(prompts) + + # ------------------------------------------------------------------ # + # Internal helpers + # ------------------------------------------------------------------ # + def _prepare_image_tensor(self, image: Image.Image | torch.Tensor) -> torch.Tensor: + if isinstance(image, Image.Image): + vae_tensor = self._vae_transform(image) + elif torch.is_tensor(image): + tensor = image.float() + if tensor.ndim == 3: + tensor = tensor.unsqueeze(0) + if tensor.max() > 1.0: + tensor = tensor / 255.0 + tensor = tensor * 2.0 - 1.0 + vae_tensor = tensor + else: + raise TypeError("image must be a PIL.Image or a torch.Tensor.") + + if vae_tensor.ndim == 3: + vae_tensor = vae_tensor.unsqueeze(0) + if self._use_center_crop and vae_tensor.ndim == 4: + _, _, height, width = vae_tensor.shape + if height != width: + side = min(height, width) + top = (height - side) // 2 + left = (width - side) // 2 + vae_tensor = vae_tensor[:, :, top : top + side, left : left + side] + return vae_tensor.to(device=self._device, dtype=self._compute_dtype) + + def _encode_image_to_latent(self, pixel_values: torch.Tensor) -> torch.Tensor: + scaling_factor = getattr(self.vae.config, "scaling_factor", 1.0) + pixel_values = pixel_values.to(device=self._device, dtype=self._compute_dtype) + latents = self.vae.encode(pixel_values).latent_dist.mode() + latents = latents * scaling_factor + return latents.to(device=self._device, dtype=self._compute_dtype) + + def _decode_latent_to_image(self, latents: torch.Tensor) -> torch.Tensor: + scaling_factor = getattr(self.vae.config, "scaling_factor", 1.0) + latents = latents.to(device=self._device, dtype=self._compute_dtype) + decoded = self.vae.decode(latents / scaling_factor).sample + decoded = (decoded.clamp(-1.0, 1.0) + 1.0) / 2.0 + return decoded.to(dtype=self._compute_dtype) + + def _apply_safety_checker(self, images: torch.Tensor) -> tuple[torch.Tensor, List[bool]]: + batch = images.shape[0] + if ( + not self._use_safety_checker + or self._safety_checker is None + or self._safety_feature_extractor is None + or batch == 0 + ): + return images, [False] * batch + + images_clamped = images.detach().clamp(0.0, 1.0) + pil_images = self._tensor_to_pil(images_clamped) + try: + clip_input = self._safety_feature_extractor(images=pil_images, return_tensors="pt").to(self._device) + images_np = np.stack([np.array(img).astype(np.float32) / 255.0 for img in pil_images], axis=0) + images_np = images_np * 2.0 - 1.0 + _, has_nsfw_concept = self._safety_checker( + images=images_np, + clip_input=clip_input.pixel_values.to(self._device), + ) + except Exception as exc: # pragma: no cover - runtime guard + LOGGER.warning("Safety checker failed (%s). Skipping safety checks.", exc) + return images, [False] * batch + + if isinstance(has_nsfw_concept, torch.Tensor): + has_nsfw = has_nsfw_concept.detach().cpu().to(dtype=torch.bool).tolist() + else: + has_nsfw = [bool(flag) for flag in has_nsfw_concept] + + if any(has_nsfw): + for idx, flagged in enumerate(has_nsfw): + if flagged: + images[idx] = torch.zeros_like(images[idx]) + return images, has_nsfw + + def _encode_text(self, prompts: Sequence[str]) -> torch.Tensor: + inputs = self.tokenizer( + list(prompts), + padding="max_length", + truncation=True, + max_length=self.tokenizer.model_max_length, + return_tensors="pt", + ) + input_ids = inputs.input_ids.to(self._device) + attn_mask = inputs.attention_mask.to(self._device) if self._use_attention_mask else None + outputs = self.text_encoder(input_ids=input_ids, attention_mask=attn_mask) + if hasattr(outputs, "last_hidden_state"): + hidden = outputs.last_hidden_state + else: + hidden = outputs[0] + return hidden.to(device=self._device, dtype=self._compute_dtype) + + def _tensor_to_pil(self, tensor: torch.Tensor) -> List[Image.Image]: + tensor = tensor.detach().cpu().clamp(0.0, 1.0) + to_pil = transforms.ToPILImage() + return [to_pil(sample) for sample in tensor] + + def _build_vae_transform(self) -> transforms.Compose: + """Create image->latent preprocessing transform.""" + ops: List[Any] = [] + if self._use_center_crop: + ops.append(_CenterSquareCropTransform()) + resize_interp = InterpolationMode.LANCZOS + else: + resize_interp = InterpolationMode.BILINEAR + ops.append( + transforms.Resize( + (self.image_size, self.image_size), + interpolation=resize_interp, + ) + ) + ops.extend( + [ + transforms.ToTensor(), + transforms.Normalize([0.5, 0.5, 0.5], [0.5, 0.5, 0.5]), + ] + ) + return transforms.Compose(ops) + + def _prepare_edit_params(self, cfg: Dict[str, Any]) -> Dict[str, Any]: + params = dict(cfg) + params["noise_samples"] = int(max(1, params["noise_samples"])) + params["n_steps"] = int(max(1, params["n_steps"])) + params["t_start"] = float(max(0.0, min(1.0, params["t_start"]))) + params["t_end"] = float(max(0.0, min(params["t_start"], params["t_end"]))) + t_delta = float(max(0.0, min(1.0, params["t_delta"]))) + if t_delta >= params["t_start"]: + safe_max = max(1, self._max_unet_timestep) + t_delta = max(0.0, params["t_start"] - 1.0 / safe_max) + params["t_delta"] = t_delta + params["step_scale"] = float(params["step_scale"]) + params["cleanup"] = bool(params.get("cleanup", False)) + return params + + def _prepare_noise_list( + self, + latents: torch.Tensor, + seed_value: int, + num_noises: int, + ) -> List[torch.Tensor]: + torch.manual_seed(seed_value) + if torch.cuda.is_available(): + torch.cuda.manual_seed_all(seed_value) + noise_list = [ + torch.randn_like(latents, device=latents.device, dtype=self._compute_dtype) + for _ in range(num_noises) + ] + return noise_list + + def _time_to_index(self, batch: int, t_scalar: float, device, dtype=torch.long): + idx = round(self._max_unet_timestep * float(t_scalar)) + idx = max(0, min(self._max_unet_timestep, idx)) + return torch.full((batch,), idx, device=device, dtype=dtype) + + def _get_alpha_sigma(self, tensor: torch.Tensor, timesteps: torch.Tensor): + alphas_cumprod = self.scheduler.alphas_cumprod.to(dtype=torch.float32, device=tensor.device) + alpha_t = alphas_cumprod[timesteps].sqrt().view(-1, 1, 1, 1) + sigma_t = (1 - alphas_cumprod[timesteps]).sqrt().view(-1, 1, 1, 1) + alpha_t = alpha_t.to(dtype=tensor.dtype, device=tensor.device) + sigma_t = sigma_t.to(dtype=tensor.dtype, device=tensor.device) + eps = torch.finfo(alpha_t.dtype).eps + alpha_t = alpha_t.clamp(min=eps) + return alpha_t, sigma_t + + def _pred_x0(self, x_anchor, timesteps, cond, noise): + alpha_t, sigma_t = self._get_alpha_sigma(x_anchor, timesteps) + z_t = alpha_t * x_anchor + sigma_t * noise + noise_pred = self.unet( + sample=z_t, + timestep=timesteps, + encoder_hidden_states=cond, + return_dict=False, + )[0] + x0_pred = (z_t - sigma_t * noise_pred) / alpha_t + return x0_pred + + def _u_estimate(self, x_anchor, src_embed, edit_embed, noise, t_s: float, delta: float): + batch, device = x_anchor.shape[0], x_anchor.device + t_idx_s = self._time_to_index(batch, t_s, device=device) + t_idx_s0 = self._time_to_index(batch, max(0.0, t_s - delta), device=device) + + noises = noise if isinstance(noise, (list, tuple)) else [noise] + + alpha_s, sigma_s = self._get_alpha_sigma(x_anchor, t_idx_s) + alpha_prev, sigma_prev = self._get_alpha_sigma(x_anchor, t_idx_s0) + + num_noises = len(noises) + noise_stack = torch.stack(noises, dim=0) + + x_anchor_b = x_anchor.unsqueeze(0).expand(num_noises, -1, -1, -1, -1) + alpha_s_b = alpha_s.unsqueeze(0).expand(num_noises, -1, -1, -1, -1) + alpha_prev_b = alpha_prev.unsqueeze(0).expand(num_noises, -1, -1, -1, -1) + sigma_s_b = sigma_s.unsqueeze(0).expand(num_noises, -1, -1, -1, -1) + sigma_prev_b = sigma_prev.unsqueeze(0).expand(num_noises, -1, -1, -1, -1) + + z_s = alpha_s_b * x_anchor_b + sigma_s_b * noise_stack + z_prev = alpha_prev_b * x_anchor_b + sigma_prev_b * noise_stack + + samples = torch.stack([z_s, z_s, z_prev, z_prev], dim=1) + samples = samples.reshape(num_noises * 4 * batch, *x_anchor.shape[1:]) + + conds = torch.cat([src_embed, edit_embed, src_embed, edit_embed], dim=0) + repeat_dims = [num_noises] + [1] * (conds.dim() - 1) + conds = conds.repeat(*repeat_dims) + + timesteps = torch.cat([t_idx_s, t_idx_s, t_idx_s0, t_idx_s0], dim=0) + timesteps = timesteps.repeat(num_noises) + + alpha_cat = torch.stack( + [alpha_s_b, alpha_s_b, alpha_prev_b, alpha_prev_b], + dim=1, + ).reshape(num_noises * 4 * batch, 1, 1, 1) + sigma_cat = torch.stack( + [sigma_s_b, sigma_s_b, sigma_prev_b, sigma_prev_b], + dim=1, + ).reshape(num_noises * 4 * batch, 1, 1, 1) + + noise_pred = self.unet( + sample=samples, + timestep=timesteps, + encoder_hidden_states=conds, + return_dict=False, + )[0] + + x0_all = (samples - sigma_cat * noise_pred) / alpha_cat + x0_all = x0_all.reshape(num_noises, 4, batch, *x_anchor.shape[1:]) + x_src_p_s, x_tar_p_s, x_src_p_s0, x_tar_p_s0 = x0_all.unbind(dim=1) + + dv_s = (x_tar_p_s - x_src_p_s).sum(dim=0) / float(num_noises) + dv_s0 = (x_tar_p_s0 - x_src_p_s0).sum(dim=0) / float(num_noises) + + denom = (t_s + delta) + if denom <= 1e-6: + return dv_s + return (delta * dv_s + t_s * dv_s0) / denom + + def _run_edit( + self, + x_src: torch.Tensor, + src_embed: torch.Tensor, + edit_embed: torch.Tensor, + noise: List[torch.Tensor], + params: Dict[str, Any], + ) -> torch.Tensor: + device = x_src.device + if params["n_steps"] == 1: + t_grid = [params["t_start"]] + else: + t_grid = torch.linspace( + params["t_start"], + params["t_end"], + steps=params["n_steps"], + device=device, + ).tolist() + + x_curr = x_src + for t_s in t_grid: + u_hat = self._u_estimate( + x_curr, + src_embed, + edit_embed, + noise, + float(t_s), + params["t_delta"], + ) + x_curr = x_curr + params["step_scale"] * u_hat + + if params["cleanup"]: + t_end_idx = self._time_to_index(x_src.shape[0], params["t_end"], device=device) + x_curr = self._pred_x0(x_curr, t_end_idx, edit_embed, noise[0]) + + return x_curr diff --git a/edit/chordedit/requirement.txt b/edit/chordedit/requirement.txt new file mode 100644 index 0000000000000000000000000000000000000000..9642c4ec6db7157582e17cc15fec32ce72b00213 --- /dev/null +++ b/edit/chordedit/requirement.txt @@ -0,0 +1,14 @@ +torch==2.5.0+cu124 +torchaudio==2.5.0+cu124 +torchvision==0.20.0+cu124 +torchmetrics==1.8.2 +torch-fidelity==0.3.0 +numpy +matplotlib +seaborn +Pillow +pyyaml +datasets +transformers +diffusers +gradio diff --git a/edit/chordedit/run_pie_bench.py b/edit/chordedit/run_pie_bench.py new file mode 100644 index 0000000000000000000000000000000000000000..de6208bd4b1b54b4edec51d00b591acd6011be19 --- /dev/null +++ b/edit/chordedit/run_pie_bench.py @@ -0,0 +1,452 @@ +from __future__ import annotations + +import argparse +import json +import logging +import shutil +from dataclasses import dataclass +from pathlib import Path +from typing import Any, Dict, List, Optional + +import torch +from PIL import Image + +from pipeline_chord import ChordEditPipeline +from utils import first_param_point, load_yaml_config + + +LOGGER = logging.getLogger("pie_bench") + +# model root + expected component subdirectories +COMPONENT_SUBDIRS: Dict[str, str] = { + "unet_path": "unet", + "scheduler_path": "scheduler", + "text_encoder_path": "text_encoder", + "tokenizer_path": "tokenizer", + "vae_path": "vae", +} +DEFAULT_MODEL_ROOT = "/sd-turbo" +DEFAULT_COMPONENT_PATHS: Dict[str, str] = { + key: str(Path(DEFAULT_MODEL_ROOT) / subdir) for key, subdir in COMPONENT_SUBDIRS.items() +} + +DEFAULT_EDIT_CONFIG = { + "noise_samples": 1, + "n_steps": 1, + "t_start": 0.90, + "t_end": 0.30, + "t_delta": 0.15, + "step_scale": 1.0, + "cleanup": True, +} + +DEFAULT_SEED = 42 +DEFAULT_PRECISION = "fp32" + +DEFAULT_PIE_ROOT = Path(__file__).resolve().parent / "pie_bench" +DEFAULT_MAPPING_FILE = "mapping_file.json" +DEFAULT_IMAGE_SUBDIR = "annotation_images" +DEFAULT_METHOD_NAME = "ChordEdit" + + +@dataclass(frozen=True) +class PieRecord: + sample_id: str + image_path: Path + relative_path: Path + original_prompt: str + edited_prompt: str + edit_instruction: str + + +def parse_args() -> argparse.Namespace: + parser = argparse.ArgumentParser(description="Run ChordEdit on PIE-Bench data and export PIE-format results.") + parser.add_argument("--config", type=str, default=None, help="Optional YAML config describing edit params.") + parser.add_argument( + "--model-root", + type=str, + default=DEFAULT_MODEL_ROOT, + help="Root folder containing unet/scheduler/text_encoder/tokenizer/vae subfolders.", + ) + parser.add_argument("--device", type=str, default=None, help="Torch device override, e.g. cuda:0 or cpu.") + parser.add_argument("--precision", choices=["fp32", "fp16", "bf16"], default=None, help="Computation precision.") + parser.add_argument("--seed", type=int, default=None, help="Random seed overriding the config file.") + parser.add_argument("--noise-samples", type=int, default=None, help="Number of MC noise samples.") + parser.add_argument("--n-steps", type=int, default=None, help="Number of Chord iterations.") + parser.add_argument("--t-start", type=float, default=None, help="Edit timestep start.") + parser.add_argument("--t-end", type=float, default=None, help="Edit timestep end.") + parser.add_argument("--t-delta", type=float, default=None, help="Edit timestep delta.") + parser.add_argument("--step-scale", type=float, default=None, help="Edit update magnitude.") + parser.add_argument("--cleanup", action="store_true", help="Force cleanup on.") + parser.add_argument("--no-cleanup", action="store_true", help="Force cleanup off.") + parser.add_argument( + "--center-crop", + dest="center_crop", + action="store_true", + default=True, + help="Center-crop before resize for VAE preprocessing (default).", + ) + parser.add_argument( + "--no-center-crop", + dest="center_crop", + action="store_false", + help="Disable center crop before resizing.", + ) + parser.add_argument( + "--use-attention-mask", + action="store_true", + help="Pass attention masks to the text encoder (defaults off to mirror chord/src).", + ) + parser.add_argument( + "--safety-checker", + dest="use_safety_checker", + action="store_true", + help="Enable StableDiffusion safety checker before exporting images.", + ) + parser.add_argument( + "--no-safety-checker", + dest="use_safety_checker", + action="store_false", + default=False, + help="Disable safety checker (default).", + ) + parser.add_argument("--image-size", type=int, default=512, help="Resolution used when feeding the VAE.") + parser.add_argument("--max-samples", type=int, default=None, help="Only process the first N records.") + + parser.add_argument("--pie-root", type=str, default=None, help="Root directory of PIE-Bench data.") + parser.add_argument( + "--mapping-file", + type=str, + default=DEFAULT_MAPPING_FILE, + help="Mapping file path relative to --pie-root.", + ) + parser.add_argument( + "--image-subdir", + type=str, + default=DEFAULT_IMAGE_SUBDIR, + help="Subdirectory (inside --pie-root) containing the original PIE annotation images.", + ) + parser.add_argument( + "--export-root", + type=str, + default=None, + help="Directory that follows PIE-Bench layout (data/... + output/...). Defaults to --pie-root.", + ) + parser.add_argument( + "--method-name", + type=str, + default=DEFAULT_METHOD_NAME, + help="Name used under export_root/output//annotation_images.", + ) + parser.add_argument( + "--output-subdir", + type=str, + default=DEFAULT_IMAGE_SUBDIR, + help="Subdirectory inside output// for generated images.", + ) + parser.add_argument( + "--source-subdir", + type=str, + default=DEFAULT_IMAGE_SUBDIR, + help="Subdirectory inside data/ where original images are copied when --copy-source is set.", + ) + parser.add_argument("--copy-source", action="store_true", help="Copy the source PIE images into export_root/data.") + parser.add_argument( + "--mapping-dest", + type=str, + default="data/mapping_file.json", + help="Relative path (from export_root) to write the mapping file.", + ) + parser.add_argument( + "--no-sync-mapping", + action="store_true", + help="Skip copying the PIE mapping file into export_root.", + ) + parser.add_argument("--overwrite", action="store_true", help="Overwrite existing predictions when present.") + parser.add_argument( + "--log-every", + type=int, + default=25, + help="Progress logging interval in number of saved samples (0 disables incremental logs).", + ) + + return parser.parse_args() + + +def dtype_from_precision(value: Optional[str]) -> torch.dtype: + precision = (value or DEFAULT_PRECISION).lower() + mapping = { + "fp32": torch.float32, + "fp16": torch.float16, + "bf16": torch.bfloat16, + } + if precision not in mapping: + raise ValueError(f"Unsupported precision '{value}'. Choose from {list(mapping)}.") + return mapping[precision] + + +def expand_component_paths(path_map: Dict[str, Optional[str]]) -> Dict[str, str]: + expanded: Dict[str, str] = {} + for key in COMPONENT_SUBDIRS: + value = path_map.get(key) + fallback = DEFAULT_COMPONENT_PATHS.get(key) + final_value = value if value is not None else fallback + if final_value is None: + raise ValueError(f"Missing required path for '{key}'. Provide via config or CLI.") + expanded[key] = str(Path(final_value).expanduser().resolve()) + return expanded + + +def paths_from_model_root(model_root: str | Path) -> Dict[str, str]: + root = Path(model_root).expanduser().resolve() + return {key: str((root / subdir).resolve()) for key, subdir in COMPONENT_SUBDIRS.items()} + + +def load_pipeline_config(path: Optional[str]) -> tuple[Dict[str, Any], int, Optional[str]]: + if path is None: + return (dict(DEFAULT_EDIT_CONFIG), DEFAULT_SEED, DEFAULT_PRECISION) + + cfg = load_yaml_config(path) + editor_cfg = cfg.get("editor", {}) + seed_value = editor_cfg.get("seed") + if seed_value is None: + seed_list = editor_cfg.get("seed_list") + if isinstance(seed_list, (list, tuple)) and seed_list: + seed_value = seed_list[0] + elif seed_list is not None: + seed_value = seed_list + seed_value = int(seed_value) if seed_value is not None else DEFAULT_SEED + precision = editor_cfg.get("precision", DEFAULT_PRECISION) + + params_grid = editor_cfg.get("params_grid", {}) + edit_config = first_param_point(params_grid) if params_grid else dict(DEFAULT_EDIT_CONFIG) + + return edit_config, seed_value, precision + + +def apply_cli_overrides(args: argparse.Namespace, edit_config: Dict[str, Any], seed: Optional[int]) -> tuple[Dict[str, Any], int]: + overrides = { + "noise_samples": args.noise_samples, + "n_steps": args.n_steps, + "t_start": args.t_start, + "t_end": args.t_end, + "t_delta": args.t_delta, + "step_scale": args.step_scale, + } + for key, value in overrides.items(): + if value is not None: + edit_config[key] = value + + if args.cleanup: + edit_config["cleanup"] = True + elif args.no_cleanup: + edit_config["cleanup"] = False + + cli_seed = args.seed + seed_value = seed if cli_seed is None else cli_seed + if seed_value is None: + seed_value = DEFAULT_SEED + return edit_config, int(seed_value) + + +def resolve_path(base: Path, maybe_relative: str | Path) -> Path: + candidate = Path(maybe_relative) + if candidate.is_absolute(): + return candidate.expanduser().resolve() + return (base / candidate).expanduser().resolve() + + +def load_pie_records(root: Path, mapping_path: Path, image_subdir: str) -> List[PieRecord]: + if not mapping_path.exists(): + raise FileNotFoundError(f"PIE mapping file not found: {mapping_path}") + + with mapping_path.open("r", encoding="utf-8") as handle: + mapping = json.load(handle) + + if not isinstance(mapping, dict): + raise ValueError(f"Expected mapping JSON to be a dict, got {type(mapping).__name__}") + + img_root = (root / image_subdir).expanduser().resolve() + if not img_root.exists(): + raise FileNotFoundError(f"PIE image directory does not exist: {img_root}") + + records: List[PieRecord] = [] + for sample_id in sorted(mapping.keys()): + meta = mapping[sample_id] + rel_value = meta.get("image_path") + if rel_value is None: + LOGGER.warning("Sample %s is missing 'image_path'; skipping.", sample_id) + continue + rel_path = Path(rel_value) + abs_path = (img_root / rel_path).expanduser().resolve() + if not abs_path.exists(): + LOGGER.warning("Sample %s image not found at %s; skipping.", sample_id, abs_path) + continue + + original_prompt = meta.get("original_prompt") or meta.get("source_prompt") or "" + edited_prompt = meta.get("editing_prompt") or meta.get("edited_prompt") or meta.get("target_prompt") or "" + edit_instruction = meta.get("editing_instruction") or meta.get("edit_prompt") or edited_prompt + + records.append( + PieRecord( + sample_id=sample_id, + image_path=abs_path, + relative_path=rel_path, + original_prompt=original_prompt, + edited_prompt=edited_prompt, + edit_instruction=edit_instruction, + ) + ) + + if not records: + raise FileNotFoundError(f"No valid PIE records found in {mapping_path}.") + return records + + +def ensure_dir(path: Path) -> None: + path.mkdir(parents=True, exist_ok=True) + + +def copy_file(src: Path, dst: Path, *, overwrite: bool) -> None: + ensure_dir(dst.parent) + if overwrite or not dst.exists(): + shutil.copy2(src, dst) + + +def sync_mapping_file(mapping_path: Path, export_root: Path, dest_relative: str, *, overwrite: bool) -> None: + dest_path = resolve_path(export_root, dest_relative) + copy_file(mapping_path, dest_path, overwrite=overwrite) + + +def save_prediction(image: Image.Image, destination: Path, *, overwrite: bool) -> None: + ensure_dir(destination.parent) + if overwrite or not destination.exists(): + image.save(destination) + + +def main() -> None: + args = parse_args() + + logging.basicConfig( + level=logging.INFO, + format="%(asctime)s | %(levelname)s | %(name)s | %(message)s", + ) + + edit_config, seed, precision = load_pipeline_config(args.config) + edit_config, seed = apply_cli_overrides(args, edit_config, seed) + component_paths = expand_component_paths(paths_from_model_root(args.model_root)) + + precision_choice_raw = args.precision or precision or DEFAULT_PRECISION + precision_choice = precision_choice_raw.lower() + if precision_choice != "fp32": + LOGGER.warning( + "Precision '%s' requested, but PIE export forces fp32 for numerical stability.", + precision_choice_raw, + ) + precision_choice = "fp32" + torch_dtype = dtype_from_precision(precision_choice) + compute_dtype = torch.float32 + + pie_root = Path(args.pie_root).expanduser().resolve() if args.pie_root else DEFAULT_PIE_ROOT + export_root = Path(args.export_root).expanduser().resolve() if args.export_root else pie_root + mapping_path = resolve_path(pie_root, args.mapping_file) + + records = load_pie_records(pie_root, mapping_path, args.image_subdir) + if args.max_samples is not None: + records = records[: args.max_samples] + + if not records: + LOGGER.error("No PIE records to process. Check dataset paths.") + return + + LOGGER.info( + "Loaded %d PIE samples from %s (mapping=%s)", + len(records), + pie_root, + mapping_path, + ) + LOGGER.info("Seed %s | Edit config %s", seed, edit_config) + + pipeline = ChordEditPipeline.from_local_weights( + component_paths=component_paths, + default_edit_config=edit_config, + device=args.device, + torch_dtype=torch_dtype, + image_size=args.image_size, + use_center_crop=args.center_crop, + compute_dtype=compute_dtype, + use_attention_mask=args.use_attention_mask, + use_safety_checker=args.use_safety_checker, + ) + + output_dir = export_root / "output" / args.method_name / args.output_subdir + source_dir = export_root / "data" / args.source_subdir + ensure_dir(output_dir) + if args.copy_source: + ensure_dir(source_dir) + + if not args.no_sync_mapping: + sync_mapping_file(mapping_path, export_root, args.mapping_dest, overwrite=args.overwrite) + LOGGER.info("Synchronized mapping file to %s", resolve_path(export_root, args.mapping_dest)) + + processed = 0 + skipped = 0 + + for idx, record in enumerate(records, start=1): + rel_output_path = output_dir / record.relative_path + if rel_output_path.exists() and not args.overwrite: + skipped += 1 + continue + + try: + with Image.open(record.image_path) as img: + source_image = img.convert("RGB") + except Exception as exc: # pragma: no cover - defensive + LOGGER.error("Failed to read %s: %s", record.image_path, exc) + skipped += 1 + continue + + try: + result = pipeline( + image=source_image, + source_prompt=record.original_prompt, + target_prompt=record.edited_prompt, + seed=seed, + output_type="pil", + ) + except Exception as exc: # pragma: no cover - runtime safety + LOGGER.error("Pipeline failed on %s: %s", record.sample_id, exc) + skipped += 1 + continue + + images = result.images + if isinstance(images, list) and images: + generated = images[0] + elif torch.is_tensor(images): + # Fall back to tensor output if requested differently. + generated = pipeline._tensor_to_pil(images)[0] # type: ignore[attr-defined] + else: + LOGGER.warning("No images returned for sample %s; skipping.", record.sample_id) + skipped += 1 + continue + + save_prediction(generated, rel_output_path, overwrite=args.overwrite) + + if args.copy_source: + target_source_path = source_dir / record.relative_path + copy_file(record.image_path, target_source_path, overwrite=args.overwrite) + + processed += 1 + if args.log_every and processed % args.log_every == 0: + LOGGER.info("Saved %d/%d samples (skipped=%d)", processed, len(records), skipped) + + LOGGER.info( + "Finished PIE export. Saved %d sample(s), skipped %d (existing/errors). Results: %s", + processed, + skipped, + output_dir, + ) + + +if __name__ == "__main__": + main() diff --git a/edit/chordedit/utils.py b/edit/chordedit/utils.py new file mode 100644 index 0000000000000000000000000000000000000000..9753990b3aa0be79880c0db68cd524c9fc8f0542 --- /dev/null +++ b/edit/chordedit/utils.py @@ -0,0 +1,176 @@ +from __future__ import annotations + +import json +from dataclasses import dataclass +from pathlib import Path +from typing import Any, Dict, List, Optional, Sequence + +import yaml +from PIL import Image, ImageOps +from torch.utils.data import Dataset + + +DEFAULT_DATA_ROOT = Path(__file__).resolve().parent / "images" +_IMAGE_EXTENSIONS = {".jpg", ".jpeg", ".png", ".bmp", ".webp"} + + +def load_yaml_config(path: str | Path) -> Dict[str, Any]: + """Load a YAML file into a python dictionary.""" + path = Path(path) + with path.open("r", encoding="utf-8") as handle: + return yaml.safe_load(handle) + + +def first_param_point(params_grid: Dict[str, Sequence[Any]]) -> Dict[str, Any]: + """Select the first value from each parameter list for a quick default run.""" + + def _pick(value: Sequence[Any] | Any) -> Any: + if isinstance(value, Sequence) and not isinstance(value, (str, bytes)): + if not value: + raise ValueError("Param grid contains an empty list; cannot determine default.") + return value[0] + return value + + return {key: _pick(values) for key, values in params_grid.items()} + + +@dataclass(frozen=True) +class EditRecord: + image_path: Path + src_prompt: str + tgt_prompt: str + edit_prompt: str + edit_id: Optional[str] = None + + +class LocalEditDataset(Dataset): + """Simple dataset mirroring src/utils/mydataset.py for local demos.""" + + def __init__(self, records: List[EditRecord], image_size: int = 512, use_center_crop: bool = False) -> None: + if not records: + raise ValueError("No records found in the dataset root.") + self._records = records + self.image_size = int(image_size) + self._use_center_crop = bool(use_center_crop) + + def __len__(self) -> int: # type: ignore[override] + return len(self._records) + + def __getitem__(self, idx: int) -> Dict[str, Any]: # type: ignore[override] + record = self._records[idx] + image = Image.open(record.image_path).convert("RGB") + if self._use_center_crop: + image = _center_square_crop(image) + image = _resize_image(image, (self.image_size, self.image_size)) + + blank = Image.new("RGB", image.size, color=(255, 255, 255)) + return { + "id": record.edit_id or Path(record.image_path).stem, + "original_image": image, + "edited_image": blank, + "original_prompt": record.src_prompt, + "edited_prompt": record.tgt_prompt, + "edit_prompt": record.edit_prompt, + "image_path": str(record.image_path), + } + + +def load_local_dataset( + path: str | Path | None = None, + image_size: int = 512, + center_crop: bool = True, +) -> LocalEditDataset: + root = _resolve_dataset_root(path) + records = _parse_edit_records(root) + return LocalEditDataset(records=records, image_size=image_size, use_center_crop=center_crop) + + +def _resolve_dataset_root(path: str | Path | None) -> Path: + if path is not None: + root = Path(path).expanduser().resolve() + else: + root = DEFAULT_DATA_ROOT + if not root.exists(): + raise FileNotFoundError(f"Dataset root does not exist: {root}") + return root + + +def _parse_edit_records(root: Path) -> List[EditRecord]: + records: List[EditRecord] = [] + for subdir in sorted(p for p in root.iterdir() if p.is_dir()): + meta_file = subdir / "meta.jsonl" + if not meta_file.exists(): + continue + try: + image_path = _select_image_file(subdir) + except FileNotFoundError: + continue + + with meta_file.open("r", encoding="utf-8") as handle: + for line_num, raw_line in enumerate(handle, start=1): + raw_line = raw_line.strip() + if not raw_line: + continue + try: + record = json.loads(raw_line) + except json.JSONDecodeError as exc: + raise ValueError(f"Invalid JSON in {meta_file} at line {line_num}: {exc}") from exc + + records.append( + EditRecord( + image_path=image_path, + src_prompt=record.get("original_prompt", ""), + tgt_prompt=record.get("edited_prompt", ""), + edit_prompt=record.get("edit_prompt", record.get("edited_prompt", "")), + edit_id=record.get("edit_id"), + ) + ) + + if not records: + raise FileNotFoundError( + f"No edit samples found under {root}. Expected subdirectories with 'meta.jsonl' files." + ) + return records + + +def _select_image_file(folder: Path) -> Path: + candidates = [ + p for p in folder.iterdir() if p.is_file() and p.suffix.lower() in _IMAGE_EXTENSIONS + ] + if not candidates: + raise FileNotFoundError(f"No RGB image found inside {folder}") + + preferred = sorted( + (p for p in candidates if p.stem.lower() in {"i", "image", "original"}), + key=lambda p: p.name, + ) + if preferred: + return preferred[0] + return sorted(candidates, key=lambda p: p.name)[0] + + +def _center_square_crop(image: Image.Image) -> Image.Image: + width, height = image.size + if width == height: + return image + + target_size = min(width, height) + try: + resample = Image.Resampling.LANCZOS # type: ignore[attr-defined] + except AttributeError: # pragma: no cover + resample = Image.LANCZOS + + return ImageOps.fit( + image, + (target_size, target_size), + method=resample, + centering=(0.5, 0.5), + ) + + +def _resize_image(image: Image.Image, size: tuple[int, int]) -> Image.Image: + try: + resample = Image.Resampling.LANCZOS # type: ignore[attr-defined] + except AttributeError: # pragma: no cover + resample = Image.LANCZOS + return image.resize(size, resample=resample)