diff --git a/.cache/pip/http-v2/0/4/4/7/c/0447ce2249fdae0f8cf52a43e01f215eacdf7c35d89a248bd4b4ebaa.body b/.cache/pip/http-v2/0/4/4/7/c/0447ce2249fdae0f8cf52a43e01f215eacdf7c35d89a248bd4b4ebaa.body new file mode 100644 index 0000000000000000000000000000000000000000..54f4b81bb7f0dbeda43d3506b11b6dda1f49715a Binary files /dev/null and b/.cache/pip/http-v2/0/4/4/7/c/0447ce2249fdae0f8cf52a43e01f215eacdf7c35d89a248bd4b4ebaa.body differ diff --git a/.cache/pip/http-v2/3/3/2/7/a/3327a46f678846be6cb46f3352e6fba668d9664c70a79484c770e358 b/.cache/pip/http-v2/3/3/2/7/a/3327a46f678846be6cb46f3352e6fba668d9664c70a79484c770e358 new file mode 100644 index 0000000000000000000000000000000000000000..c5952729826b33804b6420da86d38fa1806a0c79 Binary files /dev/null and b/.cache/pip/http-v2/3/3/2/7/a/3327a46f678846be6cb46f3352e6fba668d9664c70a79484c770e358 differ diff --git a/.cache/pip/http-v2/3/8/6/0/e/3860e4de9ae53c79d2fd61419e9049df314ccc8b640782c02c6e2e2d b/.cache/pip/http-v2/3/8/6/0/e/3860e4de9ae53c79d2fd61419e9049df314ccc8b640782c02c6e2e2d new file mode 100644 index 0000000000000000000000000000000000000000..50076342bbeae8e51ca3ff9002a6961e0c7249ac Binary files /dev/null and b/.cache/pip/http-v2/3/8/6/0/e/3860e4de9ae53c79d2fd61419e9049df314ccc8b640782c02c6e2e2d differ diff --git a/.cache/pip/http-v2/3/9/b/0/3/39b032291f3825af700bccccb41d7507c739ba2f89c5bbbc5b7b490d.body b/.cache/pip/http-v2/3/9/b/0/3/39b032291f3825af700bccccb41d7507c739ba2f89c5bbbc5b7b490d.body new file mode 100644 index 0000000000000000000000000000000000000000..1508ae24cc326ebecb69864bbc23eb967f4e1275 Binary files /dev/null and b/.cache/pip/http-v2/3/9/b/0/3/39b032291f3825af700bccccb41d7507c739ba2f89c5bbbc5b7b490d.body differ diff --git a/.cache/pip/http-v2/4/3/e/a/8/43ea803ef69b1ff6bb6a759b6d0891ba2677cfcc307a77ebf42098b6 b/.cache/pip/http-v2/4/3/e/a/8/43ea803ef69b1ff6bb6a759b6d0891ba2677cfcc307a77ebf42098b6 new file mode 100644 index 0000000000000000000000000000000000000000..5ed36d884c8915de38bf85fc7c9c770954f9d879 Binary files /dev/null and b/.cache/pip/http-v2/4/3/e/a/8/43ea803ef69b1ff6bb6a759b6d0891ba2677cfcc307a77ebf42098b6 differ diff --git a/.cache/pip/http-v2/4/3/e/a/8/43ea803ef69b1ff6bb6a759b6d0891ba2677cfcc307a77ebf42098b6.body b/.cache/pip/http-v2/4/3/e/a/8/43ea803ef69b1ff6bb6a759b6d0891ba2677cfcc307a77ebf42098b6.body new file mode 100644 index 0000000000000000000000000000000000000000..1366dc581948896a3f3497add5946d2a7cd983b8 --- /dev/null +++ b/.cache/pip/http-v2/4/3/e/a/8/43ea803ef69b1ff6bb6a759b6d0891ba2677cfcc307a77ebf42098b6.body @@ -0,0 +1,1383 @@ +Metadata-Version: 2.1 +Name: pandas +Version: 3.0.5 +Summary: Powerful data structures for data analysis, time series, and statistics +Author-Email: The Pandas Development Team +License: BSD 3-Clause License + + Copyright (c) 2008-2011, AQR Capital Management, LLC, Lambda Foundry, Inc. and PyData Development Team + All rights reserved. + + Copyright (c) 2011-2026, Open source contributors. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + * Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + Copyright (c) 2010-2019 Keith Goodman + Copyright (c) 2019 Bottleneck Developers + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE.Copyright 2017- Paul Ganssle + Copyright 2017- dateutil contributors (see AUTHORS file) + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + The above license applies to all contributions after 2017-12-01, as well as + all contributions that have been re-licensed (see AUTHORS file for the list of + contributors who have re-licensed their code). + -------------------------------------------------------------------------------- + dateutil - Extensions to the standard Python datetime module. + + Copyright (c) 2003-2011 - Gustavo Niemeyer + Copyright (c) 2012-2014 - Tomi Pieviläinen + Copyright (c) 2014-2016 - Yaron de Leeuw + Copyright (c) 2015- - Paul Ganssle + Copyright (c) 2015- - dateutil contributors (see AUTHORS file) + + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + The above BSD License Applies to all code, even that also covered by Apache 2.0.# MIT License + + Copyright (c) 2019 Hadley Wickham; RStudio; and Evan Miller + + 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. + Based on http://opensource.org/licenses/MIT + + This is a template. Complete and ship as file LICENSE the following 2 + lines (only) + + YEAR: + COPYRIGHT HOLDER: + + and specify as + + License: MIT + file LICENSE + + Copyright (c) , + + 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. + The MIT License + + Copyright (c) 2008- Attractive Chaos + + 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.musl as a whole is licensed under the following standard MIT license: + + ---------------------------------------------------------------------- + Copyright © 2005-2020 Rich Felker, et al. + + 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. + ---------------------------------------------------------------------- + + Authors/contributors include: + + A. Wilcox + Ada Worcester + Alex Dowad + Alex Suykov + Alexander Monakov + Andre McCurdy + Andrew Kelley + Anthony G. Basile + Aric Belsito + Arvid Picciani + Bartosz Brachaczek + Benjamin Peterson + Bobby Bingham + Boris Brezillon + Brent Cook + Chris Spiegel + Clément Vasseur + Daniel Micay + Daniel Sabogal + Daurnimator + David Carlier + David Edelsohn + Denys Vlasenko + Dmitry Ivanov + Dmitry V. Levin + Drew DeVault + Emil Renner Berthing + Fangrui Song + Felix Fietkau + Felix Janda + Gianluca Anzolin + Hauke Mehrtens + He X + Hiltjo Posthuma + Isaac Dunham + Jaydeep Patil + Jens Gustedt + Jeremy Huntwork + Jo-Philipp Wich + Joakim Sindholt + John Spencer + Julien Ramseier + Justin Cormack + Kaarle Ritvanen + Khem Raj + Kylie McClain + Leah Neukirchen + Luca Barbato + Luka Perkov + M Farkas-Dyck (Strake) + Mahesh Bodapati + Markus Wichmann + Masanori Ogino + Michael Clark + Michael Forney + Mikhail Kremnyov + Natanael Copa + Nicholas J. Kain + orc + Pascal Cuoq + Patrick Oppenlander + Petr Hosek + Petr Skocik + Pierre Carrier + Reini Urban + Rich Felker + Richard Pennington + Ryan Fairfax + Samuel Holland + Segev Finer + Shiz + sin + Solar Designer + Stefan Kristiansson + Stefan O'Rear + Szabolcs Nagy + Timo Teräs + Trutz Behn + Valentin Ochs + Will Dietz + William Haddon + William Pitcock + + Portions of this software are derived from third-party works licensed + under terms compatible with the above MIT license: + + The TRE regular expression implementation (src/regex/reg* and + src/regex/tre*) is Copyright © 2001-2008 Ville Laurikari and licensed + under a 2-clause BSD license (license text in the source files). The + included version has been heavily modified by Rich Felker in 2012, in + the interests of size, simplicity, and namespace cleanliness. + + Much of the math library code (src/math/* and src/complex/*) is + Copyright © 1993,2004 Sun Microsystems or + Copyright © 2003-2011 David Schultz or + Copyright © 2003-2009 Steven G. Kargl or + Copyright © 2003-2009 Bruce D. Evans or + Copyright © 2008 Stephen L. Moshier or + Copyright © 2017-2018 Arm Limited + and labelled as such in comments in the individual source files. All + have been licensed under extremely permissive terms. + + The ARM memcpy code (src/string/arm/memcpy.S) is Copyright © 2008 + The Android Open Source Project and is licensed under a two-clause BSD + license. It was taken from Bionic libc, used on Android. + + The AArch64 memcpy and memset code (src/string/aarch64/*) are + Copyright © 1999-2019, Arm Limited. + + The implementation of DES for crypt (src/crypt/crypt_des.c) is + Copyright © 1994 David Burren. It is licensed under a BSD license. + + The implementation of blowfish crypt (src/crypt/crypt_blowfish.c) was + originally written by Solar Designer and placed into the public + domain. The code also comes with a fallback permissive license for use + in jurisdictions that may not recognize the public domain. + + The smoothsort implementation (src/stdlib/qsort.c) is Copyright © 2011 + Valentin Ochs and is licensed under an MIT-style license. + + The x86_64 port was written by Nicholas J. Kain and is licensed under + the standard MIT terms. + + The mips and microblaze ports were originally written by Richard + Pennington for use in the ellcc project. The original code was adapted + by Rich Felker for build system and code conventions during upstream + integration. It is licensed under the standard MIT terms. + + The mips64 port was contributed by Imagination Technologies and is + licensed under the standard MIT terms. + + The powerpc port was also originally written by Richard Pennington, + and later supplemented and integrated by John Spencer. It is licensed + under the standard MIT terms. + + All other files which have no copyright comments are original works + produced specifically for use as part of this library, written either + by Rich Felker, the main author of the library, or by one or more + contibutors listed above. Details on authorship of individual files + can be found in the git version control history of the project. The + omission of copyright and license comments in each file is in the + interest of source tree size. + + In addition, permission is hereby granted for all public header files + (include/* and arch/*/bits/*) and crt files intended to be linked into + applications (crt/*, ldso/dlstart.c, and arch/*/crt_arch.h) to omit + the copyright notice and permission notice otherwise required by the + license, and to use these files without any requirement of + attribution. These files include substantial contributions from: + + Bobby Bingham + John Spencer + Nicholas J. Kain + Rich Felker + Richard Pennington + Stefan Kristiansson + Szabolcs Nagy + + all of whom have explicitly granted such permission. + + This file previously contained text expressing a belief that most of + the files covered by the above exception were sufficiently trivial not + to be subject to copyright, resulting in confusion over whether it + negated the permissions granted in the license. In the spirit of + permissive licensing, and of not having licensing issues being an + obstacle to adoption, that text has been removed.Copyright (c) 2005-2023, NumPy Developers. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + + * Neither the name of the NumPy Developers nor the names of any + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + + Copyright (c) Donald Stufft and individual contributors. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.A. HISTORY OF THE SOFTWARE + ========================== + + Python was created in the early 1990s by Guido van Rossum at Stichting + Mathematisch Centrum (CWI, see https://www.cwi.nl) in the Netherlands + as a successor of a language called ABC. Guido remains Python's + principal author, although it includes many contributions from others. + + In 1995, Guido continued his work on Python at the Corporation for + National Research Initiatives (CNRI, see https://www.cnri.reston.va.us) + in Reston, Virginia where he released several versions of the + software. + + In May 2000, Guido and the Python core development team moved to + BeOpen.com to form the BeOpen PythonLabs team. In October of the same + year, the PythonLabs team moved to Digital Creations, which became + Zope Corporation. In 2001, the Python Software Foundation (PSF, see + https://www.python.org/psf/) was formed, a non-profit organization + created specifically to own Python-related Intellectual Property. + Zope Corporation was a sponsoring member of the PSF. + + All Python releases are Open Source (see https://opensource.org for + the Open Source Definition). Historically, most, but not all, Python + releases have also been GPL-compatible; the table below summarizes + the various releases. + + Release Derived Year Owner GPL- + from compatible? (1) + + 0.9.0 thru 1.2 1991-1995 CWI yes + 1.3 thru 1.5.2 1.2 1995-1999 CNRI yes + 1.6 1.5.2 2000 CNRI no + 2.0 1.6 2000 BeOpen.com no + 1.6.1 1.6 2001 CNRI yes (2) + 2.1 2.0+1.6.1 2001 PSF no + 2.0.1 2.0+1.6.1 2001 PSF yes + 2.1.1 2.1+2.0.1 2001 PSF yes + 2.1.2 2.1.1 2002 PSF yes + 2.1.3 2.1.2 2002 PSF yes + 2.2 and above 2.1.1 2001-now PSF yes + + Footnotes: + + (1) GPL-compatible doesn't mean that we're distributing Python under + the GPL. All Python licenses, unlike the GPL, let you distribute + a modified version without making your changes open source. The + GPL-compatible licenses make it possible to combine Python with + other software that is released under the GPL; the others don't. + + (2) According to Richard Stallman, 1.6.1 is not GPL-compatible, + because its license has a choice of law clause. According to + CNRI, however, Stallman's lawyer has told CNRI's lawyer that 1.6.1 + is "not incompatible" with the GPL. + + Thanks to the many outside volunteers who have worked under Guido's + direction to make these releases possible. + + + B. TERMS AND CONDITIONS FOR ACCESSING OR OTHERWISE USING PYTHON + =============================================================== + + Python software and documentation are licensed under the + Python Software Foundation License Version 2. + + Starting with Python 3.8.6, examples, recipes, and other code in + the documentation are dual licensed under the PSF License Version 2 + and the Zero-Clause BSD license. + + Some software incorporated into Python is under different licenses. + The licenses are listed with code falling under that license. + + + PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2 + -------------------------------------------- + + 1. This LICENSE AGREEMENT is between the Python Software Foundation + ("PSF"), and the Individual or Organization ("Licensee") accessing and + otherwise using this software ("Python") in source or binary form and + its associated documentation. + + 2. Subject to the terms and conditions of this License Agreement, PSF hereby + grants Licensee a nonexclusive, royalty-free, world-wide license to reproduce, + analyze, test, perform and/or display publicly, prepare derivative works, + distribute, and otherwise use Python alone or in any derivative version, + provided, however, that PSF's License Agreement and PSF's notice of copyright, + i.e., "Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, + 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023 Python Software Foundation; + All Rights Reserved" are retained in Python alone or in any derivative version + prepared by Licensee. + + 3. In the event Licensee prepares a derivative work that is based on + or incorporates Python or any part thereof, and wants to make + the derivative work available to others as provided herein, then + Licensee hereby agrees to include in any such work a brief summary of + the changes made to Python. + + 4. PSF is making Python available to Licensee on an "AS IS" + basis. PSF MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR + IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, PSF MAKES NO AND + DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS + FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON WILL NOT + INFRINGE ANY THIRD PARTY RIGHTS. + + 5. PSF SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON + FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS + A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON, + OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF. + + 6. This License Agreement will automatically terminate upon a material + breach of its terms and conditions. + + 7. Nothing in this License Agreement shall be deemed to create any + relationship of agency, partnership, or joint venture between PSF and + Licensee. This License Agreement does not grant permission to use PSF + trademarks or trade name in a trademark sense to endorse or promote + products or services of Licensee, or any third party. + + 8. By copying, installing or otherwise using Python, Licensee + agrees to be bound by the terms and conditions of this License + Agreement. + + + BEOPEN.COM LICENSE AGREEMENT FOR PYTHON 2.0 + ------------------------------------------- + + BEOPEN PYTHON OPEN SOURCE LICENSE AGREEMENT VERSION 1 + + 1. This LICENSE AGREEMENT is between BeOpen.com ("BeOpen"), having an + office at 160 Saratoga Avenue, Santa Clara, CA 95051, and the + Individual or Organization ("Licensee") accessing and otherwise using + this software in source or binary form and its associated + documentation ("the Software"). + + 2. Subject to the terms and conditions of this BeOpen Python License + Agreement, BeOpen hereby grants Licensee a non-exclusive, + royalty-free, world-wide license to reproduce, analyze, test, perform + and/or display publicly, prepare derivative works, distribute, and + otherwise use the Software alone or in any derivative version, + provided, however, that the BeOpen Python License is retained in the + Software, alone or in any derivative version prepared by Licensee. + + 3. BeOpen is making the Software available to Licensee on an "AS IS" + basis. BEOPEN MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR + IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, BEOPEN MAKES NO AND + DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS + FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THE SOFTWARE WILL NOT + INFRINGE ANY THIRD PARTY RIGHTS. + + 4. BEOPEN SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF THE + SOFTWARE FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS + AS A RESULT OF USING, MODIFYING OR DISTRIBUTING THE SOFTWARE, OR ANY + DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF. + + 5. This License Agreement will automatically terminate upon a material + breach of its terms and conditions. + + 6. This License Agreement shall be governed by and interpreted in all + respects by the law of the State of California, excluding conflict of + law provisions. Nothing in this License Agreement shall be deemed to + create any relationship of agency, partnership, or joint venture + between BeOpen and Licensee. This License Agreement does not grant + permission to use BeOpen trademarks or trade names in a trademark + sense to endorse or promote products or services of Licensee, or any + third party. As an exception, the "BeOpen Python" logos available at + http://www.pythonlabs.com/logos.html may be used according to the + permissions granted on that web page. + + 7. By copying, installing or otherwise using the software, Licensee + agrees to be bound by the terms and conditions of this License + Agreement. + + + CNRI LICENSE AGREEMENT FOR PYTHON 1.6.1 + --------------------------------------- + + 1. This LICENSE AGREEMENT is between the Corporation for National + Research Initiatives, having an office at 1895 Preston White Drive, + Reston, VA 20191 ("CNRI"), and the Individual or Organization + ("Licensee") accessing and otherwise using Python 1.6.1 software in + source or binary form and its associated documentation. + + 2. Subject to the terms and conditions of this License Agreement, CNRI + hereby grants Licensee a nonexclusive, royalty-free, world-wide + license to reproduce, analyze, test, perform and/or display publicly, + prepare derivative works, distribute, and otherwise use Python 1.6.1 + alone or in any derivative version, provided, however, that CNRI's + License Agreement and CNRI's notice of copyright, i.e., "Copyright (c) + 1995-2001 Corporation for National Research Initiatives; All Rights + Reserved" are retained in Python 1.6.1 alone or in any derivative + version prepared by Licensee. Alternately, in lieu of CNRI's License + Agreement, Licensee may substitute the following text (omitting the + quotes): "Python 1.6.1 is made available subject to the terms and + conditions in CNRI's License Agreement. This Agreement together with + Python 1.6.1 may be located on the internet using the following + unique, persistent identifier (known as a handle): 1895.22/1013. This + Agreement may also be obtained from a proxy server on the internet + using the following URL: http://hdl.handle.net/1895.22/1013". + + 3. In the event Licensee prepares a derivative work that is based on + or incorporates Python 1.6.1 or any part thereof, and wants to make + the derivative work available to others as provided herein, then + Licensee hereby agrees to include in any such work a brief summary of + the changes made to Python 1.6.1. + + 4. CNRI is making Python 1.6.1 available to Licensee on an "AS IS" + basis. CNRI MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR + IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, CNRI MAKES NO AND + DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS + FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON 1.6.1 WILL NOT + INFRINGE ANY THIRD PARTY RIGHTS. + + 5. CNRI SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON + 1.6.1 FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS + A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON 1.6.1, + OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF. + + 6. This License Agreement will automatically terminate upon a material + breach of its terms and conditions. + + 7. This License Agreement shall be governed by the federal + intellectual property law of the United States, including without + limitation the federal copyright law, and, to the extent such + U.S. federal law does not apply, by the law of the Commonwealth of + Virginia, excluding Virginia's conflict of law provisions. + Notwithstanding the foregoing, with regard to derivative works based + on Python 1.6.1 that incorporate non-separable material that was + previously distributed under the GNU General Public License (GPL), the + law of the Commonwealth of Virginia shall govern this License + Agreement only as to issues arising under or with respect to + Paragraphs 4, 5, and 7 of this License Agreement. Nothing in this + License Agreement shall be deemed to create any relationship of + agency, partnership, or joint venture between CNRI and Licensee. This + License Agreement does not grant permission to use CNRI trademarks or + trade name in a trademark sense to endorse or promote products or + services of Licensee, or any third party. + + 8. By clicking on the "ACCEPT" button where indicated, or by copying, + installing or otherwise using Python 1.6.1, Licensee agrees to be + bound by the terms and conditions of this License Agreement. + + ACCEPT + + + CWI LICENSE AGREEMENT FOR PYTHON 0.9.0 THROUGH 1.2 + -------------------------------------------------- + + Copyright (c) 1991 - 1995, Stichting Mathematisch Centrum Amsterdam, + The Netherlands. All rights reserved. + + Permission to use, copy, modify, and distribute this software and its + documentation for any purpose and without fee is hereby granted, + provided that the above copyright notice appear in all copies and that + both that copyright notice and this permission notice appear in + supporting documentation, and that the name of Stichting Mathematisch + Centrum or CWI not be used in advertising or publicity pertaining to + distribution of the software without specific, written prior + permission. + + STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO + THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND + FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE + FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT + OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + + ZERO-CLAUSE BSD LICENSE FOR CODE IN THE PYTHON DOCUMENTATION + ---------------------------------------------------------------------- + + Permission to use, copy, modify, and/or distribute this software for any + purpose with or without fee is hereby granted. + + THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH + REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, + INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM + LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + PERFORMANCE OF THIS SOFTWARE. + Copyright (c) 2014, Al Sweigart + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + * Neither the name of the {organization} nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.Copyright (c) 2017 Anthony Sottile + + 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.Copyright (c) 2015-2019 Jared Hobbs + + 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.Developed by ESN, an Electronic Arts Inc. studio. + Copyright (c) 2014, Electronic Arts Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of ESN, Electronic Arts Inc. nor the + names of its contributors may be used to endorse or promote products + derived from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL ELECTRONIC ARTS INC. BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + ---- + + Portions of code from MODP_ASCII - Ascii transformations (upper/lower, etc) + https://github.com/client9/stringencoders + + Copyright 2005, 2006, 2007 + Nick Galbreath -- nickg [at] modp [dot] com + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + Neither the name of the modp.com nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + This is the standard "new" BSD license: + http://www.opensource.org/licenses/bsd-license.php + + https://github.com/client9/stringencoders/blob/cfd5c1507325ae497ea9bacdacba12c0ffd79d30/COPYING + + ---- + + Numeric decoder derived from from TCL library + https://opensource.apple.com/source/tcl/tcl-14/tcl/license.terms + * Copyright (c) 1988-1993 The Regents of the University of California. + * Copyright (c) 1994 Sun Microsystems, Inc. + + This software is copyrighted by the Regents of the University of + California, Sun Microsystems, Inc., Scriptics Corporation, ActiveState + Corporation and other parties. The following terms apply to all files + associated with the software unless explicitly disclaimed in + individual files. + + The authors hereby grant permission to use, copy, modify, distribute, + and license this software and its documentation for any purpose, provided + that existing copyright notices are retained in all copies and that this + notice is included verbatim in any distributions. No written agreement, + license, or royalty fee is required for any of the authorized uses. + Modifications to this software may be copyrighted by their authors + and need not follow the licensing terms described here, provided that + the new terms are clearly indicated on the first page of each file where + they apply. + + IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY + FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES + ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY + DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + + THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE + IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE + NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR + MODIFICATIONS. + + GOVERNMENT USE: If you are acquiring this software on behalf of the + U.S. government, the Government shall have only "Restricted Rights" + in the software and related documentation as defined in the Federal + Acquisition Regulations (FARs) in Clause 52.227.19 (c) (2). If you + are acquiring the software on behalf of the Department of Defense, the + software shall be classified as "Commercial Computer Software" and the + Government shall have only "Restricted Rights" as defined in Clause + 252.227-7013 (c) (1) of DFARs. Notwithstanding the foregoing, the + authors grant the U.S. Government and others acting in its behalf + permission to use and distribute the software in accordance with the + terms specified in this license. +Classifier: Development Status :: 5 - Production/Stable +Classifier: Environment :: Console +Classifier: Intended Audience :: Science/Research +Classifier: License :: OSI Approved :: BSD License +Classifier: Operating System :: OS Independent +Classifier: Programming Language :: Cython +Classifier: Programming Language :: Python +Classifier: Programming Language :: Python :: 3 +Classifier: Programming Language :: Python :: 3 :: Only +Classifier: Programming Language :: Python :: 3.11 +Classifier: Programming Language :: Python :: 3.12 +Classifier: Programming Language :: Python :: 3.13 +Classifier: Programming Language :: Python :: 3.14 +Classifier: Topic :: Scientific/Engineering +Project-URL: homepage, https://pandas.pydata.org +Project-URL: documentation, https://pandas.pydata.org/docs/ +Project-URL: repository, https://github.com/pandas-dev/pandas +Requires-Python: >=3.11 +Requires-Dist: numpy>=1.26.0; python_version < "3.14" +Requires-Dist: numpy>=2.3.3; python_version >= "3.14" +Requires-Dist: python-dateutil>=2.8.2 +Requires-Dist: tzdata; sys_platform == "win32" +Requires-Dist: tzdata; sys_platform == "emscripten" +Provides-Extra: test +Requires-Dist: hypothesis>=6.116.0; extra == "test" +Requires-Dist: pytest<9.1,>=8.3.4; extra == "test" +Requires-Dist: pytest-xdist>=3.6.1; extra == "test" +Provides-Extra: pyarrow +Requires-Dist: pyarrow>=13.0.0; extra == "pyarrow" +Provides-Extra: performance +Requires-Dist: bottleneck>=1.4.2; extra == "performance" +Requires-Dist: numba>=0.60.0; extra == "performance" +Requires-Dist: numexpr>=2.10.2; extra == "performance" +Provides-Extra: computation +Requires-Dist: scipy>=1.14.1; extra == "computation" +Requires-Dist: xarray>=2024.10.0; extra == "computation" +Provides-Extra: fss +Requires-Dist: fsspec>=2024.10.0; extra == "fss" +Provides-Extra: aws +Requires-Dist: s3fs>=2024.10.0; extra == "aws" +Provides-Extra: gcp +Requires-Dist: gcsfs>=2024.10.0; extra == "gcp" +Provides-Extra: excel +Requires-Dist: odfpy>=1.4.1; extra == "excel" +Requires-Dist: openpyxl>=3.1.5; extra == "excel" +Requires-Dist: python-calamine>=0.3.0; extra == "excel" +Requires-Dist: pyxlsb>=1.0.10; extra == "excel" +Requires-Dist: xlrd>=2.0.1; extra == "excel" +Requires-Dist: xlsxwriter>=3.2.0; extra == "excel" +Provides-Extra: parquet +Requires-Dist: pyarrow>=13.0.0; extra == "parquet" +Provides-Extra: feather +Requires-Dist: pyarrow>=13.0.0; extra == "feather" +Provides-Extra: iceberg +Requires-Dist: pyiceberg>=0.8.1; extra == "iceberg" +Provides-Extra: hdf5 +Requires-Dist: tables>=3.10.1; extra == "hdf5" +Provides-Extra: spss +Requires-Dist: pyreadstat>=1.2.8; extra == "spss" +Provides-Extra: postgresql +Requires-Dist: SQLAlchemy>=2.0.36; extra == "postgresql" +Requires-Dist: psycopg2>=2.9.10; extra == "postgresql" +Requires-Dist: adbc-driver-postgresql>=1.2.0; extra == "postgresql" +Provides-Extra: mysql +Requires-Dist: SQLAlchemy>=2.0.36; extra == "mysql" +Requires-Dist: pymysql>=1.1.1; extra == "mysql" +Provides-Extra: sql-other +Requires-Dist: SQLAlchemy>=2.0.36; extra == "sql-other" +Requires-Dist: adbc-driver-postgresql>=1.2.0; extra == "sql-other" +Requires-Dist: adbc-driver-sqlite>=1.2.0; extra == "sql-other" +Provides-Extra: html +Requires-Dist: beautifulsoup4>=4.12.3; extra == "html" +Requires-Dist: html5lib>=1.1; extra == "html" +Requires-Dist: lxml>=5.3.0; extra == "html" +Provides-Extra: xml +Requires-Dist: lxml>=5.3.0; extra == "xml" +Provides-Extra: plot +Requires-Dist: matplotlib>=3.9.3; extra == "plot" +Provides-Extra: output-formatting +Requires-Dist: jinja2>=3.1.5; extra == "output-formatting" +Requires-Dist: tabulate>=0.9.0; extra == "output-formatting" +Provides-Extra: clipboard +Requires-Dist: PyQt5>=5.15.9; extra == "clipboard" +Requires-Dist: qtpy>=2.4.2; extra == "clipboard" +Provides-Extra: compression +Requires-Dist: zstandard>=0.23.0; extra == "compression" +Provides-Extra: timezone +Requires-Dist: pytz>=2020.1; extra == "timezone" +Provides-Extra: all +Requires-Dist: adbc-driver-postgresql>=1.2.0; extra == "all" +Requires-Dist: adbc-driver-sqlite>=1.2.0; extra == "all" +Requires-Dist: beautifulsoup4>=4.12.3; extra == "all" +Requires-Dist: bottleneck>=1.4.2; extra == "all" +Requires-Dist: fastparquet>=2024.11.0; extra == "all" +Requires-Dist: fsspec>=2024.10.0; extra == "all" +Requires-Dist: gcsfs>=2024.10.0; extra == "all" +Requires-Dist: html5lib>=1.1; extra == "all" +Requires-Dist: hypothesis>=6.116.0; extra == "all" +Requires-Dist: jinja2>=3.1.5; extra == "all" +Requires-Dist: lxml>=5.3.0; extra == "all" +Requires-Dist: matplotlib>=3.9.3; extra == "all" +Requires-Dist: numba>=0.60.0; extra == "all" +Requires-Dist: numexpr>=2.10.2; extra == "all" +Requires-Dist: odfpy>=1.4.1; extra == "all" +Requires-Dist: openpyxl>=3.1.5; extra == "all" +Requires-Dist: psycopg2>=2.9.10; extra == "all" +Requires-Dist: pyarrow>=13.0.0; extra == "all" +Requires-Dist: pyiceberg>=0.8.1; extra == "all" +Requires-Dist: pymysql>=1.1.1; extra == "all" +Requires-Dist: PyQt5>=5.15.9; extra == "all" +Requires-Dist: pyreadstat>=1.2.8; extra == "all" +Requires-Dist: pytest>=8.3.4; extra == "all" +Requires-Dist: pytest-xdist>=3.6.1; extra == "all" +Requires-Dist: python-calamine>=0.3.0; extra == "all" +Requires-Dist: pytz>=2020.1; extra == "all" +Requires-Dist: pyxlsb>=1.0.10; extra == "all" +Requires-Dist: qtpy>=2.4.2; extra == "all" +Requires-Dist: scipy>=1.14.1; extra == "all" +Requires-Dist: s3fs>=2024.10.0; extra == "all" +Requires-Dist: SQLAlchemy>=2.0.36; extra == "all" +Requires-Dist: tables>=3.10.1; extra == "all" +Requires-Dist: tabulate>=0.9.0; extra == "all" +Requires-Dist: xarray>=2024.10.0; extra == "all" +Requires-Dist: xlrd>=2.0.1; extra == "all" +Requires-Dist: xlsxwriter>=3.2.0; extra == "all" +Requires-Dist: zstandard>=0.23.0; extra == "all" +Description-Content-Type: text/markdown + + + + Pandas Logo + + +----------------- + +# pandas: A Powerful Python Data Analysis Toolkit + +| | | +| --- | --- | +| Testing | [![CI - Test](https://github.com/pandas-dev/pandas/actions/workflows/unit-tests.yml/badge.svg)](https://github.com/pandas-dev/pandas/actions/workflows/unit-tests.yml) [![Coverage](https://codecov.io/github/pandas-dev/pandas/coverage.svg?branch=main)](https://codecov.io/gh/pandas-dev/pandas) | +| Package | [![PyPI Latest Release](https://img.shields.io/pypi/v/pandas.svg)](https://pypi.org/project/pandas/) [![PyPI Downloads](https://img.shields.io/pypi/dm/pandas.svg?label=PyPI%20downloads)](https://pypi.org/project/pandas/) [![Conda Latest Release](https://anaconda.org/conda-forge/pandas/badges/version.svg)](https://anaconda.org/conda-forge/pandas) [![Conda Downloads](https://img.shields.io/conda/dn/conda-forge/pandas.svg?label=Conda%20downloads)](https://anaconda.org/conda-forge/pandas) | +| Meta | [![Powered by NumFOCUS](https://img.shields.io/badge/powered%20by-NumFOCUS-orange.svg?style=flat&colorA=E1523D&colorB=007D8A)](https://numfocus.org) [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.3509134.svg)](https://doi.org/10.5281/zenodo.3509134) [![License - BSD 3-Clause](https://img.shields.io/pypi/l/pandas.svg)](https://github.com/pandas-dev/pandas/blob/main/LICENSE) [![Slack](https://img.shields.io/badge/join_Slack-information-brightgreen.svg?logo=slack)](https://pandas.pydata.org/docs/dev/development/community.html?highlight=slack#community-slack) [![LFX Health Score](https://insights.linuxfoundation.org/api/badge/health-score?project=pandas-dev-pandas)](https://insights.linuxfoundation.org/project/pandas-dev-pandas) | + + +## What is it? + +**pandas** is a Python package that provides fast, flexible, and expressive data +structures designed to make working with "relational" or "labeled" data both +easy and intuitive. It aims to be the fundamental high-level building block for +doing practical, **real-world** data analysis in Python. Additionally, it has +the broader goal of becoming **the most powerful and flexible open-source data +analysis/manipulation tool available in any language**. It is already well on +its way towards this goal. + +## Table of Contents + +- [Main Features](#main-features) +- [Where to get it](#where-to-get-it) +- [Dependencies](#dependencies) +- [Installation from sources](#installation-from-sources) +- [License](#license) +- [Documentation](#documentation) +- [Background](#background) +- [Getting Help](#getting-help) +- [Discussion and Development](#discussion-and-development) +- [Contributing to pandas](#contributing-to-pandas) + +## Main Features +Here are just a few of the things that pandas does well: + + - Easy handling of [**missing data**][missing-data] (represented as + `NaN`, `NA`, or `NaT`) in floating point as well as non-floating point data + - Size mutability: columns can be [**inserted and + deleted**][insertion-deletion] from DataFrame and higher dimensional + objects + - Automatic and explicit [**data alignment**][alignment]: objects can + be explicitly aligned to a set of labels, or the user can simply + ignore the labels and let `Series`, `DataFrame`, etc. automatically + align the data for you in computations + - Powerful, flexible [**group by**][groupby] functionality to perform + split-apply-combine operations on data sets, for both aggregating + and transforming data + - Make it [**easy to convert**][conversion] ragged, + differently-indexed data in other Python and NumPy data structures + into DataFrame objects + - Intelligent label-based [**slicing**][slicing], [**fancy + indexing**][fancy-indexing], and [**subsetting**][subsetting] of + large data sets + - Intuitive [**merging**][merging] and [**joining**][joining] data + sets + - Flexible [**reshaping**][reshape] and [**pivoting**][pivot-table] of + data sets + - [**Hierarchical**][mi] labeling of axes (possible to have multiple + labels per tick) + - Robust I/O tools for loading data from [**flat files**][flat-files] + (CSV and delimited), [**Excel files**][excel], [**databases**][db], + and saving/loading data from the ultrafast [**HDF5 format**][hdfstore] + - [**Time series**][timeseries]-specific functionality: date range + generation and frequency conversion, moving window statistics, + date shifting and lagging + + + [missing-data]: https://pandas.pydata.org/pandas-docs/stable/user_guide/missing_data.html + [insertion-deletion]: https://pandas.pydata.org/pandas-docs/stable/user_guide/dsintro.html#column-selection-addition-deletion + [alignment]: https://pandas.pydata.org/pandas-docs/stable/user_guide/dsintro.html?highlight=alignment#intro-to-data-structures + [groupby]: https://pandas.pydata.org/pandas-docs/stable/user_guide/groupby.html#group-by-split-apply-combine + [conversion]: https://pandas.pydata.org/pandas-docs/stable/user_guide/dsintro.html#dataframe + [slicing]: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#slicing-ranges + [fancy-indexing]: https://pandas.pydata.org/pandas-docs/stable/user_guide/advanced.html#advanced + [subsetting]: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#boolean-indexing + [merging]: https://pandas.pydata.org/pandas-docs/stable/user_guide/merging.html#database-style-dataframe-or-named-series-joining-merging + [joining]: https://pandas.pydata.org/pandas-docs/stable/user_guide/merging.html#joining-on-index + [reshape]: https://pandas.pydata.org/pandas-docs/stable/user_guide/reshaping.html + [pivot-table]: https://pandas.pydata.org/pandas-docs/stable/user_guide/reshaping.html + [mi]: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#hierarchical-indexing-multiindex + [flat-files]: https://pandas.pydata.org/pandas-docs/stable/user_guide/io.html#csv-text-files + [excel]: https://pandas.pydata.org/pandas-docs/stable/user_guide/io.html#excel-files + [db]: https://pandas.pydata.org/pandas-docs/stable/user_guide/io.html#sql-queries + [hdfstore]: https://pandas.pydata.org/pandas-docs/stable/user_guide/io.html#hdf5-pytables + [timeseries]: https://pandas.pydata.org/pandas-docs/stable/user_guide/timeseries.html#time-series-date-functionality + +## Where to get it +The source code is currently hosted on GitHub at: +https://github.com/pandas-dev/pandas + +Binary installers for the latest released version are available at the [Python +Package Index (PyPI)](https://pypi.org/project/pandas) and on [Conda](https://anaconda.org/conda-forge/pandas). + +```sh +# conda +conda install -c conda-forge pandas +``` + +```sh +# or PyPI +pip install pandas +``` + +The list of changes to pandas between each release can be found +[here](https://pandas.pydata.org/pandas-docs/stable/whatsnew/index.html). For full +details, see the commit logs at https://github.com/pandas-dev/pandas. + +## Dependencies +- [NumPy - Adds support for large, multi-dimensional arrays, matrices and high-level mathematical functions to operate on these arrays](https://www.numpy.org) +- [python-dateutil - Provides powerful extensions to the standard datetime module](https://dateutil.readthedocs.io/en/stable/index.html) +- [tzdata - Provides an IANA time zone database](https://tzdata.readthedocs.io/en/latest/) (Only required on Windows/Emscripten) + +See the [full installation instructions](https://pandas.pydata.org/pandas-docs/stable/install.html#dependencies) for minimum supported versions of required, recommended and optional dependencies. + +## Installation from sources +To install pandas from source you need [Cython](https://cython.org/) in addition to the normal +dependencies above. Cython can be installed from PyPI: + +```sh +pip install cython +``` + +In the `pandas` directory (same one where you found this file after +cloning the git repo), execute: + +```sh +pip install . +``` + +or for installing in [development mode](https://pip.pypa.io/en/latest/cli/pip_install/#install-editable): + + +```sh +python -m pip install -ve . --no-build-isolation --config-settings editable-verbose=true +``` + +See the full instructions for [installing from source](https://pandas.pydata.org/docs/dev/development/contributing_environment.html). + +## License +[BSD 3](LICENSE) + +## Documentation +The official documentation is hosted on [PyData.org](https://pandas.pydata.org/pandas-docs/stable/). + +## Background +Work on ``pandas`` started at [AQR](https://www.aqr.com/) (a quantitative hedge fund) in 2008 and +has been under active development since then. + +## Getting Help + +For usage questions, the best place to go to is [Stack Overflow](https://stackoverflow.com/questions/tagged/pandas). +Further, general questions and discussions can also take place on the [pydata mailing list](https://groups.google.com/forum/?fromgroups#!forum/pydata). + +## Discussion and Development +Most development discussions take place on GitHub in this repo, via the [GitHub issue tracker](https://github.com/pandas-dev/pandas/issues). + +Further, the [pandas-dev mailing list](https://mail.python.org/mailman/listinfo/pandas-dev) can also be used for specialized discussions or design issues, and a [Slack channel](https://pandas.pydata.org/docs/dev/development/community.html?highlight=slack#community-slack) is available for quick development related questions. + +There are also frequent [community meetings](https://pandas.pydata.org/docs/dev/development/community.html#community-meeting) for project maintainers open to the community as well as monthly [new contributor meetings](https://pandas.pydata.org/docs/dev/development/community.html#new-contributor-meeting) to help support new contributors. + +Additional information on the communication channels can be found on the [contributor community](https://pandas.pydata.org/docs/development/community.html) page. + +## Contributing to pandas + +[![Open Source Helpers](https://www.codetriage.com/pandas-dev/pandas/badges/users.svg)](https://www.codetriage.com/pandas-dev/pandas) + +All contributions, bug reports, bug fixes, documentation improvements, enhancements, and ideas are welcome. + +A detailed overview on how to contribute can be found in the **[contributing guide](https://pandas.pydata.org/docs/dev/development/contributing.html)**. + +If you are simply looking to start working with the pandas codebase, navigate to the [GitHub "issues" tab](https://github.com/pandas-dev/pandas/issues) and start looking through interesting issues. There are a number of issues listed under [Docs](https://github.com/pandas-dev/pandas/issues?q=is%3Aissue%20state%3Aopen%20label%3ADocs%20sort%3Aupdated-desc) and [good first issue](https://github.com/pandas-dev/pandas/issues?q=is%3Aissue%20state%3Aopen%20label%3A%22good%20first%20issue%22%20sort%3Aupdated-desc) where you could start out. + +You can also triage issues which may include reproducing bug reports, or asking for vital information such as version numbers or reproduction instructions. If you would like to start triaging issues, one easy way to get started is to [subscribe to pandas on CodeTriage](https://www.codetriage.com/pandas-dev/pandas). + +Or maybe through using pandas you have an idea of your own or are looking for something in the documentation and thinking ‘this can be improved’... you can do something about it! + +Feel free to ask questions on the [mailing list](https://groups.google.com/forum/?fromgroups#!forum/pydata) or on [Slack](https://pandas.pydata.org/docs/dev/development/community.html?highlight=slack#community-slack). + +As contributors and maintainers to this project, you are expected to abide by pandas' code of conduct. More information can be found at: [Contributor Code of Conduct](https://github.com/pandas-dev/.github/blob/master/CODE_OF_CONDUCT.md) + +
+ +[Go to Top](#table-of-contents) diff --git a/.cache/pip/http-v2/4/5/2/4/1/45241d61b1606b84c3825a9119b750e7cd16e5fac504d31f79203a8e.body b/.cache/pip/http-v2/4/5/2/4/1/45241d61b1606b84c3825a9119b750e7cd16e5fac504d31f79203a8e.body new file mode 100644 index 0000000000000000000000000000000000000000..1fb06f0478b071761108832c2c0099cc5967ee6f --- /dev/null +++ b/.cache/pip/http-v2/4/5/2/4/1/45241d61b1606b84c3825a9119b750e7cd16e5fac504d31f79203a8e.body @@ -0,0 +1,84 @@ +Metadata-Version: 2.4 +Name: click +Version: 8.4.2 +Summary: Composable command line interface toolkit +Maintainer-email: Pallets +Requires-Python: >=3.10 +Description-Content-Type: text/markdown +License-Expression: BSD-3-Clause +Classifier: Development Status :: 5 - Production/Stable +Classifier: Intended Audience :: Developers +Classifier: Operating System :: OS Independent +Classifier: Programming Language :: Python +Classifier: Typing :: Typed +License-File: LICENSE.txt +Requires-Dist: colorama; platform_system == 'Windows' +Project-URL: Changes, https://click.palletsprojects.com/page/changes/ +Project-URL: Chat, https://discord.gg/pallets +Project-URL: Documentation, https://click.palletsprojects.com/ +Project-URL: Donate, https://palletsprojects.com/donate +Project-URL: Source, https://github.com/pallets/click/ + +
+ +# Click + +Click is a Python package for creating beautiful command line interfaces +in a composable way with as little code as necessary. It's the "Command +Line Interface Creation Kit". It's highly configurable but comes with +sensible defaults out of the box. + +It aims to make the process of writing command line tools quick and fun +while also preventing any frustration caused by the inability to +implement an intended CLI API. + +Click in three points: + +- Arbitrary nesting of commands +- Automatic help page generation +- Supports lazy loading of subcommands at runtime + + +## A Simple Example + +```python +import click + +@click.command() +@click.option("--count", default=1, help="Number of greetings.") +@click.option("--name", prompt="Your name", help="The person to greet.") +def hello(count, name): + """Simple program that greets NAME for a total of COUNT times.""" + for _ in range(count): + click.echo(f"Hello, {name}!") + +if __name__ == '__main__': + hello() +``` + +``` +$ python hello.py --count=3 +Your name: Click +Hello, Click! +Hello, Click! +Hello, Click! +``` + + +## Donate + +The Pallets organization develops and supports Click and other popular +packages. In order to grow the community of contributors and users, and +allow the maintainers to devote more time to the projects, [please +donate today][]. + +[please donate today]: https://palletsprojects.com/donate + +## Contributing + +See our [detailed contributing documentation][contrib] for many ways to +contribute, including reporting issues, requesting features, asking or answering +questions, and making PRs. + +[contrib]: https://palletsprojects.com/contributing/ + diff --git a/.cache/pip/http-v2/4/7/a/1/f/47a1fcfcda9889c5e9fc07f976129358dec689ce97437905232762a1.body b/.cache/pip/http-v2/4/7/a/1/f/47a1fcfcda9889c5e9fc07f976129358dec689ce97437905232762a1.body new file mode 100644 index 0000000000000000000000000000000000000000..4641a8c5df17c9476f2a9229421716d91d8ec486 Binary files /dev/null and b/.cache/pip/http-v2/4/7/a/1/f/47a1fcfcda9889c5e9fc07f976129358dec689ce97437905232762a1.body differ diff --git a/.cache/pip/http-v2/4/a/5/b/6/4a5b6f0d76201de4cfd4884f5e95617a1848cf81c8357be4d12cbf6a b/.cache/pip/http-v2/4/a/5/b/6/4a5b6f0d76201de4cfd4884f5e95617a1848cf81c8357be4d12cbf6a new file mode 100644 index 0000000000000000000000000000000000000000..43eab43a9e480a650cc3ad579660931eff6d8bf7 Binary files /dev/null and b/.cache/pip/http-v2/4/a/5/b/6/4a5b6f0d76201de4cfd4884f5e95617a1848cf81c8357be4d12cbf6a differ diff --git a/.cache/pip/http-v2/4/d/c/8/d/4dc8d567db4bc55c0684404c85a6b4572f87a99306be24cab65fbfae b/.cache/pip/http-v2/4/d/c/8/d/4dc8d567db4bc55c0684404c85a6b4572f87a99306be24cab65fbfae new file mode 100644 index 0000000000000000000000000000000000000000..8f11fb82b19a2c707a79d97c6471c78cff2abcb9 Binary files /dev/null and b/.cache/pip/http-v2/4/d/c/8/d/4dc8d567db4bc55c0684404c85a6b4572f87a99306be24cab65fbfae differ diff --git a/.cache/pip/http-v2/4/d/c/8/d/4dc8d567db4bc55c0684404c85a6b4572f87a99306be24cab65fbfae.body b/.cache/pip/http-v2/4/d/c/8/d/4dc8d567db4bc55c0684404c85a6b4572f87a99306be24cab65fbfae.body new file mode 100644 index 0000000000000000000000000000000000000000..aa5a7e4d3eeef4b54304a3262a0f0264621dc3f0 Binary files /dev/null and b/.cache/pip/http-v2/4/d/c/8/d/4dc8d567db4bc55c0684404c85a6b4572f87a99306be24cab65fbfae.body differ diff --git a/.cache/pip/http-v2/6/4/6/7/b/6467bdd236eabb4648139f514441e5510842fbc90755e4738c64fcf3.body b/.cache/pip/http-v2/6/4/6/7/b/6467bdd236eabb4648139f514441e5510842fbc90755e4738c64fcf3.body new file mode 100644 index 0000000000000000000000000000000000000000..0d31a34a53c8f3f9aebe83c63d9675ed4b18b2d1 --- /dev/null +++ b/.cache/pip/http-v2/6/4/6/7/b/6467bdd236eabb4648139f514441e5510842fbc90755e4738c64fcf3.body @@ -0,0 +1,341 @@ +Metadata-Version: 2.4 +Name: colorlog +Version: 6.12.0 +Summary: Add colours to the output of Python's logging module. +Home-page: https://github.com/borntyping/python-colorlog +Author: Sam Clements +Author-email: sam@borntyping.co.uk +License: MIT License +Classifier: Development Status :: 5 - Production/Stable +Classifier: Environment :: Console +Classifier: Intended Audience :: Developers +Classifier: License :: OSI Approved :: MIT License +Classifier: Operating System :: OS Independent +Classifier: Programming Language :: Python +Classifier: Programming Language :: Python :: 3 +Classifier: Programming Language :: Python :: 3.6 +Classifier: Programming Language :: Python :: 3.7 +Classifier: Programming Language :: Python :: 3.8 +Classifier: Programming Language :: Python :: 3.9 +Classifier: Programming Language :: Python :: 3.10 +Classifier: Programming Language :: Python :: 3.11 +Classifier: Programming Language :: Python :: 3.12 +Classifier: Programming Language :: Python :: 3.13 +Classifier: Topic :: Terminals +Classifier: Topic :: Utilities +Requires-Python: >=3.6 +Description-Content-Type: text/markdown +License-File: LICENSE +Requires-Dist: colorama; sys_platform == "win32" +Provides-Extra: development +Requires-Dist: black; extra == "development" +Requires-Dist: flake8; extra == "development" +Requires-Dist: mypy; extra == "development" +Requires-Dist: pytest; extra == "development" +Requires-Dist: types-colorama; extra == "development" +Dynamic: author +Dynamic: author-email +Dynamic: classifier +Dynamic: description +Dynamic: description-content-type +Dynamic: home-page +Dynamic: license +Dynamic: license-file +Dynamic: provides-extra +Dynamic: requires-python +Dynamic: summary + +# Log formatting with colors! + +[![](https://img.shields.io/pypi/v/colorlog.svg)](https://pypi.org/project/colorlog/) +[![](https://img.shields.io/pypi/l/colorlog.svg)](https://pypi.org/project/colorlog/) + +Add colours to the output of Python's `logging` module. + +- [Source on GitHub](https://github.com/borntyping/python-colorlog) +- [Package on PyPI](https://pypi.org/pypi/colorlog/) + +## Status + +colorlog currently requires Python 3.6 or higher. Older versions (below 5.x.x) +support Python 2.6 and above. + +- colorlog 6.x requires Python 3.6 or higher. +- colorlog 5.x is an interim version that will warn Python 2 users to downgrade. +- colorlog 4.x is the final version supporting Python 2. + +[colorama] is included as a dependency on Windows, where it is automatically +initialised to support colored output. + +This library is over a decade old and supported a wide set of Python versions +for most of its life, which has made it a difficult library to add new features +to. colorlog 6 may break backwards compatibility so that newer features +can be added more easily, but may still not accept all changes or feature +requests. colorlog 4 might accept essential bugfixes but should not be +considered actively maintained and will not accept any major changes or new +features. + +## Installation + +Install from PyPI with: + +```bash +pip install colorlog +``` + +Several Linux distributions provide official packages ([Debian], [Arch], +[Fedora], [Gentoo], [OpenSuse] and [Ubuntu]), and others have user provided +packages ([BSD ports], [Conda]). + +## Usage + +```python +import colorlog + +handler = colorlog.StreamHandler() +handler.setFormatter(colorlog.ColoredFormatter()) + +logger = colorlog.getLogger('example') +logger.addHandler(handler) +``` + +### Arguments + +`ColoredFormatter` extends [`logging.Formatter`][formatter] and accepts the +following arguments: + +- `fmt` *(default=`None`)*: A format string used to output the message. If + `None`, a default format string is selected based on `style` (e.g. + `%(log_color)s%(levelname)s:%(name)s:%(message)s` for `%` style). +- `datefmt`, `style`, `validate`, `defaults`: see + [`logging.Formatter`][formatter]. +- `reset` *(default=`True`)*: Implicitly adds a color reset code to the + message output, unless the output already ends with one. +- `log_colors` *(default=`None`)*: A mapping of record level names to color + names. If `None`, `colorlog.default_log_colors` is used. +- `secondary_log_colors` *(default=`None`)*: A mapping of names to `log_colors` + style mappings, defining additional colors that can be used in format strings. + If `None`, an empty mapping is used. +- `stream` *(default=`None`)*: The stream being written to (e.g. `sys.stderr`). + Used to detect whether the output is a TTY. Colors are disabled automatically + on non-TTY streams unless `force_color` is set. +- `no_color` *(default=`False`)*: Disable color output. Can also be set via the + `NO_COLOR` environment variable. +- `force_color` *(default=`False`)*: Force color output even on non-TTY streams. + Takes precedence over `no_color`. Can also be set via the `FORCE_COLOR` + environment variable. + +### Color escape codes + +Color escape codes can be selected based on the log records level, by adding +parameters to the format string: + +- `log_color`: Return the color associated with the records level. +- `_log_color`: Return another color based on the records level if the + formatter has secondary colors configured (see `secondary_log_colors` below). + +Multiple escape codes can be used at once by joining them with commas when +configuring the color for a log level (but can't be used directly in the format +string). For example, `black,bg_white` would use the escape codes for black +text on a white background. + +The following escape codes are made available for use in the format string: + +- `{color}`, `fg_{color}`, `bg_{color}`: Foreground and background colors. +- `bold`, `bold_{color}`, `fg_bold_{color}`, `bg_bold_{color}`: Bold/bright + colors. +- `thin`, `thin_{color}`, `fg_thin_{color}`: Thin colors (terminal dependent). +- `reset`: Clear all formatting (both foreground and background colors). + +The available color names are: + +- `black` +- `red` +- `green` +- `yellow` +- `blue` +- `purple` +- `cyan` +- `white` + +You can also use "bright" colors. These aren't standard ANSI codes, and +support for these varies wildly across different terminals. + +- `light_black` +- `light_red` +- `light_green` +- `light_yellow` +- `light_blue` +- `light_purple` +- `light_cyan` +- `light_white` + +In addition to pre-defined color names, you can use integers from 0 to 255 for +256-color support (e.g. `fg_196`, `bg_42`). + +## Examples + +![Example output](docs/example.png) + +The following snippet creates a `ColoredFormatter` for use in a logging setup, +with a custom format string and log colors: + +```python +from colorlog import ColoredFormatter + +formatter = ColoredFormatter( + "%(log_color)s%(levelname)-8s%(reset)s %(blue)s%(message)s", + log_colors={ + "DEBUG": "cyan", + "INFO": "green", + "WARNING": "yellow", + "ERROR": "red", + "CRITICAL": "red,bg_white", + } +) +``` + +*See `docs/example.py` for full example script.* + +### Using `secondary_log_colors` + +Secondary log colors are a way to have more than one color that is selected +based on the log level. Each key in `secondary_log_colors` adds an attribute +that can be used in format strings (`message` becomes `message_log_color`), and +has a corresponding value that is identical in format to the `log_colors` +argument. + +The following example highlights the level name using the default log colors, +and highlights the message in red for `error` and `critical` level log messages. + +```python +from colorlog import ColoredFormatter + +formatter = ColoredFormatter( + "%(log_color)s%(levelname)-8s%(reset)s %(message_log_color)s%(message)s", + secondary_log_colors={ + 'message': { + 'ERROR': 'red', + 'CRITICAL': 'red' + } + } +) +``` + +### With [`dictConfig`][dictconfig] + +```python +logging.config.dictConfig({ + 'formatters': { + 'colored': { + '()': 'colorlog.ColoredFormatter', + 'format': "%(log_color)s%(levelname)-8s%(reset)s %(blue)s%(message)s" + } + } +}) +``` + +A full example dictionary can be found in `tests/test_colorlog.py`. + +### With [`fileConfig`][fileconfig] + +```ini +... + +[formatters] +keys=color + +[formatter_color] +class=colorlog.ColoredFormatter +format=%(log_color)s%(levelname)-8s%(reset)s %(bg_blue)s[%(name)s]%(reset)s %(message)s from fileConfig +datefmt=%m-%d %H:%M:%S +``` + +An instance of ColoredFormatter created with those arguments will then be used +by any handlers that are configured to use the `color` formatter. + +A full example configuration can be found in `tests/test_config.ini`. + +### With custom log levels + +ColoredFormatter will work with custom log levels added with +[`logging.addLevelName`][addlevelname]: + +```python +import logging, colorlog +TRACE = 5 +logging.addLevelName(TRACE, 'TRACE') +formatter = colorlog.ColoredFormatter(log_colors={'TRACE': 'yellow'}) +handler = logging.StreamHandler() +handler.setFormatter(formatter) +logger = logging.getLogger('example') +logger.addHandler(handler) +logger.setLevel('TRACE') +logger.log(TRACE, 'a message using a custom level') +``` + +## Tests + +Tests similar to the above examples are found in `tests/test_colorlog.py`. + +## Status + +colorlog is in maintenance mode. I try and ensure bugfixes are published, +but compatibility a wide set of Python versions makes this a difficult +codebase to add features to. Any changes that might break backwards +compatibility for existing users will not be considered. + +## Alternatives + +There are some more modern libraries for improving Python logging you may +find useful. + +- [structlog] +- [jsonlog] + +## Projects using colorlog + +GitHub provides [a list of projects that depend on colorlog][dependents]. + +Some early adopters included [Errbot], [Pythran], and [zenlog]. + +## Licence + +Copyright (c) 2012-2025 Sam Clements + +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. + +[addlevelname]: https://docs.python.org/3/library/logging.html#logging.addLevelName +[arch]: https://archlinux.org/packages/extra/any/python-colorlog/ +[bsd ports]: https://www.freshports.org/devel/py-colorlog/ +[colorama]: https://pypi.python.org/pypi/colorama +[conda]: https://anaconda.org/conda-forge/colorlog +[debian]: https://packages.debian.org/trixie/python3-colorlog +[dependents]: https://github.com/borntyping/python-colorlog/network/dependents?package_id=UGFja2FnZS01MDk3NDcyMQ%3D%3D +[dictconfig]: http://docs.python.org/3/library/logging.config.html#logging.config.dictConfig +[errbot]: http://errbot.io/ +[fedora]: https://src.fedoraproject.org/rpms/python-colorlog +[fileconfig]: http://docs.python.org/3/library/logging.config.html#logging.config.fileConfig +[formatter]: http://docs.python.org/3/library/logging.html#logging.Formatter +[gentoo]: https://packages.gentoo.org/packages/dev-python/colorlog +[jsonlog]: https://github.com/borntyping/jsonlog +[opensuse]: http://rpm.pbone.net/index.php3?stat=3&search=python-colorlog&srodzaj=3 +[pythran]: https://github.com/serge-sans-paille/pythran +[structlog]: https://www.structlog.org/en/stable/ +[ubuntu]: https://launchpad.net/python-colorlog +[zenlog]: https://github.com/ManufacturaInd/python-zenlog diff --git a/.cache/pip/http-v2/8/f/0/a/d/8f0ad583652318494c12da41e4d30ff6225ec73d448a0754a0a7e898 b/.cache/pip/http-v2/8/f/0/a/d/8f0ad583652318494c12da41e4d30ff6225ec73d448a0754a0a7e898 new file mode 100644 index 0000000000000000000000000000000000000000..486cfcf3b59581dbb226a30be34f080cde2a721c Binary files /dev/null and b/.cache/pip/http-v2/8/f/0/a/d/8f0ad583652318494c12da41e4d30ff6225ec73d448a0754a0a7e898 differ diff --git a/.cache/pip/http-v2/9/0/6/7/9/906797ab7b3f56fdd856b186be66ce1ad5fb99862a404c1091a707b6 b/.cache/pip/http-v2/9/0/6/7/9/906797ab7b3f56fdd856b186be66ce1ad5fb99862a404c1091a707b6 new file mode 100644 index 0000000000000000000000000000000000000000..e61591e5d3711cdab984d418d3b71492d0125e40 Binary files /dev/null and b/.cache/pip/http-v2/9/0/6/7/9/906797ab7b3f56fdd856b186be66ce1ad5fb99862a404c1091a707b6 differ diff --git a/.cache/pip/http-v2/9/0/6/7/9/906797ab7b3f56fdd856b186be66ce1ad5fb99862a404c1091a707b6.body b/.cache/pip/http-v2/9/0/6/7/9/906797ab7b3f56fdd856b186be66ce1ad5fb99862a404c1091a707b6.body new file mode 100644 index 0000000000000000000000000000000000000000..3a47b03dcf76ae9bebaa4137cd9f21854cca2509 Binary files /dev/null and b/.cache/pip/http-v2/9/0/6/7/9/906797ab7b3f56fdd856b186be66ce1ad5fb99862a404c1091a707b6.body differ diff --git a/.cache/pip/http-v2/9/0/f/6/e/90f6e704e426d3e4b799bd86b309263491ea7f0afc8f3ceaab5d10eb b/.cache/pip/http-v2/9/0/f/6/e/90f6e704e426d3e4b799bd86b309263491ea7f0afc8f3ceaab5d10eb new file mode 100644 index 0000000000000000000000000000000000000000..38237f499b230eb20515d541b0b1b225fc90941c Binary files /dev/null and b/.cache/pip/http-v2/9/0/f/6/e/90f6e704e426d3e4b799bd86b309263491ea7f0afc8f3ceaab5d10eb differ diff --git a/.cache/pip/http-v2/9/6/7/8/5/967857dd3681a1bb83c9632aad9815556f1da84934ad6aa3be0d7700 b/.cache/pip/http-v2/9/6/7/8/5/967857dd3681a1bb83c9632aad9815556f1da84934ad6aa3be0d7700 new file mode 100644 index 0000000000000000000000000000000000000000..71ad1aa7c95e4419e4b0bdfee34cf11568594e6d Binary files /dev/null and b/.cache/pip/http-v2/9/6/7/8/5/967857dd3681a1bb83c9632aad9815556f1da84934ad6aa3be0d7700 differ diff --git a/.cache/pip/http-v2/9/6/7/8/5/967857dd3681a1bb83c9632aad9815556f1da84934ad6aa3be0d7700.body b/.cache/pip/http-v2/9/6/7/8/5/967857dd3681a1bb83c9632aad9815556f1da84934ad6aa3be0d7700.body new file mode 100644 index 0000000000000000000000000000000000000000..531726a6b2eacfdcd43af82332c4df4192c9a25f Binary files /dev/null and b/.cache/pip/http-v2/9/6/7/8/5/967857dd3681a1bb83c9632aad9815556f1da84934ad6aa3be0d7700.body differ diff --git a/.cache/pip/http-v2/9/6/e/6/8/96e68fa7e813913744eed43fc3c671900cf7eb7d5088536270636acf b/.cache/pip/http-v2/9/6/e/6/8/96e68fa7e813913744eed43fc3c671900cf7eb7d5088536270636acf new file mode 100644 index 0000000000000000000000000000000000000000..8b9aac4e3dafeae1cd803256593124d9b8e34b56 Binary files /dev/null and b/.cache/pip/http-v2/9/6/e/6/8/96e68fa7e813913744eed43fc3c671900cf7eb7d5088536270636acf differ diff --git a/.cache/pip/http-v2/9/b/0/a/e/9b0ae3352e0682a4ded5c6f53d9053328ff974179c7dcd6dac96d2a9 b/.cache/pip/http-v2/9/b/0/a/e/9b0ae3352e0682a4ded5c6f53d9053328ff974179c7dcd6dac96d2a9 new file mode 100644 index 0000000000000000000000000000000000000000..531b88e2576009ba7f21a17068ca6b2845f7fd0d Binary files /dev/null and b/.cache/pip/http-v2/9/b/0/a/e/9b0ae3352e0682a4ded5c6f53d9053328ff974179c7dcd6dac96d2a9 differ diff --git a/.cache/pip/http-v2/9/b/0/c/d/9b0cd65992ff5b9edd0441126311787aa8872587ece580196906a213 b/.cache/pip/http-v2/9/b/0/c/d/9b0cd65992ff5b9edd0441126311787aa8872587ece580196906a213 new file mode 100644 index 0000000000000000000000000000000000000000..a6bf8b92ca3d4fec6a248ebd166938201b69b1d6 Binary files /dev/null and b/.cache/pip/http-v2/9/b/0/c/d/9b0cd65992ff5b9edd0441126311787aa8872587ece580196906a213 differ diff --git a/.cache/pip/http-v2/9/b/c/f/c/9bcfc39a5bcc4f49a5aca18ef0b4567e959c4b71251fb90ea1371fe7.body b/.cache/pip/http-v2/9/b/c/f/c/9bcfc39a5bcc4f49a5aca18ef0b4567e959c4b71251fb90ea1371fe7.body new file mode 100644 index 0000000000000000000000000000000000000000..ddfb900bc8e93b3547dc29790f85d2fcd96f7267 --- /dev/null +++ b/.cache/pip/http-v2/9/b/c/f/c/9bcfc39a5bcc4f49a5aca18ef0b4567e959c4b71251fb90ea1371fe7.body @@ -0,0 +1,1600 @@ +Metadata-Version: 2.4 +Name: tqdm +Version: 4.70.0 +Summary: Fast, Extensible Progress Meter +Maintainer-email: tqdm developers +License: MPL-2.0 AND MIT +Project-URL: homepage, https://tqdm.github.io +Project-URL: repository, https://github.com/tqdm/tqdm +Project-URL: changelog, https://tqdm.github.io/releases +Project-URL: wiki, https://github.com/tqdm/tqdm/wiki +Keywords: progressbar,progressmeter,progress,bar,meter,rate,eta,console,terminal,time +Classifier: Development Status :: 5 - Production/Stable +Classifier: Environment :: Console +Classifier: Environment :: MacOS X +Classifier: Environment :: Other Environment +Classifier: Environment :: Win32 (MS Windows) +Classifier: Environment :: X11 Applications +Classifier: Framework :: IPython +Classifier: Framework :: Jupyter +Classifier: Intended Audience :: Developers +Classifier: Intended Audience :: Education +Classifier: Intended Audience :: End Users/Desktop +Classifier: Intended Audience :: Other Audience +Classifier: Intended Audience :: System Administrators +Classifier: Operating System :: MacOS +Classifier: Operating System :: MacOS :: MacOS X +Classifier: Operating System :: Microsoft +Classifier: Operating System :: Microsoft :: MS-DOS +Classifier: Operating System :: Microsoft :: Windows +Classifier: Operating System :: POSIX +Classifier: Operating System :: POSIX :: BSD +Classifier: Operating System :: POSIX :: BSD :: FreeBSD +Classifier: Operating System :: POSIX :: Linux +Classifier: Operating System :: POSIX :: SunOS/Solaris +Classifier: Operating System :: Unix +Classifier: Programming Language :: Python +Classifier: Programming Language :: Python :: 3 +Classifier: Programming Language :: Python :: 3.8 +Classifier: Programming Language :: Python :: 3.9 +Classifier: Programming Language :: Python :: 3.10 +Classifier: Programming Language :: Python :: 3.11 +Classifier: Programming Language :: Python :: 3.12 +Classifier: Programming Language :: Python :: 3.13 +Classifier: Programming Language :: Python :: 3.14 +Classifier: Programming Language :: Python :: 3 :: Only +Classifier: Programming Language :: Python :: Implementation +Classifier: Programming Language :: Python :: Implementation :: IronPython +Classifier: Programming Language :: Python :: Implementation :: PyPy +Classifier: Programming Language :: Unix Shell +Classifier: Topic :: Desktop Environment +Classifier: Topic :: Education :: Computer Aided Instruction (CAI) +Classifier: Topic :: Education :: Testing +Classifier: Topic :: Office/Business +Classifier: Topic :: Other/Nonlisted Topic +Classifier: Topic :: Software Development :: Build Tools +Classifier: Topic :: Software Development :: Libraries +Classifier: Topic :: Software Development :: Libraries :: Python Modules +Classifier: Topic :: Software Development :: Pre-processors +Classifier: Topic :: Software Development :: User Interfaces +Classifier: Topic :: System :: Installation/Setup +Classifier: Topic :: System :: Logging +Classifier: Topic :: System :: Monitoring +Classifier: Topic :: System :: Shells +Classifier: Topic :: Terminals +Classifier: Topic :: Utilities +Requires-Python: >=3.8 +Description-Content-Type: text/x-rst +License-File: LICENCE +Requires-Dist: colorama; platform_system == "Windows" +Provides-Extra: discord +Requires-Dist: requests; extra == "discord" +Requires-Dist: envwrap; extra == "discord" +Provides-Extra: slack +Requires-Dist: slack-sdk; extra == "slack" +Requires-Dist: envwrap; extra == "slack" +Provides-Extra: telegram +Requires-Dist: requests; extra == "telegram" +Requires-Dist: envwrap; extra == "telegram" +Provides-Extra: notebook +Requires-Dist: ipywidgets>=6; extra == "notebook" +Dynamic: license-file + +|Logo| + +tqdm +==== + +|Py-Versions| |Versions| |Conda-Forge-Status| |Docker| |Snapcraft| + +|Build-Status| |Coverage-Status| |Branch-Coverage-Status| |Codacy-Grade| |Libraries-Rank| |PyPI-Downloads| + +|LICENCE| |OpenHub-Status| |colab-demo| |binder-demo| |awesome-python| + +``tqdm`` derives from the Arabic word *taqaddum* (تقدّم) which can mean "progress," +and is an abbreviation for "I love you so much" in Spanish (*te quiero demasiado*). + +Instantly make your loops show a smart progress meter - just wrap any +iterable with ``tqdm(iterable)``, and you're done! + +.. code:: python + + from tqdm import tqdm + for i in tqdm(range(10000)): + ... + +``76%|████████████████████████        | 7568/10000 [00:33<00:10, 229.00it/s]`` + +``trange(N)`` can also be used as a convenient shortcut for +``tqdm(range(N))``. + +|Screenshot| + |Video| |Slides| |Merch| + +It can also be executed as a module with pipes: + +.. code:: sh + + $ seq 9999999 | tqdm --bytes | wc -l + 75.2MB [00:00, 217MB/s] + 9999999 + + $ tar -zcf - docs/ | tqdm --bytes --total `du -sb docs/ | cut -f1` \ + > backup.tgz + 32%|██████████▍ | 8.89G/27.9G [00:42<01:31, 223MB/s] + +Overhead is low -- about 60ns per iteration (80ns with ``tqdm.gui``), and is +unit tested against performance regression. +By comparison, the well-established +`ProgressBar `__ has +an 800ns/iter overhead. + +In addition to its low overhead, ``tqdm`` uses smart algorithms to predict +the remaining time and to skip unnecessary iteration displays, which allows +for a negligible overhead in most cases. + +``tqdm`` works on any platform +(Linux, Windows, Mac, FreeBSD, NetBSD, Solaris/SunOS), +in any console or in a GUI, and is also friendly with IPython/Jupyter notebooks. + +``tqdm`` does not require any dependencies (not even ``curses``!), just +Python and an environment supporting ``carriage return \r`` and +``line feed \n`` control characters. + +**Featured Sponsors** + +======== ================================================ +|OpenAI| Your Logo Here +======== ================================================ +OpenAI `Sponsors `__ +======== ================================================ + +.. |OpenAI| image:: https://avatars.githubusercontent.com/u/14957082?s=96 + :target: https://openai.com + +------------------------------------------ + +.. contents:: Table of contents + :backlinks: top + :local: + + +Installation +------------ + +Latest PyPI stable release +~~~~~~~~~~~~~~~~~~~~~~~~~~ + +|Versions| |PyPI-Downloads| |Libraries-Dependents| + +.. code:: sh + + pip install tqdm + +Latest development release on GitHub +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +|GitHub-Status| |GitHub-Stars| |GitHub-Commits| |GitHub-Forks| |GitHub-Updated| + +Pull and install pre-release ``devel`` branch: + +.. code:: sh + + pip install "git+https://github.com/tqdm/tqdm.git@devel#egg=tqdm" + +Latest Conda release +~~~~~~~~~~~~~~~~~~~~ + +|Conda-Forge-Status| + +.. code:: sh + + conda install -c conda-forge tqdm + +Latest Snapcraft release +~~~~~~~~~~~~~~~~~~~~~~~~ + +|Snapcraft| + +There are 3 channels to choose from: + +.. code:: sh + + snap install tqdm # implies --stable, i.e. latest tagged release + snap install tqdm --candidate # master branch + snap install tqdm --edge # devel branch + +Note that ``snap`` binaries are purely for CLI use (not ``import``-able), and +automatically set up ``bash`` tab-completion. + +Latest Docker release +~~~~~~~~~~~~~~~~~~~~~ + +|Docker| + +.. code:: sh + + docker pull tqdm/tqdm + docker run -i --rm tqdm/tqdm --help + +Other +~~~~~ + +There are other (unofficial) places where ``tqdm`` may be downloaded, particularly for CLI use: + +|Repology| + +.. |Repology| image:: https://repology.org/badge/tiny-repos/python:tqdm.svg + :target: https://repology.org/project/python:tqdm/versions + +Changelog +--------- + +The list of all changes is available either on GitHub's Releases: +|GitHub-Status|, on the +`wiki `__, or on the +`website `__. + + +Usage +----- + +``tqdm`` is very versatile and can be used in a number of ways. +The three main ones are given below. + +Iterable-based +~~~~~~~~~~~~~~ + +Wrap ``tqdm()`` around any iterable: + +.. code:: python + + from tqdm import tqdm + from time import sleep + + text = "" + for char in tqdm(["a", "b", "c", "d"]): + sleep(0.25) + text = text + char + +``trange(i)`` is a special optimised instance of ``tqdm(range(i))``: + +.. code:: python + + from tqdm import trange + + for i in trange(100): + sleep(0.01) + +Instantiation outside of the loop allows for manual control over ``tqdm()``: + +.. code:: python + + pbar = tqdm(["a", "b", "c", "d"]) + for char in pbar: + sleep(0.25) + pbar.set_description("Processing %s" % char) + +Manual +~~~~~~ + +Manual control of ``tqdm()`` updates using a ``with`` statement: + +.. code:: python + + with tqdm(total=100) as pbar: + for i in range(10): + sleep(0.1) + pbar.update(10) + +If the optional variable ``total`` (or an iterable with ``len()``) is +provided, predictive stats are displayed. + +``with`` is also optional (you can just assign ``tqdm()`` to a variable, +but in this case don't forget to ``del`` or ``close()`` at the end: + +.. code:: python + + pbar = tqdm(total=100) + for i in range(10): + sleep(0.1) + pbar.update(10) + pbar.close() + +Module +~~~~~~ + +Perhaps the most wonderful use of ``tqdm`` is in a script or on the command +line. Simply inserting ``tqdm`` (or ``python -m tqdm``) between pipes will pass +through all ``stdin`` to ``stdout`` while printing progress to ``stderr``. + +The example below demonstrate counting the number of lines in all Python files +in the current directory, with timing information included. + +.. code:: sh + + $ time find . -name '*.py' -type f -exec cat \{} \; | wc -l + 857365 + + real 0m3.458s + user 0m0.274s + sys 0m3.325s + + $ time find . -name '*.py' -type f -exec cat \{} \; | tqdm | wc -l + 857366it [00:03, 246471.31it/s] + 857365 + + real 0m3.585s + user 0m0.862s + sys 0m3.358s + +Note that the usual arguments for ``tqdm`` can also be specified. + +.. code:: sh + + $ find . -name '*.py' -type f -exec cat \{} \; | + tqdm --unit loc --unit_scale --total 857366 >> /dev/null + 100%|█████████████████████████████████| 857K/857K [00:04<00:00, 246Kloc/s] + +Backing up a large directory? + +.. code:: sh + + $ tar -zcf - docs/ | tqdm --bytes --total `du -sb docs/ | cut -f1` \ + > backup.tgz + 44%|██████████████▊ | 153M/352M [00:14<00:18, 11.0MB/s] + +This can be beautified further: + +.. code:: sh + + $ BYTES=$(du -sb docs/ | cut -f1) + $ tar -cf - docs/ \ + | tqdm --bytes --total "$BYTES" --desc Processing | gzip \ + | tqdm --bytes --total "$BYTES" --desc Compressed --position 1 \ + > ~/backup.tgz + Processing: 100%|██████████████████████| 352M/352M [00:14<00:00, 30.2MB/s] + Compressed: 42%|█████████▎ | 148M/352M [00:14<00:19, 10.9MB/s] + +Or done on a file level using 7-zip: + +.. code:: sh + + $ 7z a -bd -r backup.7z docs/ | grep Compressing \ + | tqdm --total $(find docs/ -type f | wc -l) --unit files \ + | grep -v Compressing + 100%|██████████████████████████▉| 15327/15327 [01:00<00:00, 712.96files/s] + +Pre-existing CLI programs already outputting basic progress information will +benefit from ``tqdm``'s ``--update`` and ``--update_to`` flags: + +.. code:: sh + + $ seq 3 0.1 5 | tqdm --total 5 --update_to --null + 100%|████████████████████████████████████| 5.0/5 [00:00<00:00, 9673.21it/s] + $ seq 10 | tqdm --update --null # 1 + 2 + ... + 10 = 55 iterations + 55it [00:00, 90006.52it/s] + +FAQ and Known Issues +-------------------- + +|GitHub-Issues| + +The most common issues relate to excessive output on multiple lines, instead +of a neat one-line progress bar. + +- Consoles in general: require support for carriage return (``CR``, ``\r``). + + * Some cloud logging consoles which don't support ``\r`` properly + (`cloudwatch `__, + `K8s `__) may benefit from + ``export TQDM_POSITION=-1``. + +- Nested progress bars: + + * Consoles in general: require support for moving cursors up to the + previous line. For example, + `IDLE `__, + `ConEmu `__ and + `PyCharm `__ (also + `here `__, + `here `__, and + `here `__) + lack full support. + * Windows: additionally may require the Python module ``colorama`` + to ensure nested bars stay within their respective lines. + +- Unicode: + + * Environments which report that they support unicode will have solid smooth + progress bars. The fallback is an ``ascii``-only bar. + * Windows consoles often only partially support unicode and thus + `often require explicit ascii=True `__ + (also `here `__). This is due to + either normal-width unicode characters being incorrectly displayed as + "wide", or some unicode characters not rendering. + +- Wrapping generators: + + * Generator wrapper functions tend to hide the length of iterables. + ``tqdm`` does not. + * Replace ``tqdm(enumerate(...))`` with ``enumerate(tqdm(...))`` or + ``tqdm(enumerate(x), total=len(x), ...)``. + The same applies to ``numpy.ndenumerate``. + * Replace ``tqdm(zip(a, b))`` with ``zip(tqdm(a), b)`` or even + ``zip(tqdm(a), tqdm(b))``. + * The same applies to ``itertools``. + * Some useful convenience functions can be found under ``tqdm.contrib``. + +- `No intermediate output in docker-compose `__: + use ``docker-compose run`` instead of ``docker-compose up`` and ``tty: true``. + +- Overriding defaults via environment variables: + e.g. in CI/cloud jobs, ``export TQDM_MININTERVAL=5`` to avoid log spam. + This override logic is handled by the ``tqdm.utils.envwrap`` decorator + (useful independent of ``tqdm``). + +If you come across any other difficulties, browse and file |GitHub-Issues|. + +Documentation +------------- + +|Py-Versions| |README-Hits| (Since 19 May 2016) + +.. code:: python + + class tqdm(): + """ + Decorate an iterable object, returning an iterator which acts exactly + like the original iterable, but prints a dynamically updating + progress bar every time a value is requested. + """ + + @envwrap("tqdm") # override defaults via env vars + def __init__(self, iterable=None, desc=None, total=None, leave=True, + file=None, ncols=None, mininterval=0.1, + maxinterval=10.0, miniters=None, ascii=None, disable=False, + unit='it', unit_scale=False, dynamic_ncols=False, + smoothing=0.3, bar_format=None, initial=0, position=None, + postfix=None, unit_divisor=1000, write_bytes=False, + lock_args=None, nrows=None, colour=None, delay=0): + +Parameters +~~~~~~~~~~ + +* iterable : iterable, optional + Iterable to decorate with a progress bar. + Leave blank to manually manage the updates. +* desc : str, optional + Prefix for the progress bar. +* total : int or float, optional + The number of expected iterations. If unspecified, + len(iterable) is used if possible. If float("inf") or as a last + resort, only basic progress statistics are displayed + (no ETA, no progress bar). + If ``gui`` is True and this parameter needs subsequent updating, + specify an initial arbitrary large positive number, + e.g. 9e9. +* leave : bool, optional + If [default: True], keeps all traces of the progress bar + upon termination of iteration. + If ``None``, will leave only if ``position`` is ``0``. +* file : ``io.TextIOWrapper`` or ``io.StringIO``, optional + Specifies where to output the progress messages + (default: sys.stderr). Uses ``file.write(str)`` and ``file.flush()`` + methods. For encoding, see ``write_bytes``. +* ncols : int, optional + The width of the entire output message. If specified, + dynamically resizes the progress bar to stay within this bound. + If unspecified, attempts to use environment width. The + fallback is a meter width of 10 and no limit for the counter and + statistics. If 0, will not print any meter (only stats). +* mininterval : float, optional + Minimum progress display update interval [default: 0.1] seconds. +* maxinterval : float, optional + Maximum progress display update interval [default: 10] seconds. + Automatically adjusts ``miniters`` to correspond to ``mininterval`` + after long display update lag. Only works if ``dynamic_miniters`` + or monitor thread is enabled. +* miniters : int or float, optional + Minimum progress display update interval, in iterations. + If 0 and ``dynamic_miniters``, will automatically adjust to equal + ``mininterval`` (more CPU efficient, good for tight loops). + If > 0, will skip display of specified number of iterations. + Tweak this and ``mininterval`` to get very efficient loops. + If your progress is erratic with both fast and slow iterations + (network, skipping items, etc) you should set miniters=1. +* ascii : bool or str, optional + If unspecified or False, use unicode (smooth blocks) to fill + the meter. The fallback is to use ASCII characters " 123456789#". +* disable : bool, optional + Whether to disable the entire progress bar wrapper + [default: False]. If set to None, disable on non-TTY. +* unit : str, optional + String that will be used to define the unit of each iteration + [default: it]. +* unit_scale : bool or int or float, optional + If 1 or True, the number of iterations will be reduced/scaled + automatically and a metric prefix following the + International System of Units standard will be added + (kilo, mega, etc.) [default: False]. If any other non-zero + number, will scale ``total`` and ``n``. +* dynamic_ncols : bool, optional + If set, constantly alters ``ncols`` and ``nrows`` to the + environment (allowing for window resizes) [default: False]. +* smoothing : float, optional + Exponential moving average smoothing factor for speed estimates + (ignored in GUI mode). Ranges from 0 (average speed) to 1 + (current/instantaneous speed) [default: 0.3]. +* bar_format : str, optional + Specify a custom bar string formatting. May impact performance. + [default: '{l_bar}{bar}{r_bar}'], where + l_bar='{desc}: {percentage:3.0f}%|' and + r_bar='| {n_fmt}/{total_fmt} [{elapsed}<{remaining}, ' + '{rate_fmt}{postfix}]' + Possible vars: l_bar, bar, r_bar, n, n_fmt, total, total_fmt, + percentage, elapsed, elapsed_s, ncols, nrows, desc, unit, + rate, rate_fmt, rate_noinv, rate_noinv_fmt, + rate_inv, rate_inv_fmt, postfix, unit_divisor, + remaining, remaining_s, eta. + Note that a trailing ": " is automatically removed after {desc} + if the latter is empty. +* initial : int or float, optional + The initial counter value. Useful when restarting a progress + bar [default: 0]. If using float, consider specifying ``{n:.3f}`` + or similar in ``bar_format``, or specifying ``unit_scale``. +* position : int, optional + Specify the line offset to print this bar (starting from 0) + Automatic if unspecified. + Useful to manage multiple bars at once (eg, from threads). +* postfix : dict or ``*``, optional + Specify additional stats to display at the end of the bar. + Calls ``set_postfix(**postfix)`` if possible (dict). +* unit_divisor : float, optional + [default: 1000], ignored unless ``unit_scale`` is True. +* write_bytes : bool, optional + Whether to write bytes. If (default: False) will write unicode. +* lock_args : tuple, optional + Passed to ``refresh`` for intermediate output + (initialisation, iterating, and updating). +* nrows : int, optional + The screen height. If specified, hides nested bars outside this + bound. If unspecified, attempts to use environment height. + The fallback is 20. +* colour : str, optional + Bar colour (e.g. 'green', '#00ff00'). +* delay : float, optional + Don't display until [default: 0] seconds have elapsed. + +Extra CLI Options +~~~~~~~~~~~~~~~~~ + +* delim : chr, optional + Delimiting character [default: '\n']. Use '\0' for null. + N.B.: on Windows systems, Python converts '\n' to '\r\n'. +* buf_size : int, optional + String buffer size in bytes [default: 256] + used when ``delim`` is specified. +* bytes : bool, optional + If true, will count bytes, ignore ``delim``, and default + ``unit_scale`` to True, ``unit_divisor`` to 1024, and ``unit`` to 'B'. +* tee : bool, optional + If true, passes ``stdin`` to both ``stderr`` and ``stdout``. +* update : bool, optional + If true, will treat input as newly elapsed iterations, + i.e. numbers to pass to ``update()``. Note that this is slow + (~2e5 it/s) since every input must be decoded as a number. +* update_to : bool, optional + If true, will treat input as total elapsed iterations, + i.e. numbers to assign to ``self.n``. Note that this is slow + (~2e5 it/s) since every input must be decoded as a number. +* null : bool, optional + If true, will discard input (no stdout). +* manpath : str, optional + Directory in which to install tqdm man pages. +* comppath : str, optional + Directory in which to place tqdm completion. +* log : str, optional + CRITICAL|FATAL|ERROR|WARN(ING)|[default: 'INFO']|DEBUG|NOTSET. + +Returns +~~~~~~~ + +* out : decorated iterator. + +.. code:: python + + class tqdm(): + def update(self, n=1): + """ + Manually update the progress bar, useful for streams + such as reading files. + E.g.: + >>> t = tqdm(total=filesize) # Initialise + >>> for current_buffer in stream: + ... ... + ... t.update(len(current_buffer)) + >>> t.close() + The last line is highly recommended, but possibly not necessary if + `t.update()` will be called in such a way that `filesize` will be + exactly reached and printed. + + Parameters + ---------- + n : int or float, optional + Increment to add to the internal counter of iterations + [default: 1]. If using float, consider specifying `{n:.3f}` + or similar in `bar_format`, or specifying `unit_scale`. + + Returns + ------- + out : bool or None + True if a `display()` was triggered. + """ + + def close(self): + """Cleanup and (if leave=False) close the progress bar.""" + + def clear(self, nomove=False): + """Clear current bar display.""" + + def refresh(self): + """ + Force refresh the display of this bar. + + Parameters + ---------- + nolock : bool, optional + If `True`, does not lock. + If [default: `False`]: calls `acquire()` on internal lock. + lock_args : tuple, optional + Passed to internal lock's `acquire()`. + If specified, will only `display()` if `acquire()` returns `True`. + """ + + def unpause(self): + """Restart tqdm timer from last print time.""" + + def reset(self, total=None): + """ + Resets to 0 iterations for repeated use. + + Consider combining with `leave=True`. + + Parameters + ---------- + total : int or float, optional. Total to use for the new bar. + """ + + def set_description(self, desc=None, refresh=True): + """ + Set/modify description of the progress bar. + + Parameters + ---------- + desc : str, optional + refresh : bool, optional + Forces refresh [default: True]. + """ + + def set_postfix(self, ordered_dict=None, refresh=True, **tqdm_kwargs): + """ + Set/modify postfix (additional stats) + with automatic formatting based on datatype. + + Parameters + ---------- + ordered_dict : dict or OrderedDict, optional + refresh : bool, optional + Forces refresh [default: True]. + kwargs : dict, optional + """ + + @classmethod + def write(cls, s, file=sys.stdout, end="\n"): + """Print a message via tqdm (without overlap with bars).""" + + @property + def format_dict(self): + """Public API for read-only member access.""" + + def display(self, msg=None, pos=None): + """ + Use `self.sp` to display `msg` in the specified `pos`. + + Consider overloading this function when inheriting to use e.g.: + `self.some_frontend(**self.format_dict)` instead of `self.sp`. + + Parameters + ---------- + msg : str, optional. What to display (default: `repr(self)`). + pos : int, optional. Position to `moveto` + (default: `abs(self.pos)`). + """ + + @classmethod + @contextmanager + def wrapattr(cls, stream, method, total=None, bytes=True, **tqdm_kwargs): + """ + stream : file-like object. + method : str, "read" or "write". The result of `read()` and + the first argument of `write()` should have a `len()`. + + >>> with tqdm.wrapattr(file_obj, "read", total=file_obj.size) as fobj: + ... while True: + ... chunk = fobj.read(chunk_size) + ... if not chunk: + ... break + """ + + @classmethod + def pandas(cls, *targs, **tqdm_kwargs): + """Registers the current `tqdm` class with `pandas`.""" + + def trange(*args, **tqdm_kwargs): + """Shortcut for `tqdm(range(*args), **tqdm_kwargs)`.""" + +Convenience Functions +~~~~~~~~~~~~~~~~~~~~~ + +.. code:: python + + def tqdm.contrib.tenumerate(iterable, start=0, total=None, + tqdm_class=tqdm.auto.tqdm, **tqdm_kwargs): + """Equivalent of `numpy.ndenumerate` or builtin `enumerate`.""" + + def tqdm.contrib.tzip(iter1, *iter2plus, **tqdm_kwargs): + """Equivalent of builtin `zip`.""" + + def tqdm.contrib.tmap(function, *sequences, **tqdm_kwargs): + """Equivalent of builtin `map`.""" + +Submodules +~~~~~~~~~~ + +.. code:: python + + class tqdm.notebook.tqdm(tqdm.tqdm): + """IPython/Jupyter Notebook widget.""" + + class tqdm.auto.tqdm(tqdm.tqdm): + """Automatically chooses between `tqdm.notebook` and `tqdm.tqdm`.""" + + class tqdm.asyncio.tqdm(tqdm.tqdm): + """Asynchronous version.""" + @classmethod + def as_completed(cls, fs, *, loop=None, timeout=None, total=None, + **tqdm_kwargs): + """Wrapper for `asyncio.as_completed`.""" + + class tqdm.gui.tqdm(tqdm.tqdm): + """Matplotlib GUI version.""" + + class tqdm.tk.tqdm(tqdm.tqdm): + """Tkinter GUI version.""" + + class tqdm.rich.tqdm(tqdm.tqdm): + """`rich.progress` version.""" + + class tqdm.keras.TqdmCallback(keras.callbacks.Callback): + """Keras callback for epoch and batch progress.""" + + class tqdm.dask.TqdmCallback(dask.callbacks.Callback): + """Dask callback for task progress.""" + + +``contrib`` ++++++++++++ + +The ``tqdm.contrib`` package also contains experimental modules: + +- `tqdm.contrib.itertools `_: Thin wrappers around ``itertools`` +- `tqdm.contrib.concurrent `_: Thin wrappers around ``concurrent.futures`` +- `tqdm.contrib.slack `_: Posts to `Slack `__ bots +- `tqdm.contrib.discord `_: Posts to `Discord `__ bots +- `tqdm.contrib.telegram `_: Posts to `Telegram `__ bots +- `tqdm.contrib.bells `_: Automagically enables all optional features + + * ``auto``, ``pandas``, ``slack``, ``discord``, ``telegram`` + +.. image:: https://tqdm.github.io/img/screenshot-discord.png + :alt: Screenshot of `tqdm.contrib.discord` in action + +Examples and Advanced Usage +--------------------------- + +- See the `examples `__ + folder; +- import the module and run ``help()``; +- consult the `wiki `__; + + * this has an + `excellent article `__ + on how to make a **great** progress bar; + +- check out the `slides from PyData London `__, or +- run the |binder-demo|. + +Description and additional stats +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Custom information can be displayed and updated dynamically on ``tqdm`` bars +with the ``desc`` and ``postfix`` arguments: + +.. code:: python + + from tqdm import tqdm, trange + from random import random, randint + from time import sleep + + with trange(10) as t: + for i in t: + # Description will be displayed on the left + t.set_description('GEN %i' % i) + # Postfix will be displayed on the right, + # formatted automatically based on argument's datatype + t.set_postfix(loss=random(), gen=randint(1,999), str='h', + lst=[1, 2]) + sleep(0.1) + + with tqdm(total=10, bar_format="{postfix[0]} {postfix[1][value]:>8.2g}", + postfix=["Batch", {"value": 0}]) as t: + for i in range(10): + sleep(0.1) + t.postfix[1]["value"] = i / 2 + t.update() + +Points to remember when using ``{postfix[...]}`` in the ``bar_format`` string: + +- ``postfix`` also needs to be passed as an initial argument in a compatible + format, and +- ``postfix`` will be auto-converted to a string if it is a ``dict``-like + object. To prevent this behaviour, insert an extra item into the dictionary + where the key is not a string. + +Additional ``bar_format`` parameters may also be defined by overriding +``format_dict``, and the bar itself may be modified using ``ascii``: + +.. code:: python + + from tqdm import tqdm + class TqdmExtraFormat(tqdm): + """Provides a `total_time` format parameter""" + @property + def format_dict(self): + d = super().format_dict + total_time = d["elapsed"] * (d["total"] or 0) / max(d["n"], 1) + d.update(total_time=self.format_interval(total_time) + " in total") + return d + + for i in TqdmExtraFormat( + range(9), ascii=" .oO0", + bar_format="{total_time}: {percentage:.0f}%|{bar}{r_bar}"): + if i == 4: + break + +.. code:: + + 00:00 in total: 44%|0000. | 4/9 [00:00<00:00, 962.93it/s] + +Note that ``{bar}`` also supports a format specifier ``[width][type]``. + +- ``width`` + + * unspecified (default): automatic to fill ``ncols`` + * ``int >= 0``: fixed width overriding ``ncols`` logic + * ``int < 0``: subtract from the automatic default + +- ``type`` + + * ``a``: ascii (``ascii=True`` override) + * ``u``: unicode (``ascii=False`` override) + * ``b``: blank (``ascii=" "`` override) + +This means a fixed bar with right-justified text may be created by using: +``bar_format="{l_bar}{bar:10}|{bar:-10b}right-justified"`` + +Nested progress bars +~~~~~~~~~~~~~~~~~~~~ + +``tqdm`` supports nested progress bars. Here's an example: + +.. code:: python + + from tqdm.auto import trange + from time import sleep + + for i in trange(4, desc='1st loop'): + for j in trange(5, desc='2nd loop'): + for k in trange(50, desc='3rd loop', leave=False): + sleep(0.01) + +For manual control over positioning (e.g. for multi-processing use), +you may specify ``position=n`` where ``n=0`` for the outermost bar, +``n=1`` for the next, and so on. +However, it's best to check if ``tqdm`` can work without manual ``position`` +first. + +.. code:: python + + from time import sleep + from tqdm import trange, tqdm + from multiprocessing import Pool, RLock, freeze_support + + L = list(range(9)) + + def progresser(n): + interval = 0.001 / (n + 2) + total = 5000 + text = f"#{n}, est. {interval * total:<04.2}s" + for _ in trange(total, desc=text, position=n): + sleep(interval) + + if __name__ == '__main__': + freeze_support() # for Windows support + tqdm.set_lock(RLock()) # for managing output contention + p = Pool(initializer=tqdm.set_lock, initargs=(tqdm.get_lock(),)) + p.map(progresser, L) + +Note that in Python 3, ``tqdm.write`` is thread-safe: + +.. code:: python + + from time import sleep + from tqdm import tqdm, trange + from concurrent.futures import ThreadPoolExecutor + + L = list(range(9)) + + def progresser(n): + interval = 0.001 / (n + 2) + total = 5000 + text = f"#{n}, est. {interval * total:<04.2}s" + for _ in trange(total, desc=text): + sleep(interval) + if n == 6: + tqdm.write("n == 6 completed.") + tqdm.write("`tqdm.write()` is thread-safe in py3!") + + if __name__ == '__main__': + with ThreadPoolExecutor() as p: + p.map(progresser, L) + +Hooks and callbacks +~~~~~~~~~~~~~~~~~~~ + +``tqdm`` can easily support callbacks/hooks and manual updates. +Here's an example with ``urllib``: + +**``urllib.urlretrieve`` documentation** + + | [...] + | If present, the hook function will be called once + | on establishment of the network connection and once after each block read + | thereafter. The hook will be passed three arguments; a count of blocks + | transferred so far, a block size in bytes, and the total size of the file. + | [...] + +.. code:: python + + import urllib, os + from tqdm import tqdm + urllib = getattr(urllib, 'request', urllib) + + class TqdmUpTo(tqdm): + """Provides `update_to(n)` which uses `tqdm.update(delta_n)`.""" + def update_to(self, b=1, bsize=1, tsize=None): + """ + b : int, optional + Number of blocks transferred so far [default: 1]. + bsize : int, optional + Size of each block (in tqdm units) [default: 1]. + tsize : int, optional + Total size (in tqdm units). If [default: None] remains unchanged. + """ + if tsize is not None: + self.total = tsize + return self.update(b * bsize - self.n) # also sets self.n = b * bsize + + eg_link = "https://cgi.cdcl.ml/matryoshka.zip" + with TqdmUpTo(unit='B', unit_scale=True, unit_divisor=1024, miniters=1, + desc=eg_link.split('/')[-1]) as t: # all optional kwargs + urllib.urlretrieve(eg_link, filename=os.devnull, + reporthook=t.update_to, data=None) + t.total = t.n + +Inspired by `twine#242 `__. +Functional alternative in +`examples/tqdm_wget.py `__. + +It is recommend to use ``miniters=1`` whenever there is potentially +large differences in iteration speed (e.g. downloading a file over +a patchy connection). + +**Wrapping read/write methods** + +To measure throughput through a file-like object's ``read`` or ``write`` +methods, use ``CallbackIOWrapper``: + +.. code:: python + + from tqdm.auto import tqdm + from tqdm.utils import CallbackIOWrapper + + with tqdm(total=file_obj.size, + unit='B', unit_scale=True, unit_divisor=1024) as t: + fobj = CallbackIOWrapper(t.update, file_obj, "read") + while True: + chunk = fobj.read(chunk_size) + if not chunk: + break + t.reset() + # ... continue to use `t` for something else + +Alternatively, use the even simpler ``wrapattr`` convenience function, +which would condense both the ``urllib`` and ``CallbackIOWrapper`` examples +down to: + +.. code:: python + + import urllib, os + from tqdm import tqdm + + eg_link = "https://cgi.cdcl.ml/matryoshka.zip" + response = getattr(urllib, 'request', urllib).urlopen(eg_link) + with tqdm.wrapattr(open(os.devnull, "wb"), "write", + miniters=1, desc=eg_link.split('/')[-1], + total=getattr(response, 'length', None)) as fout: + for chunk in response: + fout.write(chunk) + +The ``requests`` equivalent is nearly identical: + +.. code:: python + + import requests, os + from tqdm import tqdm + + eg_link = "https://cgi.cdcl.ml/matryoshka.zip" + response = requests.get(eg_link, stream=True) + with tqdm.wrapattr(open(os.devnull, "wb"), "write", + miniters=1, desc=eg_link.split('/')[-1], + total=int(response.headers.get('content-length', 0))) as fout: + for chunk in response.iter_content(chunk_size=4096): + fout.write(chunk) + +**Custom callback** + +``tqdm`` is known for intelligently skipping unnecessary displays. To make a +custom callback take advantage of this, simply use the return value of +``update()``. This is set to ``True`` if a ``display()`` was triggered. + +.. code:: python + + from tqdm.auto import tqdm as std_tqdm + + def external_callback(*args, **kwargs): + ... + + class TqdmExt(std_tqdm): + def update(self, n=1): + displayed = super().update(n) + if displayed: + external_callback(**self.format_dict) + return displayed + +``asyncio`` +~~~~~~~~~~~ + +Note that ``break`` isn't currently caught by asynchronous iterators. +This means that ``tqdm`` cannot clean up after itself in this case: + +.. code:: python + + from tqdm.asyncio import tqdm + + async for i in tqdm(range(9)): + if i == 2: + break + +Instead, either call ``pbar.close()`` manually or use the context manager syntax: + +.. code:: python + + from tqdm.asyncio import tqdm + + with tqdm(range(9)) as pbar: + async for i in pbar: + if i == 2: + break + +Pandas Integration +~~~~~~~~~~~~~~~~~~ + +Due to popular demand we've added support for ``pandas`` -- here's an example +for ``DataFrame.progress_apply`` and ``DataFrameGroupBy.progress_apply``: + +.. code:: python + + import pandas as pd + import numpy as np + from tqdm import tqdm + + df = pd.DataFrame(np.random.randint(0, 100, (100000, 6))) + + # Register `pandas.progress_apply` and `pandas.Series.map_apply` with `tqdm` + # (can use `tqdm.gui.tqdm`, `tqdm.notebook.tqdm`, optional kwargs, etc.) + tqdm.pandas(desc="my bar!") + + # Now you can use `progress_apply` instead of `apply` + # and `progress_map` instead of `map` + df.progress_apply(lambda x: x**2) + # can also groupby: + # df.groupby(0).progress_apply(lambda x: x**2) + +In case you're interested in how this works (and how to modify it for your +own callbacks), see the +`examples `__ +folder or import the module and run ``help()``. + +Keras Integration +~~~~~~~~~~~~~~~~~ + +A ``keras`` callback is also available: + +.. code:: python + + from tqdm.keras import TqdmCallback + + ... + + model.fit(..., verbose=0, callbacks=[TqdmCallback()]) + +Dask Integration +~~~~~~~~~~~~~~~~ + +A ``dask`` callback is also available: + +.. code:: python + + from tqdm.dask import TqdmCallback + + with TqdmCallback(desc="compute"): + ... + arr.compute() + + # or use callback globally + cb = TqdmCallback(desc="global") + cb.register() + arr.compute() + +IPython/Jupyter Integration +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +IPython/Jupyter is supported via the ``tqdm.notebook`` submodule: + +.. code:: python + + from tqdm.notebook import trange, tqdm + from time import sleep + + for i in trange(3, desc='1st loop'): + for j in tqdm(range(100), desc='2nd loop'): + sleep(0.01) + +In addition to ``tqdm`` features, the submodule provides a native Jupyter +widget (compatible with IPython v1-v4 and Jupyter), fully working nested bars +and colour hints (blue: normal, green: completed, red: error/interrupt, +light blue: no ETA); as demonstrated below. + +|Screenshot-Jupyter1| +|Screenshot-Jupyter2| +|Screenshot-Jupyter3| + +The ``notebook`` version supports percentage or pixels for overall width +(e.g.: ``ncols='100%'`` or ``ncols='480px'``). + +It is also possible to let ``tqdm`` automatically choose between +console or notebook versions by using the ``autonotebook`` submodule: + +.. code:: python + + from tqdm.autonotebook import tqdm + tqdm.pandas() + +Note that this will issue a ``TqdmExperimentalWarning`` if run in a notebook +since it is not meant to be possible to distinguish between ``jupyter notebook`` +and ``jupyter console``. Use ``auto`` instead of ``autonotebook`` to suppress +this warning. + +Note that notebooks will display the bar in the cell where it was created. +This may be a different cell from the one where it is used. +If this is not desired, either + +- delay the creation of the bar to the cell where it must be displayed, or +- create the bar with ``display=False``, and in a later cell call + ``display(bar.container)``: + +.. code:: python + + from tqdm.notebook import tqdm + pbar = tqdm(..., display=False) + +.. code:: python + + # different cell + display(pbar.container) + +The ``keras`` callback has a ``display()`` method which can be used likewise: + +.. code:: python + + from tqdm.keras import TqdmCallback + cbk = TqdmCallback(display=False) + +.. code:: python + + # different cell + cbk.display() + model.fit(..., verbose=0, callbacks=[cbk]) + +Another possibility is to have a single bar (near the top of the notebook) +which is constantly re-used (using ``reset()`` rather than ``close()``). +For this reason, the notebook version (unlike the CLI version) does not +automatically call ``close()`` upon ``Exception``. + +.. code:: python + + from tqdm.notebook import tqdm + pbar = tqdm() + +.. code:: python + + # different cell + iterable = range(100) + pbar.reset(total=len(iterable)) # initialise with new `total` + for i in iterable: + pbar.update() + pbar.refresh() # force print final status but don't `close()` + +Custom Integration +~~~~~~~~~~~~~~~~~~ + +To change the default arguments (such as making ``dynamic_ncols=True``), +simply use built-in Python magic: + +.. code:: python + + from functools import partial + from tqdm import tqdm as std_tqdm + tqdm = partial(std_tqdm, dynamic_ncols=True) + +For further customisation, +``tqdm`` may be inherited from to create custom callbacks (as with the +``TqdmUpTo`` example `above <#hooks-and-callbacks>`__) or for custom frontends +(e.g. GUIs such as notebook or plotting packages). In the latter case: + +1. ``def __init__()`` to call ``super().__init__(..., gui=True)`` to disable + terminal ``status_printer`` creation. +2. Redefine: ``close()``, ``clear()``, ``display()``. + +Consider overloading ``display()`` to use e.g. +``self.frontend(**self.format_dict)`` instead of ``self.sp(repr(self))``. + +Some submodule examples of inheritance: + +- `tqdm/notebook.py `__ +- `tqdm/gui.py `__ +- `tqdm/tk.py `__ +- `tqdm/contrib/slack.py `__ +- `tqdm/contrib/discord.py `__ +- `tqdm/contrib/telegram.py `__ + +Dynamic Monitor/Meter +~~~~~~~~~~~~~~~~~~~~~ + +You can use a ``tqdm`` as a meter which is not monotonically increasing. +This could be because ``n`` decreases (e.g. a CPU usage monitor) or ``total`` +changes. + +One example would be recursively searching for files. The ``total`` is the +number of objects found so far, while ``n`` is the number of those objects which +are files (rather than folders): + +.. code:: python + + from tqdm import tqdm + import os.path + + def find_files_recursively(path, show_progress=True): + files = [] + # total=1 assumes `path` is a file + t = tqdm(total=1, unit="file", disable=not show_progress) + if not os.path.exists(path): + raise IOError("Cannot find:" + path) + + def append_found_file(f): + files.append(f) + t.update() + + def list_found_dir(path): + """returns os.listdir(path) assuming os.path.isdir(path)""" + listing = os.listdir(path) + # subtract 1 since a "file" we found was actually this directory + t.total += len(listing) - 1 + # fancy way to give info without forcing a refresh + t.set_postfix(dir=path[-10:], refresh=False) + t.update(0) # may trigger a refresh + return listing + + def recursively_search(path): + if os.path.isdir(path): + for f in list_found_dir(path): + recursively_search(os.path.join(path, f)) + else: + append_found_file(path) + + recursively_search(path) + t.set_postfix(dir=path) + t.close() + return files + +Using ``update(0)`` is a handy way to let ``tqdm`` decide when to trigger a +display refresh to avoid console spamming. + +Writing messages +~~~~~~~~~~~~~~~~ + +This is a work in progress (see +`#737 `__). + +Since ``tqdm`` uses a simple printing mechanism to display progress bars, +you should not write any message in the terminal using ``print()`` while +a progress bar is open. + +To write messages in the terminal without any collision with ``tqdm`` bar +display, a ``.write()`` method is provided: + +.. code:: python + + from tqdm.auto import tqdm, trange + from time import sleep + + bar = trange(10) + for i in bar: + # Print using tqdm class method .write() + sleep(0.1) + if not (i % 3): + tqdm.write("Done task %i" % i) + # Can also use bar.write() + +By default, this will print to standard output ``sys.stdout``. but you can +specify any file-like object using the ``file`` argument. For example, this +can be used to redirect the messages writing to a log file or class. + +Redirecting writing +~~~~~~~~~~~~~~~~~~~ + +If using a library that can print messages to the console, editing the library +by replacing ``print()`` with ``tqdm.write()`` may not be desirable. +In that case, redirecting ``sys.stdout`` to ``tqdm.write()`` is an option. + +To redirect ``sys.stdout``, create a file-like class that will write +any input string to ``tqdm.write()``, and supply the arguments +``file=sys.stdout, dynamic_ncols=True``. + +A reusable canonical example is given below: + +.. code:: python + + from time import sleep + import contextlib + import sys + from tqdm import tqdm + from tqdm.contrib import DummyTqdmFile + + + @contextlib.contextmanager + def std_out_err_redirect_tqdm(): + orig_out_err = sys.stdout, sys.stderr + try: + sys.stdout, sys.stderr = map(DummyTqdmFile, orig_out_err) + yield orig_out_err[0] + # Relay exceptions + except Exception as exc: + raise exc + # Always restore sys.stdout/err if necessary + finally: + sys.stdout, sys.stderr = orig_out_err + + def some_fun(i): + print("Fee, fi, fo,".split()[i]) + + # Redirect stdout to tqdm.write() (don't forget the `as save_stdout`) + with std_out_err_redirect_tqdm() as orig_stdout: + # tqdm needs the original stdout + # and dynamic_ncols=True to autodetect console width + for i in tqdm(range(3), file=orig_stdout, dynamic_ncols=True): + sleep(.5) + some_fun(i) + + # After the `with`, printing is restored + print("Done!") + +Redirecting ``logging`` +~~~~~~~~~~~~~~~~~~~~~~~ + +Similar to ``sys.stdout``/``sys.stderr`` as detailed above, console ``logging`` +may also be redirected to ``tqdm.write()``. + +Warning: if also redirecting ``sys.stdout``/``sys.stderr``, make sure to +redirect ``logging`` first if needed. + +Helper methods are available in ``tqdm.contrib.logging``. For example: + +.. code:: python + + import logging + from tqdm import trange + from tqdm.contrib.logging import logging_redirect_tqdm + + LOG = logging.getLogger(__name__) + + if __name__ == '__main__': + logging.basicConfig(level=logging.INFO) + with logging_redirect_tqdm(): + for i in trange(9): + if i == 4: + LOG.info("console logging redirected to `tqdm.write()`") + # logging restored + +Monitoring thread, intervals and miniters +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +``tqdm`` implements a few tricks to increase efficiency and reduce overhead. + +- Avoid unnecessary frequent bar refreshing: ``mininterval`` defines how long + to wait between each refresh. ``tqdm`` always gets updated in the background, + but it will display only every ``mininterval``. +- Reduce number of calls to check system clock/time. +- ``mininterval`` is more intuitive to configure than ``miniters``. + A clever adjustment system ``dynamic_miniters`` will automatically adjust + ``miniters`` to the amount of iterations that fit into time ``mininterval``. + Essentially, ``tqdm`` will check if it's time to print without actually + checking time. This behaviour can be still be bypassed by manually setting + ``miniters``. + +However, consider a case with a combination of fast and slow iterations. +After a few fast iterations, ``dynamic_miniters`` will set ``miniters`` to a +large number. When iteration rate subsequently slows, ``miniters`` will +remain large and thus reduce display update frequency. To address this: + +- ``maxinterval`` defines the maximum time between display refreshes. + A concurrent monitoring thread checks for overdue updates and forces one + where necessary. + +The monitoring thread should not have a noticeable overhead, and guarantees +updates at least every 10 seconds by default. +This value can be directly changed by setting the ``monitor_interval`` of +any ``tqdm`` instance (i.e. ``t = tqdm.tqdm(...); t.monitor_interval = 2``). +The monitor thread may be disabled application-wide by setting +``tqdm.tqdm.monitor_interval = 0`` before instantiation of any ``tqdm`` bar. + + +Merch +----- + +You can buy `tqdm branded merch `__ now! + +Contributions +------------- + +|GitHub-Commits| |GitHub-Issues| |GitHub-PRs| |OpenHub-Status| |GitHub-Contributions| |CII Best Practices| + +All source code is hosted on `GitHub `__. +Contributions are welcome. + +See the +`CONTRIBUTING `__ +file for more information. + +Developers who have contributed more that 5 *loc* (surviving lines of code): + +|git-fame| + +Honourable mentions: + +- Casper da Costa-Luis `casperdcl `__ primary maintainer |Gift-Casper| +- Stephen Larroque `lrq3000 `__ maintainer +- Hadrien Mary `hadim `__ maintainer +- Mikhail Korobov `kmike `__ maintainer +- Noam Yorav-Raphael `noamraph `__ original author + +Ports to Other Languages +~~~~~~~~~~~~~~~~~~~~~~~~ + +A list is available on +`this wiki page `__. + + +LICENCE +------- + +Open Source (OSI approved): |LICENCE| + +Citation information: |DOI| + +|README-Hits| (Since 19 May 2016) + +.. |Logo| image:: https://tqdm.github.io/img/logo.gif +.. |Screenshot| image:: https://tqdm.github.io/img/tqdm.gif +.. |Video| image:: https://tqdm.github.io/img/video.jpg + :target: https://tqdm.github.io/video +.. |Slides| image:: https://tqdm.github.io/img/slides.jpg + :target: https://tqdm.github.io/PyData2019/slides.html +.. |Merch| image:: https://tqdm.github.io/img/merch.jpg + :target: https://tqdm.github.io/merch +.. |Build-Status| image:: https://img.shields.io/github/actions/workflow/status/tqdm/tqdm/test.yml?branch=master&label=tqdm&logo=GitHub + :target: https://github.com/tqdm/tqdm/actions/workflows/test.yml +.. |Coverage-Status| image:: https://img.shields.io/coveralls/github/tqdm/tqdm/master?logo=coveralls + :target: https://coveralls.io/github/tqdm/tqdm +.. |Branch-Coverage-Status| image:: https://codecov.io/gh/tqdm/tqdm/branch/master/graph/badge.svg + :target: https://codecov.io/gh/tqdm/tqdm +.. |Codacy-Grade| image:: https://app.codacy.com/project/badge/Grade/3f965571598f44549c7818f29cdcf177 + :target: https://app.codacy.com/gh/tqdm/tqdm/dashboard +.. |CII Best Practices| image:: https://bestpractices.coreinfrastructure.org/projects/3264/badge + :target: https://bestpractices.coreinfrastructure.org/projects/3264 +.. |GitHub-Status| image:: https://img.shields.io/github/tag/tqdm/tqdm.svg?maxAge=86400&logo=github&logoColor=white + :target: https://github.com/tqdm/tqdm/releases +.. |GitHub-Forks| image:: https://img.shields.io/github/forks/tqdm/tqdm.svg?logo=github&logoColor=white + :target: https://github.com/tqdm/tqdm/network +.. |GitHub-Stars| image:: https://img.shields.io/github/stars/tqdm/tqdm.svg?logo=github&logoColor=white + :target: https://github.com/tqdm/tqdm/stargazers +.. |GitHub-Commits| image:: https://img.shields.io/github/commit-activity/y/tqdm/tqdm.svg?logo=git&logoColor=white + :target: https://github.com/tqdm/tqdm/graphs/commit-activity +.. |GitHub-Issues| image:: https://img.shields.io/github/issues-closed/tqdm/tqdm.svg?logo=github&logoColor=white + :target: https://github.com/tqdm/tqdm/issues?q= +.. |GitHub-PRs| image:: https://img.shields.io/github/issues-pr-closed/tqdm/tqdm.svg?logo=github&logoColor=white + :target: https://github.com/tqdm/tqdm/pulls +.. |GitHub-Contributions| image:: https://img.shields.io/github/contributors/tqdm/tqdm.svg?logo=github&logoColor=white + :target: https://github.com/tqdm/tqdm/graphs/contributors +.. |GitHub-Updated| image:: https://img.shields.io/github/last-commit/tqdm/tqdm/master.svg?logo=github&logoColor=white&label=pushed + :target: https://github.com/tqdm/tqdm/pulse +.. |git-fame| image:: https://git-fame.cdcl.ml/gh/tqdm/tqdm?min=5&w=1&M=1&C=1&excl=(png|gif|jpg)$&enum=1 + :alt: git-fame.cdcl.ml/gh/tqdm/tqdm + :target: https://git-fame.cdcl.ml/gh/tqdm/tqdm?w=1&M=1&C=1&excl=(png|gif|jpg)$&enum=1 +.. |Gift-Casper| image:: https://img.shields.io/badge/sponsor-casper-ff69b4.svg + :target: https://cdcl.ml/sponsor +.. |Versions| image:: https://img.shields.io/pypi/v/tqdm.svg + :target: https://tqdm.github.io/releases +.. |PyPI-Downloads| image:: https://static.pepy.tech/personalized-badge/tqdm?left_text=downloads%2Fmonth + :target: https://pepy.tech/project/tqdm +.. |Py-Versions| image:: https://img.shields.io/pypi/pyversions/tqdm.svg?logo=python&logoColor=white + :target: https://pypi.org/project/tqdm +.. |Conda-Forge-Status| image:: https://img.shields.io/conda/v/conda-forge/tqdm.svg?label=conda-forge&logo=conda-forge + :target: https://anaconda.org/conda-forge/tqdm +.. |Snapcraft| image:: https://img.shields.io/badge/snap-install-82BEA0.svg?logo=snapcraft + :target: https://snapcraft.io/tqdm +.. |Docker| image:: https://img.shields.io/badge/docker-pull-blue.svg?logo=docker&logoColor=white + :target: https://hub.docker.com/r/tqdm/tqdm +.. |Libraries-Rank| image:: https://img.shields.io/librariesio/sourcerank/pypi/tqdm.svg?logo=koding&logoColor=white + :target: https://libraries.io/pypi/tqdm +.. |Libraries-Dependents| image:: https://img.shields.io/librariesio/dependent-repos/pypi/tqdm.svg?logo=koding&logoColor=white + :target: https://github.com/tqdm/tqdm/network/dependents +.. |OpenHub-Status| image:: https://www.openhub.net/p/tqdm/widgets/project_thin_badge?format=gif + :target: https://www.openhub.net/p/tqdm?ref=Thin+badge +.. |awesome-python| image:: https://awesome.re/mentioned-badge.svg + :target: https://github.com/vinta/awesome-python +.. |LICENCE| image:: https://img.shields.io/pypi/l/tqdm.svg + :target: https://raw.githubusercontent.com/tqdm/tqdm/master/LICENCE +.. |DOI| image:: https://img.shields.io/badge/DOI-10.5281/zenodo.595120-blue.svg + :target: https://doi.org/10.5281/zenodo.595120 +.. |colab-demo| image:: https://colab.research.google.com/assets/colab-badge.svg + :target: https://colab.research.google.com/github/tqdm/tqdm/blob/master/DEMO.ipynb +.. |binder-demo| image:: https://mybinder.org/badge_logo.svg + :target: https://mybinder.org/v2/gh/tqdm/tqdm/master?filepath=DEMO.ipynb +.. |Screenshot-Jupyter1| image:: https://tqdm.github.io/img/jupyter-1.gif +.. |Screenshot-Jupyter2| image:: https://tqdm.github.io/img/jupyter-2.gif +.. |Screenshot-Jupyter3| image:: https://tqdm.github.io/img/jupyter-3.gif +.. |README-Hits| image:: https://cgi.cdcl.ml/hits?q=tqdm&style=social&r=https://github.com/tqdm/tqdm&l=https://tqdm.github.io/img/favicon.png&f=https://tqdm.github.io/img/logo.gif + :target: https://cgi.cdcl.ml/hits?q=tqdm&a=plot&r=https://github.com/tqdm/tqdm&l=https://tqdm.github.io/img/favicon.png&f=https://tqdm.github.io/img/logo.gif&style=social diff --git a/.cache/pip/http-v2/c/1/6/c/6/c16c6c635e568e65136b95a15ea17f91b43799aeb0a7e80b55d7a898 b/.cache/pip/http-v2/c/1/6/c/6/c16c6c635e568e65136b95a15ea17f91b43799aeb0a7e80b55d7a898 new file mode 100644 index 0000000000000000000000000000000000000000..e98630a76deda2765b543aaa36d967464bdc1166 Binary files /dev/null and b/.cache/pip/http-v2/c/1/6/c/6/c16c6c635e568e65136b95a15ea17f91b43799aeb0a7e80b55d7a898 differ diff --git a/.cache/pip/http-v2/c/d/5/d/e/cd5de44b899cbe1869765c21b55cffc53c0c0ffa9d3c6f1fd40a42a2 b/.cache/pip/http-v2/c/d/5/d/e/cd5de44b899cbe1869765c21b55cffc53c0c0ffa9d3c6f1fd40a42a2 new file mode 100644 index 0000000000000000000000000000000000000000..f9a17a06b18249a38cf512c024f45fc6c17e6bf7 Binary files /dev/null and b/.cache/pip/http-v2/c/d/5/d/e/cd5de44b899cbe1869765c21b55cffc53c0c0ffa9d3c6f1fd40a42a2 differ diff --git a/BUSI_with_classes/.DS_Store b/BUSI_with_classes/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..2754ad92d4a945f79e7666930dfd015b9b47decf Binary files /dev/null and b/BUSI_with_classes/.DS_Store differ diff --git a/BUSI_with_classes/pipeline_check.json b/BUSI_with_classes/pipeline_check.json new file mode 100644 index 0000000000000000000000000000000000000000..c308fd871c85d1a1abc81e0e0ab5d74f27fa6a1c --- /dev/null +++ b/BUSI_with_classes/pipeline_check.json @@ -0,0 +1,13650 @@ +{ + "status": "passed", + "summary": { + "total_pairs": 647, + "benign_count": 437, + "malignant_count": 210, + "skipped_normal_count": 133, + "multi_mask_cases": 17, + "output_root": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/BUSI", + "preflight_warning_count": 17, + "preflight_error_count": 0, + "post_export_error_count": 0 + }, + "preflight": { + "warnings": [ + "benign (4) has 2 masks; selected benign (4)_mask_1.png", + "benign (25) has 2 masks; selected benign (25)_mask_1.png", + "benign (54) has 2 masks; selected benign (54)_mask_1.png", + "benign (58) has 2 masks; selected benign (58)_mask_1.png", + "benign (83) has 2 masks; selected benign (83)_mask_1.png", + "benign (92) has 2 masks; selected benign (92)_mask_1.png", + "benign (93) has 2 masks; selected benign (93)_mask_1.png", + "benign (98) has 2 masks; selected benign (98)_mask_1.png", + "benign (100) has 2 masks; selected benign (100)_mask_1.png", + "benign (163) has 2 masks; selected benign (163)_mask_1.png", + "benign (173) has 2 masks; selected benign (173)_mask_1.png", + "benign (181) has 2 masks; selected benign (181)_mask_1.png", + "benign (195) has 3 masks; selected benign (195)_mask_2.png", + "benign (315) has 2 masks; selected benign (315)_mask_1.png", + "benign (346) has 2 masks; selected benign (346)_mask_1.png", + "benign (424) has 2 masks; selected benign (424)_mask_1.png", + "malignant (53) has 2 masks; selected malignant (53)_mask_1.png" + ], + "errors": [], + "records": [ + { + "class_name": "benign", + "class_code": "B", + "image_id": 1, + "output_name": "BUSI_0001_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (1).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (1)_mask.png", + "available_masks": [ + "benign (1)_mask.png" + ], + "image_size": [ + 562, + 471 + ], + "mask_size": [ + 562, + 471 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 2, + "output_name": "BUSI_0002_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (2).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (2)_mask.png", + "available_masks": [ + "benign (2)_mask.png" + ], + "image_size": [ + 557, + 473 + ], + "mask_size": [ + 557, + 473 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 3, + "output_name": "BUSI_0003_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (3).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (3)_mask.png", + "available_masks": [ + "benign (3)_mask.png" + ], + "image_size": [ + 558, + 471 + ], + "mask_size": [ + 558, + 471 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 4, + "output_name": "BUSI_0004_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (4).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (4)_mask_1.png", + "available_masks": [ + "benign (4)_mask.png", + "benign (4)_mask_1.png" + ], + "image_size": [ + 555, + 465 + ], + "mask_size": [ + 555, + 465 + ], + "image_mode": "RGB", + "selected_mask_mode": "RGBA" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 5, + "output_name": "BUSI_0005_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (5).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (5)_mask.png", + "available_masks": [ + "benign (5)_mask.png" + ], + "image_size": [ + 549, + 496 + ], + "mask_size": [ + 549, + 496 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 6, + "output_name": "BUSI_0006_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (6).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (6)_mask.png", + "available_masks": [ + "benign (6)_mask.png" + ], + "image_size": [ + 558, + 467 + ], + "mask_size": [ + 558, + 467 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 7, + "output_name": "BUSI_0007_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (7).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (7)_mask.png", + "available_masks": [ + "benign (7)_mask.png" + ], + "image_size": [ + 624, + 578 + ], + "mask_size": [ + 624, + 578 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 8, + "output_name": "BUSI_0008_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (8).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (8)_mask.png", + "available_masks": [ + "benign (8)_mask.png" + ], + "image_size": [ + 617, + 585 + ], + "mask_size": [ + 617, + 585 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 9, + "output_name": "BUSI_0009_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (9).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (9)_mask.png", + "available_masks": [ + "benign (9)_mask.png" + ], + "image_size": [ + 752, + 585 + ], + "mask_size": [ + 752, + 585 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 10, + "output_name": "BUSI_0010_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (10).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (10)_mask.png", + "available_masks": [ + "benign (10)_mask.png" + ], + "image_size": [ + 683, + 585 + ], + "mask_size": [ + 683, + 585 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 11, + "output_name": "BUSI_0011_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (11).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (11)_mask.png", + "available_masks": [ + "benign (11)_mask.png" + ], + "image_size": [ + 689, + 587 + ], + "mask_size": [ + 689, + 587 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 12, + "output_name": "BUSI_0012_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (12).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (12)_mask.png", + "available_masks": [ + "benign (12)_mask.png" + ], + "image_size": [ + 678, + 571 + ], + "mask_size": [ + 678, + 571 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 13, + "output_name": "BUSI_0013_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (13).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (13)_mask.png", + "available_masks": [ + "benign (13)_mask.png" + ], + "image_size": [ + 678, + 571 + ], + "mask_size": [ + 678, + 571 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 14, + "output_name": "BUSI_0014_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (14).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (14)_mask.png", + "available_masks": [ + "benign (14)_mask.png" + ], + "image_size": [ + 699, + 531 + ], + "mask_size": [ + 699, + 531 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 15, + "output_name": "BUSI_0015_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (15).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (15)_mask.png", + "available_masks": [ + "benign (15)_mask.png" + ], + "image_size": [ + 701, + 526 + ], + "mask_size": [ + 701, + 526 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 16, + "output_name": "BUSI_0016_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (16).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (16)_mask.png", + "available_masks": [ + "benign (16)_mask.png" + ], + "image_size": [ + 558, + 462 + ], + "mask_size": [ + 558, + 462 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 17, + "output_name": "BUSI_0017_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (17).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (17)_mask.png", + "available_masks": [ + "benign (17)_mask.png" + ], + "image_size": [ + 558, + 463 + ], + "mask_size": [ + 558, + 463 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 18, + "output_name": "BUSI_0018_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (18).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (18)_mask.png", + "available_masks": [ + "benign (18)_mask.png" + ], + "image_size": [ + 564, + 469 + ], + "mask_size": [ + 564, + 469 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 19, + "output_name": "BUSI_0019_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (19).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (19)_mask.png", + "available_masks": [ + "benign (19)_mask.png" + ], + "image_size": [ + 663, + 572 + ], + "mask_size": [ + 663, + 572 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 20, + "output_name": "BUSI_0020_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (20).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (20)_mask.png", + "available_masks": [ + "benign (20)_mask.png" + ], + "image_size": [ + 319, + 473 + ], + "mask_size": [ + 319, + 473 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 21, + "output_name": "BUSI_0021_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (21).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (21)_mask.png", + "available_masks": [ + "benign (21)_mask.png" + ], + "image_size": [ + 558, + 451 + ], + "mask_size": [ + 558, + 451 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 22, + "output_name": "BUSI_0022_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (22).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (22)_mask.png", + "available_masks": [ + "benign (22)_mask.png" + ], + "image_size": [ + 562, + 463 + ], + "mask_size": [ + 562, + 463 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 23, + "output_name": "BUSI_0023_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (23).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (23)_mask.png", + "available_masks": [ + "benign (23)_mask.png" + ], + "image_size": [ + 779, + 583 + ], + "mask_size": [ + 779, + 583 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 24, + "output_name": "BUSI_0024_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (24).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (24)_mask.png", + "available_masks": [ + "benign (24)_mask.png" + ], + "image_size": [ + 556, + 467 + ], + "mask_size": [ + 556, + 467 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 25, + "output_name": "BUSI_0025_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (25).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (25)_mask_1.png", + "available_masks": [ + "benign (25)_mask.png", + "benign (25)_mask_1.png" + ], + "image_size": [ + 770, + 583 + ], + "mask_size": [ + 770, + 583 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 26, + "output_name": "BUSI_0026_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (26).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (26)_mask.png", + "available_masks": [ + "benign (26)_mask.png" + ], + "image_size": [ + 554, + 471 + ], + "mask_size": [ + 554, + 471 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 27, + "output_name": "BUSI_0027_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (27).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (27)_mask.png", + "available_masks": [ + "benign (27)_mask.png" + ], + "image_size": [ + 774, + 576 + ], + "mask_size": [ + 774, + 576 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 28, + "output_name": "BUSI_0028_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (28).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (28)_mask.png", + "available_masks": [ + "benign (28)_mask.png" + ], + "image_size": [ + 841, + 696 + ], + "mask_size": [ + 841, + 696 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 29, + "output_name": "BUSI_0029_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (29).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (29)_mask.png", + "available_masks": [ + "benign (29)_mask.png" + ], + "image_size": [ + 561, + 462 + ], + "mask_size": [ + 561, + 462 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 30, + "output_name": "BUSI_0030_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (30).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (30)_mask.png", + "available_masks": [ + "benign (30)_mask.png" + ], + "image_size": [ + 557, + 462 + ], + "mask_size": [ + 557, + 462 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 31, + "output_name": "BUSI_0031_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (31).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (31)_mask.png", + "available_masks": [ + "benign (31)_mask.png" + ], + "image_size": [ + 557, + 467 + ], + "mask_size": [ + 557, + 467 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 32, + "output_name": "BUSI_0032_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (32).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (32)_mask.png", + "available_masks": [ + "benign (32)_mask.png" + ], + "image_size": [ + 656, + 611 + ], + "mask_size": [ + 656, + 611 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 33, + "output_name": "BUSI_0033_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (33).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (33)_mask.png", + "available_masks": [ + "benign (33)_mask.png" + ], + "image_size": [ + 556, + 468 + ], + "mask_size": [ + 556, + 468 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 34, + "output_name": "BUSI_0034_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (34).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (34)_mask.png", + "available_masks": [ + "benign (34)_mask.png" + ], + "image_size": [ + 558, + 471 + ], + "mask_size": [ + 558, + 471 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 35, + "output_name": "BUSI_0035_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (35).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (35)_mask.png", + "available_masks": [ + "benign (35)_mask.png" + ], + "image_size": [ + 556, + 476 + ], + "mask_size": [ + 556, + 476 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 36, + "output_name": "BUSI_0036_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (36).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (36)_mask.png", + "available_masks": [ + "benign (36)_mask.png" + ], + "image_size": [ + 526, + 474 + ], + "mask_size": [ + 526, + 474 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 37, + "output_name": "BUSI_0037_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (37).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (37)_mask.png", + "available_masks": [ + "benign (37)_mask.png" + ], + "image_size": [ + 557, + 468 + ], + "mask_size": [ + 557, + 468 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 38, + "output_name": "BUSI_0038_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (38).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (38)_mask.png", + "available_masks": [ + "benign (38)_mask.png" + ], + "image_size": [ + 550, + 484 + ], + "mask_size": [ + 550, + 484 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 39, + "output_name": "BUSI_0039_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (39).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (39)_mask.png", + "available_masks": [ + "benign (39)_mask.png" + ], + "image_size": [ + 578, + 433 + ], + "mask_size": [ + 578, + 433 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 40, + "output_name": "BUSI_0040_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (40).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (40)_mask.png", + "available_masks": [ + "benign (40)_mask.png" + ], + "image_size": [ + 706, + 526 + ], + "mask_size": [ + 706, + 526 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 41, + "output_name": "BUSI_0041_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (41).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (41)_mask.png", + "available_masks": [ + "benign (41)_mask.png" + ], + "image_size": [ + 550, + 484 + ], + "mask_size": [ + 550, + 484 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 42, + "output_name": "BUSI_0042_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (42).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (42)_mask.png", + "available_masks": [ + "benign (42)_mask.png" + ], + "image_size": [ + 581, + 437 + ], + "mask_size": [ + 581, + 437 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 43, + "output_name": "BUSI_0043_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (43).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (43)_mask.png", + "available_masks": [ + "benign (43)_mask.png" + ], + "image_size": [ + 554, + 495 + ], + "mask_size": [ + 554, + 495 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 44, + "output_name": "BUSI_0044_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (44).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (44)_mask.png", + "available_masks": [ + "benign (44)_mask.png" + ], + "image_size": [ + 777, + 580 + ], + "mask_size": [ + 777, + 580 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 45, + "output_name": "BUSI_0045_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (45).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (45)_mask.png", + "available_masks": [ + "benign (45)_mask.png" + ], + "image_size": [ + 775, + 580 + ], + "mask_size": [ + 775, + 580 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 46, + "output_name": "BUSI_0046_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (46).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (46)_mask.png", + "available_masks": [ + "benign (46)_mask.png" + ], + "image_size": [ + 561, + 468 + ], + "mask_size": [ + 561, + 468 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 47, + "output_name": "BUSI_0047_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (47).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (47)_mask.png", + "available_masks": [ + "benign (47)_mask.png" + ], + "image_size": [ + 763, + 585 + ], + "mask_size": [ + 763, + 585 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 48, + "output_name": "BUSI_0048_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (48).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (48)_mask.png", + "available_masks": [ + "benign (48)_mask.png" + ], + "image_size": [ + 775, + 583 + ], + "mask_size": [ + 775, + 583 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 49, + "output_name": "BUSI_0049_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (49).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (49)_mask.png", + "available_masks": [ + "benign (49)_mask.png" + ], + "image_size": [ + 777, + 576 + ], + "mask_size": [ + 777, + 576 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 50, + "output_name": "BUSI_0050_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (50).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (50)_mask.png", + "available_masks": [ + "benign (50)_mask.png" + ], + "image_size": [ + 884, + 581 + ], + "mask_size": [ + 884, + 581 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 51, + "output_name": "BUSI_0051_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (51).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (51)_mask.png", + "available_masks": [ + "benign (51)_mask.png" + ], + "image_size": [ + 357, + 338 + ], + "mask_size": [ + 357, + 338 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 52, + "output_name": "BUSI_0052_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (52).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (52)_mask.png", + "available_masks": [ + "benign (52)_mask.png" + ], + "image_size": [ + 370, + 338 + ], + "mask_size": [ + 370, + 338 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 53, + "output_name": "BUSI_0053_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (53).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (53)_mask.png", + "available_masks": [ + "benign (53)_mask.png" + ], + "image_size": [ + 552, + 492 + ], + "mask_size": [ + 552, + 492 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 54, + "output_name": "BUSI_0054_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (54).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (54)_mask_1.png", + "available_masks": [ + "benign (54)_mask.png", + "benign (54)_mask_1.png" + ], + "image_size": [ + 616, + 468 + ], + "mask_size": [ + 616, + 468 + ], + "image_mode": "RGB", + "selected_mask_mode": "RGBA" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 55, + "output_name": "BUSI_0055_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (55).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (55)_mask.png", + "available_masks": [ + "benign (55)_mask.png" + ], + "image_size": [ + 763, + 614 + ], + "mask_size": [ + 763, + 614 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 56, + "output_name": "BUSI_0056_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (56).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (56)_mask.png", + "available_masks": [ + "benign (56)_mask.png" + ], + "image_size": [ + 806, + 711 + ], + "mask_size": [ + 806, + 711 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 57, + "output_name": "BUSI_0057_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (57).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (57)_mask.png", + "available_masks": [ + "benign (57)_mask.png" + ], + "image_size": [ + 555, + 470 + ], + "mask_size": [ + 555, + 470 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 58, + "output_name": "BUSI_0058_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (58).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (58)_mask_1.png", + "available_masks": [ + "benign (58)_mask.png", + "benign (58)_mask_1.png" + ], + "image_size": [ + 781, + 572 + ], + "mask_size": [ + 781, + 572 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 59, + "output_name": "BUSI_0059_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (59).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (59)_mask.png", + "available_masks": [ + "benign (59)_mask.png" + ], + "image_size": [ + 563, + 468 + ], + "mask_size": [ + 563, + 468 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 60, + "output_name": "BUSI_0060_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (60).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (60)_mask.png", + "available_masks": [ + "benign (60)_mask.png" + ], + "image_size": [ + 759, + 598 + ], + "mask_size": [ + 759, + 598 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 61, + "output_name": "BUSI_0061_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (61).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (61)_mask.png", + "available_masks": [ + "benign (61)_mask.png" + ], + "image_size": [ + 773, + 578 + ], + "mask_size": [ + 773, + 578 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 62, + "output_name": "BUSI_0062_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (62).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (62)_mask.png", + "available_masks": [ + "benign (62)_mask.png" + ], + "image_size": [ + 389, + 594 + ], + "mask_size": [ + 389, + 594 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 63, + "output_name": "BUSI_0063_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (63).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (63)_mask.png", + "available_masks": [ + "benign (63)_mask.png" + ], + "image_size": [ + 608, + 660 + ], + "mask_size": [ + 608, + 660 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 64, + "output_name": "BUSI_0064_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (64).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (64)_mask.png", + "available_masks": [ + "benign (64)_mask.png" + ], + "image_size": [ + 610, + 471 + ], + "mask_size": [ + 610, + 471 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 65, + "output_name": "BUSI_0065_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (65).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (65)_mask.png", + "available_masks": [ + "benign (65)_mask.png" + ], + "image_size": [ + 564, + 474 + ], + "mask_size": [ + 564, + 474 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 66, + "output_name": "BUSI_0066_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (66).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (66)_mask.png", + "available_masks": [ + "benign (66)_mask.png" + ], + "image_size": [ + 562, + 473 + ], + "mask_size": [ + 562, + 473 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 67, + "output_name": "BUSI_0067_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (67).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (67)_mask.png", + "available_masks": [ + "benign (67)_mask.png" + ], + "image_size": [ + 516, + 467 + ], + "mask_size": [ + 516, + 467 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 68, + "output_name": "BUSI_0068_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (68).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (68)_mask.png", + "available_masks": [ + "benign (68)_mask.png" + ], + "image_size": [ + 682, + 587 + ], + "mask_size": [ + 682, + 587 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 69, + "output_name": "BUSI_0069_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (69).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (69)_mask.png", + "available_masks": [ + "benign (69)_mask.png" + ], + "image_size": [ + 811, + 719 + ], + "mask_size": [ + 811, + 719 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 70, + "output_name": "BUSI_0070_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (70).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (70)_mask.png", + "available_masks": [ + "benign (70)_mask.png" + ], + "image_size": [ + 713, + 475 + ], + "mask_size": [ + 713, + 475 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 71, + "output_name": "BUSI_0071_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (71).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (71)_mask.png", + "available_masks": [ + "benign (71)_mask.png" + ], + "image_size": [ + 554, + 469 + ], + "mask_size": [ + 554, + 469 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 72, + "output_name": "BUSI_0072_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (72).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (72)_mask.png", + "available_masks": [ + "benign (72)_mask.png" + ], + "image_size": [ + 557, + 465 + ], + "mask_size": [ + 557, + 465 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 73, + "output_name": "BUSI_0073_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (73).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (73)_mask.png", + "available_masks": [ + "benign (73)_mask.png" + ], + "image_size": [ + 557, + 471 + ], + "mask_size": [ + 557, + 471 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 74, + "output_name": "BUSI_0074_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (74).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (74)_mask.png", + "available_masks": [ + "benign (74)_mask.png" + ], + "image_size": [ + 561, + 467 + ], + "mask_size": [ + 561, + 467 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 75, + "output_name": "BUSI_0075_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (75).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (75)_mask.png", + "available_masks": [ + "benign (75)_mask.png" + ], + "image_size": [ + 685, + 578 + ], + "mask_size": [ + 685, + 578 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 76, + "output_name": "BUSI_0076_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (76).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (76)_mask.png", + "available_masks": [ + "benign (76)_mask.png" + ], + "image_size": [ + 848, + 685 + ], + "mask_size": [ + 848, + 685 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 77, + "output_name": "BUSI_0077_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (77).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (77)_mask.png", + "available_masks": [ + "benign (77)_mask.png" + ], + "image_size": [ + 551, + 488 + ], + "mask_size": [ + 551, + 488 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 78, + "output_name": "BUSI_0078_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (78).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (78)_mask.png", + "available_masks": [ + "benign (78)_mask.png" + ], + "image_size": [ + 777, + 576 + ], + "mask_size": [ + 777, + 576 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 79, + "output_name": "BUSI_0079_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (79).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (79)_mask.png", + "available_masks": [ + "benign (79)_mask.png" + ], + "image_size": [ + 648, + 604 + ], + "mask_size": [ + 648, + 604 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 80, + "output_name": "BUSI_0080_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (80).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (80)_mask.png", + "available_masks": [ + "benign (80)_mask.png" + ], + "image_size": [ + 561, + 473 + ], + "mask_size": [ + 561, + 473 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 81, + "output_name": "BUSI_0081_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (81).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (81)_mask.png", + "available_masks": [ + "benign (81)_mask.png" + ], + "image_size": [ + 563, + 464 + ], + "mask_size": [ + 563, + 464 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 82, + "output_name": "BUSI_0082_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (82).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (82)_mask.png", + "available_masks": [ + "benign (82)_mask.png" + ], + "image_size": [ + 656, + 458 + ], + "mask_size": [ + 656, + 458 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 83, + "output_name": "BUSI_0083_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (83).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (83)_mask_1.png", + "available_masks": [ + "benign (83)_mask.png", + "benign (83)_mask_1.png" + ], + "image_size": [ + 581, + 432 + ], + "mask_size": [ + 581, + 432 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 84, + "output_name": "BUSI_0084_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (84).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (84)_mask.png", + "available_masks": [ + "benign (84)_mask.png" + ], + "image_size": [ + 839, + 510 + ], + "mask_size": [ + 839, + 510 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 85, + "output_name": "BUSI_0085_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (85).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (85)_mask.png", + "available_masks": [ + "benign (85)_mask.png" + ], + "image_size": [ + 561, + 465 + ], + "mask_size": [ + 561, + 465 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 86, + "output_name": "BUSI_0086_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (86).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (86)_mask.png", + "available_masks": [ + "benign (86)_mask.png" + ], + "image_size": [ + 777, + 578 + ], + "mask_size": [ + 777, + 578 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 87, + "output_name": "BUSI_0087_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (87).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (87)_mask.png", + "available_masks": [ + "benign (87)_mask.png" + ], + "image_size": [ + 768, + 571 + ], + "mask_size": [ + 768, + 571 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 88, + "output_name": "BUSI_0088_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (88).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (88)_mask.png", + "available_masks": [ + "benign (88)_mask.png" + ], + "image_size": [ + 873, + 560 + ], + "mask_size": [ + 873, + 560 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 89, + "output_name": "BUSI_0089_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (89).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (89)_mask.png", + "available_masks": [ + "benign (89)_mask.png" + ], + "image_size": [ + 893, + 576 + ], + "mask_size": [ + 893, + 576 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 90, + "output_name": "BUSI_0090_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (90).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (90)_mask.png", + "available_masks": [ + "benign (90)_mask.png" + ], + "image_size": [ + 772, + 574 + ], + "mask_size": [ + 772, + 574 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 91, + "output_name": "BUSI_0091_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (91).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (91)_mask.png", + "available_masks": [ + "benign (91)_mask.png" + ], + "image_size": [ + 806, + 704 + ], + "mask_size": [ + 806, + 704 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 92, + "output_name": "BUSI_0092_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (92).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (92)_mask_1.png", + "available_masks": [ + "benign (92)_mask.png", + "benign (92)_mask_1.png" + ], + "image_size": [ + 763, + 612 + ], + "mask_size": [ + 763, + 612 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 93, + "output_name": "BUSI_0093_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (93).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (93)_mask_1.png", + "available_masks": [ + "benign (93)_mask.png", + "benign (93)_mask_1.png" + ], + "image_size": [ + 561, + 466 + ], + "mask_size": [ + 561, + 466 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 94, + "output_name": "BUSI_0094_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (94).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (94)_mask.png", + "available_masks": [ + "benign (94)_mask.png" + ], + "image_size": [ + 767, + 583 + ], + "mask_size": [ + 767, + 583 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 95, + "output_name": "BUSI_0095_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (95).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (95)_mask.png", + "available_masks": [ + "benign (95)_mask.png" + ], + "image_size": [ + 558, + 470 + ], + "mask_size": [ + 558, + 470 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 96, + "output_name": "BUSI_0096_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (96).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (96)_mask.png", + "available_masks": [ + "benign (96)_mask.png" + ], + "image_size": [ + 767, + 574 + ], + "mask_size": [ + 767, + 574 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 97, + "output_name": "BUSI_0097_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (97).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (97)_mask.png", + "available_masks": [ + "benign (97)_mask.png" + ], + "image_size": [ + 592, + 470 + ], + "mask_size": [ + 592, + 470 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 98, + "output_name": "BUSI_0098_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (98).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (98)_mask_1.png", + "available_masks": [ + "benign (98)_mask.png", + "benign (98)_mask_1.png" + ], + "image_size": [ + 795, + 558 + ], + "mask_size": [ + 795, + 558 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 99, + "output_name": "BUSI_0099_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (99).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (99)_mask.png", + "available_masks": [ + "benign (99)_mask.png" + ], + "image_size": [ + 554, + 471 + ], + "mask_size": [ + 554, + 471 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 100, + "output_name": "BUSI_0100_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (100).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (100)_mask_1.png", + "available_masks": [ + "benign (100)_mask.png", + "benign (100)_mask_1.png" + ], + "image_size": [ + 323, + 473 + ], + "mask_size": [ + 323, + 473 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 101, + "output_name": "BUSI_0101_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (101).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (101)_mask.png", + "available_masks": [ + "benign (101)_mask.png" + ], + "image_size": [ + 563, + 473 + ], + "mask_size": [ + 563, + 473 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 102, + "output_name": "BUSI_0102_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (102).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (102)_mask.png", + "available_masks": [ + "benign (102)_mask.png" + ], + "image_size": [ + 634, + 610 + ], + "mask_size": [ + 634, + 610 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 103, + "output_name": "BUSI_0103_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (103).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (103)_mask.png", + "available_masks": [ + "benign (103)_mask.png" + ], + "image_size": [ + 766, + 585 + ], + "mask_size": [ + 766, + 585 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 104, + "output_name": "BUSI_0104_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (104).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (104)_mask.png", + "available_masks": [ + "benign (104)_mask.png" + ], + "image_size": [ + 777, + 578 + ], + "mask_size": [ + 777, + 578 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 105, + "output_name": "BUSI_0105_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (105).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (105)_mask.png", + "available_masks": [ + "benign (105)_mask.png" + ], + "image_size": [ + 882, + 581 + ], + "mask_size": [ + 882, + 581 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 106, + "output_name": "BUSI_0106_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (106).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (106)_mask.png", + "available_masks": [ + "benign (106)_mask.png" + ], + "image_size": [ + 808, + 716 + ], + "mask_size": [ + 808, + 716 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 107, + "output_name": "BUSI_0107_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (107).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (107)_mask.png", + "available_masks": [ + "benign (107)_mask.png" + ], + "image_size": [ + 759, + 616 + ], + "mask_size": [ + 759, + 616 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 108, + "output_name": "BUSI_0108_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (108).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (108)_mask.png", + "available_masks": [ + "benign (108)_mask.png" + ], + "image_size": [ + 769, + 582 + ], + "mask_size": [ + 769, + 582 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 109, + "output_name": "BUSI_0109_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (109).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (109)_mask.png", + "available_masks": [ + "benign (109)_mask.png" + ], + "image_size": [ + 562, + 470 + ], + "mask_size": [ + 562, + 470 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 110, + "output_name": "BUSI_0110_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (110).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (110)_mask.png", + "available_masks": [ + "benign (110)_mask.png" + ], + "image_size": [ + 555, + 468 + ], + "mask_size": [ + 555, + 468 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 111, + "output_name": "BUSI_0111_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (111).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (111)_mask.png", + "available_masks": [ + "benign (111)_mask.png" + ], + "image_size": [ + 315, + 477 + ], + "mask_size": [ + 315, + 477 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 112, + "output_name": "BUSI_0112_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (112).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (112)_mask.png", + "available_masks": [ + "benign (112)_mask.png" + ], + "image_size": [ + 652, + 612 + ], + "mask_size": [ + 652, + 612 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 113, + "output_name": "BUSI_0113_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (113).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (113)_mask.png", + "available_masks": [ + "benign (113)_mask.png" + ], + "image_size": [ + 810, + 695 + ], + "mask_size": [ + 810, + 695 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 114, + "output_name": "BUSI_0114_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (114).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (114)_mask.png", + "available_masks": [ + "benign (114)_mask.png" + ], + "image_size": [ + 757, + 575 + ], + "mask_size": [ + 757, + 575 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 115, + "output_name": "BUSI_0115_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (115).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (115)_mask.png", + "available_masks": [ + "benign (115)_mask.png" + ], + "image_size": [ + 554, + 469 + ], + "mask_size": [ + 554, + 469 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 116, + "output_name": "BUSI_0116_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (116).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (116)_mask.png", + "available_masks": [ + "benign (116)_mask.png" + ], + "image_size": [ + 766, + 588 + ], + "mask_size": [ + 766, + 588 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 117, + "output_name": "BUSI_0117_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (117).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (117)_mask.png", + "available_masks": [ + "benign (117)_mask.png" + ], + "image_size": [ + 806, + 688 + ], + "mask_size": [ + 806, + 688 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 118, + "output_name": "BUSI_0118_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (118).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (118)_mask.png", + "available_masks": [ + "benign (118)_mask.png" + ], + "image_size": [ + 653, + 620 + ], + "mask_size": [ + 653, + 620 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 119, + "output_name": "BUSI_0119_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (119).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (119)_mask.png", + "available_masks": [ + "benign (119)_mask.png" + ], + "image_size": [ + 762, + 585 + ], + "mask_size": [ + 762, + 585 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 120, + "output_name": "BUSI_0120_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (120).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (120)_mask.png", + "available_masks": [ + "benign (120)_mask.png" + ], + "image_size": [ + 808, + 695 + ], + "mask_size": [ + 808, + 695 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 121, + "output_name": "BUSI_0121_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (121).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (121)_mask.png", + "available_masks": [ + "benign (121)_mask.png" + ], + "image_size": [ + 646, + 610 + ], + "mask_size": [ + 646, + 610 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 122, + "output_name": "BUSI_0122_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (122).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (122)_mask.png", + "available_masks": [ + "benign (122)_mask.png" + ], + "image_size": [ + 774, + 577 + ], + "mask_size": [ + 774, + 577 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 123, + "output_name": "BUSI_0123_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (123).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (123)_mask.png", + "available_masks": [ + "benign (123)_mask.png" + ], + "image_size": [ + 648, + 610 + ], + "mask_size": [ + 648, + 610 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 124, + "output_name": "BUSI_0124_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (124).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (124)_mask.png", + "available_masks": [ + "benign (124)_mask.png" + ], + "image_size": [ + 645, + 614 + ], + "mask_size": [ + 645, + 614 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 125, + "output_name": "BUSI_0125_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (125).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (125)_mask.png", + "available_masks": [ + "benign (125)_mask.png" + ], + "image_size": [ + 756, + 578 + ], + "mask_size": [ + 756, + 578 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 126, + "output_name": "BUSI_0126_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (126).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (126)_mask.png", + "available_masks": [ + "benign (126)_mask.png" + ], + "image_size": [ + 771, + 570 + ], + "mask_size": [ + 771, + 570 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 127, + "output_name": "BUSI_0127_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (127).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (127)_mask.png", + "available_masks": [ + "benign (127)_mask.png" + ], + "image_size": [ + 558, + 476 + ], + "mask_size": [ + 558, + 476 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 128, + "output_name": "BUSI_0128_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (128).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (128)_mask.png", + "available_masks": [ + "benign (128)_mask.png" + ], + "image_size": [ + 549, + 475 + ], + "mask_size": [ + 549, + 475 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 129, + "output_name": "BUSI_0129_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (129).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (129)_mask.png", + "available_masks": [ + "benign (129)_mask.png" + ], + "image_size": [ + 775, + 587 + ], + "mask_size": [ + 775, + 587 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 130, + "output_name": "BUSI_0130_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (130).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (130)_mask.png", + "available_masks": [ + "benign (130)_mask.png" + ], + "image_size": [ + 558, + 474 + ], + "mask_size": [ + 558, + 474 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 131, + "output_name": "BUSI_0131_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (131).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (131)_mask.png", + "available_masks": [ + "benign (131)_mask.png" + ], + "image_size": [ + 587, + 435 + ], + "mask_size": [ + 587, + 435 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 132, + "output_name": "BUSI_0132_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (132).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (132)_mask.png", + "available_masks": [ + "benign (132)_mask.png" + ], + "image_size": [ + 552, + 483 + ], + "mask_size": [ + 552, + 483 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 133, + "output_name": "BUSI_0133_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (133).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (133)_mask.png", + "available_masks": [ + "benign (133)_mask.png" + ], + "image_size": [ + 369, + 342 + ], + "mask_size": [ + 369, + 342 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 134, + "output_name": "BUSI_0134_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (134).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (134)_mask.png", + "available_masks": [ + "benign (134)_mask.png" + ], + "image_size": [ + 378, + 345 + ], + "mask_size": [ + 378, + 345 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 135, + "output_name": "BUSI_0135_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (135).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (135)_mask.png", + "available_masks": [ + "benign (135)_mask.png" + ], + "image_size": [ + 776, + 582 + ], + "mask_size": [ + 776, + 582 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 136, + "output_name": "BUSI_0136_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (136).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (136)_mask.png", + "available_masks": [ + "benign (136)_mask.png" + ], + "image_size": [ + 886, + 581 + ], + "mask_size": [ + 886, + 581 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 137, + "output_name": "BUSI_0137_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (137).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (137)_mask.png", + "available_masks": [ + "benign (137)_mask.png" + ], + "image_size": [ + 777, + 578 + ], + "mask_size": [ + 777, + 578 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 138, + "output_name": "BUSI_0138_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (138).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (138)_mask.png", + "available_masks": [ + "benign (138)_mask.png" + ], + "image_size": [ + 766, + 600 + ], + "mask_size": [ + 766, + 600 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 139, + "output_name": "BUSI_0139_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (139).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (139)_mask.png", + "available_masks": [ + "benign (139)_mask.png" + ], + "image_size": [ + 563, + 468 + ], + "mask_size": [ + 563, + 468 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 140, + "output_name": "BUSI_0140_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (140).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (140)_mask.png", + "available_masks": [ + "benign (140)_mask.png" + ], + "image_size": [ + 452, + 591 + ], + "mask_size": [ + 452, + 591 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 141, + "output_name": "BUSI_0141_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (141).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (141)_mask.png", + "available_masks": [ + "benign (141)_mask.png" + ], + "image_size": [ + 567, + 471 + ], + "mask_size": [ + 567, + 471 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 142, + "output_name": "BUSI_0142_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (142).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (142)_mask.png", + "available_masks": [ + "benign (142)_mask.png" + ], + "image_size": [ + 785, + 582 + ], + "mask_size": [ + 785, + 582 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 143, + "output_name": "BUSI_0143_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (143).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (143)_mask.png", + "available_masks": [ + "benign (143)_mask.png" + ], + "image_size": [ + 554, + 467 + ], + "mask_size": [ + 554, + 467 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 144, + "output_name": "BUSI_0144_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (144).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (144)_mask.png", + "available_masks": [ + "benign (144)_mask.png" + ], + "image_size": [ + 770, + 580 + ], + "mask_size": [ + 770, + 580 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 145, + "output_name": "BUSI_0145_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (145).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (145)_mask.png", + "available_masks": [ + "benign (145)_mask.png" + ], + "image_size": [ + 779, + 574 + ], + "mask_size": [ + 779, + 574 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 146, + "output_name": "BUSI_0146_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (146).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (146)_mask.png", + "available_masks": [ + "benign (146)_mask.png" + ], + "image_size": [ + 449, + 594 + ], + "mask_size": [ + 449, + 594 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 147, + "output_name": "BUSI_0147_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (147).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (147)_mask.png", + "available_masks": [ + "benign (147)_mask.png" + ], + "image_size": [ + 564, + 463 + ], + "mask_size": [ + 564, + 463 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 148, + "output_name": "BUSI_0148_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (148).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (148)_mask.png", + "available_masks": [ + "benign (148)_mask.png" + ], + "image_size": [ + 567, + 463 + ], + "mask_size": [ + 567, + 463 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 149, + "output_name": "BUSI_0149_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (149).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (149)_mask.png", + "available_masks": [ + "benign (149)_mask.png" + ], + "image_size": [ + 557, + 468 + ], + "mask_size": [ + 557, + 468 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 150, + "output_name": "BUSI_0150_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (150).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (150)_mask.png", + "available_masks": [ + "benign (150)_mask.png" + ], + "image_size": [ + 671, + 570 + ], + "mask_size": [ + 671, + 570 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 151, + "output_name": "BUSI_0151_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (151).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (151)_mask.png", + "available_masks": [ + "benign (151)_mask.png" + ], + "image_size": [ + 560, + 469 + ], + "mask_size": [ + 560, + 469 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 152, + "output_name": "BUSI_0152_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (152).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (152)_mask.png", + "available_masks": [ + "benign (152)_mask.png" + ], + "image_size": [ + 555, + 471 + ], + "mask_size": [ + 555, + 471 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 153, + "output_name": "BUSI_0153_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (153).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (153)_mask.png", + "available_masks": [ + "benign (153)_mask.png" + ], + "image_size": [ + 772, + 574 + ], + "mask_size": [ + 772, + 574 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 154, + "output_name": "BUSI_0154_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (154).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (154)_mask.png", + "available_masks": [ + "benign (154)_mask.png" + ], + "image_size": [ + 556, + 464 + ], + "mask_size": [ + 556, + 464 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 155, + "output_name": "BUSI_0155_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (155).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (155)_mask.png", + "available_masks": [ + "benign (155)_mask.png" + ], + "image_size": [ + 783, + 583 + ], + "mask_size": [ + 783, + 583 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 156, + "output_name": "BUSI_0156_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (156).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (156)_mask.png", + "available_masks": [ + "benign (156)_mask.png" + ], + "image_size": [ + 887, + 581 + ], + "mask_size": [ + 887, + 581 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 157, + "output_name": "BUSI_0157_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (157).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (157)_mask.png", + "available_masks": [ + "benign (157)_mask.png" + ], + "image_size": [ + 567, + 465 + ], + "mask_size": [ + 567, + 465 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 158, + "output_name": "BUSI_0158_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (158).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (158)_mask.png", + "available_masks": [ + "benign (158)_mask.png" + ], + "image_size": [ + 556, + 464 + ], + "mask_size": [ + 556, + 464 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 159, + "output_name": "BUSI_0159_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (159).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (159)_mask.png", + "available_masks": [ + "benign (159)_mask.png" + ], + "image_size": [ + 696, + 574 + ], + "mask_size": [ + 696, + 574 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 160, + "output_name": "BUSI_0160_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (160).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (160)_mask.png", + "available_masks": [ + "benign (160)_mask.png" + ], + "image_size": [ + 624, + 585 + ], + "mask_size": [ + 624, + 585 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 161, + "output_name": "BUSI_0161_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (161).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (161)_mask.png", + "available_masks": [ + "benign (161)_mask.png" + ], + "image_size": [ + 568, + 463 + ], + "mask_size": [ + 568, + 463 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 162, + "output_name": "BUSI_0162_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (162).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (162)_mask.png", + "available_masks": [ + "benign (162)_mask.png" + ], + "image_size": [ + 549, + 470 + ], + "mask_size": [ + 549, + 470 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 163, + "output_name": "BUSI_0163_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (163).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (163)_mask_1.png", + "available_masks": [ + "benign (163)_mask.png", + "benign (163)_mask_1.png" + ], + "image_size": [ + 779, + 576 + ], + "mask_size": [ + 779, + 576 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 164, + "output_name": "BUSI_0164_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (164).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (164)_mask.png", + "available_masks": [ + "benign (164)_mask.png" + ], + "image_size": [ + 560, + 470 + ], + "mask_size": [ + 560, + 470 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 165, + "output_name": "BUSI_0165_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (165).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (165)_mask.png", + "available_masks": [ + "benign (165)_mask.png" + ], + "image_size": [ + 558, + 464 + ], + "mask_size": [ + 558, + 464 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 166, + "output_name": "BUSI_0166_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (166).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (166)_mask.png", + "available_masks": [ + "benign (166)_mask.png" + ], + "image_size": [ + 555, + 471 + ], + "mask_size": [ + 555, + 471 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 167, + "output_name": "BUSI_0167_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (167).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (167)_mask.png", + "available_masks": [ + "benign (167)_mask.png" + ], + "image_size": [ + 566, + 463 + ], + "mask_size": [ + 566, + 463 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 168, + "output_name": "BUSI_0168_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (168).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (168)_mask.png", + "available_masks": [ + "benign (168)_mask.png" + ], + "image_size": [ + 557, + 471 + ], + "mask_size": [ + 557, + 471 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 169, + "output_name": "BUSI_0169_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (169).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (169)_mask.png", + "available_masks": [ + "benign (169)_mask.png" + ], + "image_size": [ + 561, + 469 + ], + "mask_size": [ + 561, + 469 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 170, + "output_name": "BUSI_0170_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (170).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (170)_mask.png", + "available_masks": [ + "benign (170)_mask.png" + ], + "image_size": [ + 564, + 468 + ], + "mask_size": [ + 564, + 468 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 171, + "output_name": "BUSI_0171_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (171).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (171)_mask.png", + "available_masks": [ + "benign (171)_mask.png" + ], + "image_size": [ + 566, + 463 + ], + "mask_size": [ + 566, + 463 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 172, + "output_name": "BUSI_0172_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (172).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (172)_mask.png", + "available_masks": [ + "benign (172)_mask.png" + ], + "image_size": [ + 619, + 589 + ], + "mask_size": [ + 619, + 589 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 173, + "output_name": "BUSI_0173_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (173).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (173)_mask_1.png", + "available_masks": [ + "benign (173)_mask.png", + "benign (173)_mask_1.png" + ], + "image_size": [ + 726, + 573 + ], + "mask_size": [ + 726, + 573 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 174, + "output_name": "BUSI_0174_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (174).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (174)_mask.png", + "available_masks": [ + "benign (174)_mask.png" + ], + "image_size": [ + 556, + 490 + ], + "mask_size": [ + 556, + 490 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 175, + "output_name": "BUSI_0175_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (175).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (175)_mask.png", + "available_masks": [ + "benign (175)_mask.png" + ], + "image_size": [ + 765, + 573 + ], + "mask_size": [ + 765, + 573 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 176, + "output_name": "BUSI_0176_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (176).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (176)_mask.png", + "available_masks": [ + "benign (176)_mask.png" + ], + "image_size": [ + 715, + 487 + ], + "mask_size": [ + 715, + 487 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 177, + "output_name": "BUSI_0177_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (177).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (177)_mask.png", + "available_masks": [ + "benign (177)_mask.png" + ], + "image_size": [ + 562, + 470 + ], + "mask_size": [ + 562, + 470 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 178, + "output_name": "BUSI_0178_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (178).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (178)_mask.png", + "available_masks": [ + "benign (178)_mask.png" + ], + "image_size": [ + 772, + 576 + ], + "mask_size": [ + 772, + 576 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 179, + "output_name": "BUSI_0179_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (179).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (179)_mask.png", + "available_masks": [ + "benign (179)_mask.png" + ], + "image_size": [ + 422, + 468 + ], + "mask_size": [ + 422, + 468 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 180, + "output_name": "BUSI_0180_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (180).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (180)_mask.png", + "available_masks": [ + "benign (180)_mask.png" + ], + "image_size": [ + 763, + 600 + ], + "mask_size": [ + 763, + 600 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 181, + "output_name": "BUSI_0181_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (181).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (181)_mask_1.png", + "available_masks": [ + "benign (181)_mask.png", + "benign (181)_mask_1.png" + ], + "image_size": [ + 733, + 455 + ], + "mask_size": [ + 733, + 455 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 182, + "output_name": "BUSI_0182_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (182).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (182)_mask.png", + "available_masks": [ + "benign (182)_mask.png" + ], + "image_size": [ + 555, + 463 + ], + "mask_size": [ + 555, + 463 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 183, + "output_name": "BUSI_0183_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (183).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (183)_mask.png", + "available_masks": [ + "benign (183)_mask.png" + ], + "image_size": [ + 916, + 683 + ], + "mask_size": [ + 916, + 683 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 184, + "output_name": "BUSI_0184_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (184).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (184)_mask.png", + "available_masks": [ + "benign (184)_mask.png" + ], + "image_size": [ + 349, + 487 + ], + "mask_size": [ + 349, + 487 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 185, + "output_name": "BUSI_0185_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (185).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (185)_mask.png", + "available_masks": [ + "benign (185)_mask.png" + ], + "image_size": [ + 752, + 592 + ], + "mask_size": [ + 752, + 592 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 186, + "output_name": "BUSI_0186_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (186).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (186)_mask.png", + "available_masks": [ + "benign (186)_mask.png" + ], + "image_size": [ + 741, + 574 + ], + "mask_size": [ + 741, + 574 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 187, + "output_name": "BUSI_0187_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (187).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (187)_mask.png", + "available_masks": [ + "benign (187)_mask.png" + ], + "image_size": [ + 730, + 574 + ], + "mask_size": [ + 730, + 574 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 188, + "output_name": "BUSI_0188_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (188).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (188)_mask.png", + "available_masks": [ + "benign (188)_mask.png" + ], + "image_size": [ + 655, + 600 + ], + "mask_size": [ + 655, + 600 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 189, + "output_name": "BUSI_0189_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (189).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (189)_mask.png", + "available_masks": [ + "benign (189)_mask.png" + ], + "image_size": [ + 544, + 465 + ], + "mask_size": [ + 544, + 465 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 190, + "output_name": "BUSI_0190_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (190).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (190)_mask.png", + "available_masks": [ + "benign (190)_mask.png" + ], + "image_size": [ + 734, + 470 + ], + "mask_size": [ + 734, + 470 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 191, + "output_name": "BUSI_0191_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (191).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (191)_mask.png", + "available_masks": [ + "benign (191)_mask.png" + ], + "image_size": [ + 549, + 463 + ], + "mask_size": [ + 549, + 463 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 192, + "output_name": "BUSI_0192_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (192).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (192)_mask.png", + "available_masks": [ + "benign (192)_mask.png" + ], + "image_size": [ + 557, + 474 + ], + "mask_size": [ + 557, + 474 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 193, + "output_name": "BUSI_0193_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (193).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (193)_mask.png", + "available_masks": [ + "benign (193)_mask.png" + ], + "image_size": [ + 754, + 580 + ], + "mask_size": [ + 754, + 580 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 194, + "output_name": "BUSI_0194_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (194).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (194)_mask.png", + "available_masks": [ + "benign (194)_mask.png" + ], + "image_size": [ + 711, + 492 + ], + "mask_size": [ + 711, + 492 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 195, + "output_name": "BUSI_0195_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (195).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (195)_mask_2.png", + "available_masks": [ + "benign (195)_mask.png", + "benign (195)_mask_1.png", + "benign (195)_mask_2.png" + ], + "image_size": [ + 729, + 611 + ], + "mask_size": [ + 729, + 611 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 196, + "output_name": "BUSI_0196_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (196).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (196)_mask.png", + "available_masks": [ + "benign (196)_mask.png" + ], + "image_size": [ + 766, + 580 + ], + "mask_size": [ + 766, + 580 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 197, + "output_name": "BUSI_0197_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (197).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (197)_mask.png", + "available_masks": [ + "benign (197)_mask.png" + ], + "image_size": [ + 547, + 465 + ], + "mask_size": [ + 547, + 465 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 198, + "output_name": "BUSI_0198_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (198).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (198)_mask.png", + "available_masks": [ + "benign (198)_mask.png" + ], + "image_size": [ + 759, + 571 + ], + "mask_size": [ + 759, + 571 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 199, + "output_name": "BUSI_0199_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (199).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (199)_mask.png", + "available_masks": [ + "benign (199)_mask.png" + ], + "image_size": [ + 556, + 473 + ], + "mask_size": [ + 556, + 473 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 200, + "output_name": "BUSI_0200_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (200).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (200)_mask.png", + "available_masks": [ + "benign (200)_mask.png" + ], + "image_size": [ + 554, + 473 + ], + "mask_size": [ + 554, + 473 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 201, + "output_name": "BUSI_0201_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (201).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (201)_mask.png", + "available_masks": [ + "benign (201)_mask.png" + ], + "image_size": [ + 556, + 474 + ], + "mask_size": [ + 556, + 474 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 202, + "output_name": "BUSI_0202_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (202).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (202)_mask.png", + "available_masks": [ + "benign (202)_mask.png" + ], + "image_size": [ + 552, + 469 + ], + "mask_size": [ + 552, + 469 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 203, + "output_name": "BUSI_0203_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (203).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (203)_mask.png", + "available_masks": [ + "benign (203)_mask.png" + ], + "image_size": [ + 569, + 471 + ], + "mask_size": [ + 569, + 471 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 204, + "output_name": "BUSI_0204_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (204).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (204)_mask.png", + "available_masks": [ + "benign (204)_mask.png" + ], + "image_size": [ + 560, + 476 + ], + "mask_size": [ + 560, + 476 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 205, + "output_name": "BUSI_0205_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (205).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (205)_mask.png", + "available_masks": [ + "benign (205)_mask.png" + ], + "image_size": [ + 557, + 477 + ], + "mask_size": [ + 557, + 477 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 206, + "output_name": "BUSI_0206_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (206).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (206)_mask.png", + "available_masks": [ + "benign (206)_mask.png" + ], + "image_size": [ + 569, + 485 + ], + "mask_size": [ + 569, + 485 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 207, + "output_name": "BUSI_0207_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (207).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (207)_mask.png", + "available_masks": [ + "benign (207)_mask.png" + ], + "image_size": [ + 562, + 481 + ], + "mask_size": [ + 562, + 481 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 208, + "output_name": "BUSI_0208_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (208).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (208)_mask.png", + "available_masks": [ + "benign (208)_mask.png" + ], + "image_size": [ + 562, + 479 + ], + "mask_size": [ + 562, + 479 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 209, + "output_name": "BUSI_0209_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (209).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (209)_mask.png", + "available_masks": [ + "benign (209)_mask.png" + ], + "image_size": [ + 558, + 477 + ], + "mask_size": [ + 558, + 477 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 210, + "output_name": "BUSI_0210_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (210).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (210)_mask.png", + "available_masks": [ + "benign (210)_mask.png" + ], + "image_size": [ + 563, + 471 + ], + "mask_size": [ + 563, + 471 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 211, + "output_name": "BUSI_0211_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (211).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (211)_mask.png", + "available_masks": [ + "benign (211)_mask.png" + ], + "image_size": [ + 557, + 465 + ], + "mask_size": [ + 557, + 465 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 212, + "output_name": "BUSI_0212_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (212).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (212)_mask.png", + "available_masks": [ + "benign (212)_mask.png" + ], + "image_size": [ + 558, + 469 + ], + "mask_size": [ + 558, + 469 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 213, + "output_name": "BUSI_0213_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (213).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (213)_mask.png", + "available_masks": [ + "benign (213)_mask.png" + ], + "image_size": [ + 573, + 486 + ], + "mask_size": [ + 573, + 486 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 214, + "output_name": "BUSI_0214_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (214).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (214)_mask.png", + "available_masks": [ + "benign (214)_mask.png" + ], + "image_size": [ + 602, + 396 + ], + "mask_size": [ + 602, + 396 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 215, + "output_name": "BUSI_0215_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (215).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (215)_mask.png", + "available_masks": [ + "benign (215)_mask.png" + ], + "image_size": [ + 600, + 396 + ], + "mask_size": [ + 600, + 396 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 216, + "output_name": "BUSI_0216_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (216).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (216)_mask.png", + "available_masks": [ + "benign (216)_mask.png" + ], + "image_size": [ + 646, + 386 + ], + "mask_size": [ + 646, + 386 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 217, + "output_name": "BUSI_0217_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (217).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (217)_mask.png", + "available_masks": [ + "benign (217)_mask.png" + ], + "image_size": [ + 603, + 396 + ], + "mask_size": [ + 603, + 396 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 218, + "output_name": "BUSI_0218_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (218).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (218)_mask.png", + "available_masks": [ + "benign (218)_mask.png" + ], + "image_size": [ + 602, + 396 + ], + "mask_size": [ + 602, + 396 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 219, + "output_name": "BUSI_0219_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (219).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (219)_mask.png", + "available_masks": [ + "benign (219)_mask.png" + ], + "image_size": [ + 608, + 396 + ], + "mask_size": [ + 608, + 396 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 220, + "output_name": "BUSI_0220_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (220).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (220)_mask.png", + "available_masks": [ + "benign (220)_mask.png" + ], + "image_size": [ + 609, + 396 + ], + "mask_size": [ + 609, + 396 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 221, + "output_name": "BUSI_0221_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (221).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (221)_mask.png", + "available_masks": [ + "benign (221)_mask.png" + ], + "image_size": [ + 610, + 394 + ], + "mask_size": [ + 610, + 394 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 222, + "output_name": "BUSI_0222_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (222).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (222)_mask.png", + "available_masks": [ + "benign (222)_mask.png" + ], + "image_size": [ + 605, + 392 + ], + "mask_size": [ + 605, + 392 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 223, + "output_name": "BUSI_0223_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (223).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (223)_mask.png", + "available_masks": [ + "benign (223)_mask.png" + ], + "image_size": [ + 562, + 465 + ], + "mask_size": [ + 562, + 465 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 224, + "output_name": "BUSI_0224_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (224).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (224)_mask.png", + "available_masks": [ + "benign (224)_mask.png" + ], + "image_size": [ + 568, + 469 + ], + "mask_size": [ + 568, + 469 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 225, + "output_name": "BUSI_0225_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (225).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (225)_mask.png", + "available_masks": [ + "benign (225)_mask.png" + ], + "image_size": [ + 558, + 473 + ], + "mask_size": [ + 558, + 473 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 226, + "output_name": "BUSI_0226_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (226).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (226)_mask.png", + "available_masks": [ + "benign (226)_mask.png" + ], + "image_size": [ + 555, + 469 + ], + "mask_size": [ + 555, + 469 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 227, + "output_name": "BUSI_0227_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (227).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (227)_mask.png", + "available_masks": [ + "benign (227)_mask.png" + ], + "image_size": [ + 567, + 468 + ], + "mask_size": [ + 567, + 468 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 228, + "output_name": "BUSI_0228_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (228).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (228)_mask.png", + "available_masks": [ + "benign (228)_mask.png" + ], + "image_size": [ + 563, + 469 + ], + "mask_size": [ + 563, + 469 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 229, + "output_name": "BUSI_0229_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (229).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (229)_mask.png", + "available_masks": [ + "benign (229)_mask.png" + ], + "image_size": [ + 564, + 470 + ], + "mask_size": [ + 564, + 470 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 230, + "output_name": "BUSI_0230_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (230).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (230)_mask.png", + "available_masks": [ + "benign (230)_mask.png" + ], + "image_size": [ + 566, + 470 + ], + "mask_size": [ + 566, + 470 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 231, + "output_name": "BUSI_0231_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (231).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (231)_mask.png", + "available_masks": [ + "benign (231)_mask.png" + ], + "image_size": [ + 561, + 472 + ], + "mask_size": [ + 561, + 472 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 232, + "output_name": "BUSI_0232_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (232).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (232)_mask.png", + "available_masks": [ + "benign (232)_mask.png" + ], + "image_size": [ + 562, + 469 + ], + "mask_size": [ + 562, + 469 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 233, + "output_name": "BUSI_0233_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (233).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (233)_mask.png", + "available_masks": [ + "benign (233)_mask.png" + ], + "image_size": [ + 557, + 471 + ], + "mask_size": [ + 557, + 471 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 234, + "output_name": "BUSI_0234_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (234).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (234)_mask.png", + "available_masks": [ + "benign (234)_mask.png" + ], + "image_size": [ + 562, + 469 + ], + "mask_size": [ + 562, + 469 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 235, + "output_name": "BUSI_0235_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (235).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (235)_mask.png", + "available_masks": [ + "benign (235)_mask.png" + ], + "image_size": [ + 560, + 468 + ], + "mask_size": [ + 560, + 468 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 236, + "output_name": "BUSI_0236_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (236).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (236)_mask.png", + "available_masks": [ + "benign (236)_mask.png" + ], + "image_size": [ + 566, + 469 + ], + "mask_size": [ + 566, + 469 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 237, + "output_name": "BUSI_0237_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (237).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (237)_mask.png", + "available_masks": [ + "benign (237)_mask.png" + ], + "image_size": [ + 558, + 473 + ], + "mask_size": [ + 558, + 473 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 238, + "output_name": "BUSI_0238_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (238).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (238)_mask.png", + "available_masks": [ + "benign (238)_mask.png" + ], + "image_size": [ + 556, + 469 + ], + "mask_size": [ + 556, + 469 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 239, + "output_name": "BUSI_0239_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (239).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (239)_mask.png", + "available_masks": [ + "benign (239)_mask.png" + ], + "image_size": [ + 560, + 473 + ], + "mask_size": [ + 560, + 473 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 240, + "output_name": "BUSI_0240_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (240).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (240)_mask.png", + "available_masks": [ + "benign (240)_mask.png" + ], + "image_size": [ + 556, + 473 + ], + "mask_size": [ + 556, + 473 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 241, + "output_name": "BUSI_0241_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (241).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (241)_mask.png", + "available_masks": [ + "benign (241)_mask.png" + ], + "image_size": [ + 562, + 471 + ], + "mask_size": [ + 562, + 471 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 242, + "output_name": "BUSI_0242_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (242).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (242)_mask.png", + "available_masks": [ + "benign (242)_mask.png" + ], + "image_size": [ + 556, + 474 + ], + "mask_size": [ + 556, + 474 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 243, + "output_name": "BUSI_0243_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (243).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (243)_mask.png", + "available_masks": [ + "benign (243)_mask.png" + ], + "image_size": [ + 561, + 473 + ], + "mask_size": [ + 561, + 473 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 244, + "output_name": "BUSI_0244_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (244).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (244)_mask.png", + "available_masks": [ + "benign (244)_mask.png" + ], + "image_size": [ + 561, + 475 + ], + "mask_size": [ + 561, + 475 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 245, + "output_name": "BUSI_0245_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (245).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (245)_mask.png", + "available_masks": [ + "benign (245)_mask.png" + ], + "image_size": [ + 560, + 465 + ], + "mask_size": [ + 560, + 465 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 246, + "output_name": "BUSI_0246_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (246).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (246)_mask.png", + "available_masks": [ + "benign (246)_mask.png" + ], + "image_size": [ + 526, + 331 + ], + "mask_size": [ + 526, + 331 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 247, + "output_name": "BUSI_0247_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (247).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (247)_mask.png", + "available_masks": [ + "benign (247)_mask.png" + ], + "image_size": [ + 469, + 396 + ], + "mask_size": [ + 469, + 396 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 248, + "output_name": "BUSI_0248_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (248).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (248)_mask.png", + "available_masks": [ + "benign (248)_mask.png" + ], + "image_size": [ + 472, + 385 + ], + "mask_size": [ + 472, + 385 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 249, + "output_name": "BUSI_0249_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (249).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (249)_mask.png", + "available_masks": [ + "benign (249)_mask.png" + ], + "image_size": [ + 465, + 395 + ], + "mask_size": [ + 465, + 395 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 250, + "output_name": "BUSI_0250_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (250).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (250)_mask.png", + "available_masks": [ + "benign (250)_mask.png" + ], + "image_size": [ + 469, + 394 + ], + "mask_size": [ + 469, + 394 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 251, + "output_name": "BUSI_0251_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (251).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (251)_mask.png", + "available_masks": [ + "benign (251)_mask.png" + ], + "image_size": [ + 467, + 387 + ], + "mask_size": [ + 467, + 387 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 252, + "output_name": "BUSI_0252_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (252).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (252)_mask.png", + "available_masks": [ + "benign (252)_mask.png" + ], + "image_size": [ + 473, + 398 + ], + "mask_size": [ + 473, + 398 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 253, + "output_name": "BUSI_0253_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (253).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (253)_mask.png", + "available_masks": [ + "benign (253)_mask.png" + ], + "image_size": [ + 463, + 383 + ], + "mask_size": [ + 463, + 383 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 254, + "output_name": "BUSI_0254_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (254).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (254)_mask.png", + "available_masks": [ + "benign (254)_mask.png" + ], + "image_size": [ + 473, + 389 + ], + "mask_size": [ + 473, + 389 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 255, + "output_name": "BUSI_0255_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (255).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (255)_mask.png", + "available_masks": [ + "benign (255)_mask.png" + ], + "image_size": [ + 473, + 389 + ], + "mask_size": [ + 473, + 389 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 256, + "output_name": "BUSI_0256_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (256).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (256)_mask.png", + "available_masks": [ + "benign (256)_mask.png" + ], + "image_size": [ + 469, + 395 + ], + "mask_size": [ + 469, + 395 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 257, + "output_name": "BUSI_0257_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (257).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (257)_mask.png", + "available_masks": [ + "benign (257)_mask.png" + ], + "image_size": [ + 467, + 392 + ], + "mask_size": [ + 467, + 392 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 258, + "output_name": "BUSI_0258_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (258).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (258)_mask.png", + "available_masks": [ + "benign (258)_mask.png" + ], + "image_size": [ + 462, + 389 + ], + "mask_size": [ + 462, + 389 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 259, + "output_name": "BUSI_0259_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (259).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (259)_mask.png", + "available_masks": [ + "benign (259)_mask.png" + ], + "image_size": [ + 465, + 390 + ], + "mask_size": [ + 465, + 390 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 260, + "output_name": "BUSI_0260_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (260).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (260)_mask.png", + "available_masks": [ + "benign (260)_mask.png" + ], + "image_size": [ + 498, + 331 + ], + "mask_size": [ + 498, + 331 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 261, + "output_name": "BUSI_0261_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (261).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (261)_mask.png", + "available_masks": [ + "benign (261)_mask.png" + ], + "image_size": [ + 469, + 386 + ], + "mask_size": [ + 469, + 386 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 262, + "output_name": "BUSI_0262_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (262).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (262)_mask.png", + "available_masks": [ + "benign (262)_mask.png" + ], + "image_size": [ + 471, + 401 + ], + "mask_size": [ + 471, + 401 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 263, + "output_name": "BUSI_0263_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (263).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (263)_mask.png", + "available_masks": [ + "benign (263)_mask.png" + ], + "image_size": [ + 465, + 390 + ], + "mask_size": [ + 465, + 390 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 264, + "output_name": "BUSI_0264_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (264).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (264)_mask.png", + "available_masks": [ + "benign (264)_mask.png" + ], + "image_size": [ + 462, + 391 + ], + "mask_size": [ + 462, + 391 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 265, + "output_name": "BUSI_0265_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (265).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (265)_mask.png", + "available_masks": [ + "benign (265)_mask.png" + ], + "image_size": [ + 544, + 328 + ], + "mask_size": [ + 544, + 328 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 266, + "output_name": "BUSI_0266_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (266).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (266)_mask.png", + "available_masks": [ + "benign (266)_mask.png" + ], + "image_size": [ + 462, + 389 + ], + "mask_size": [ + 462, + 389 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 267, + "output_name": "BUSI_0267_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (267).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (267)_mask.png", + "available_masks": [ + "benign (267)_mask.png" + ], + "image_size": [ + 500, + 327 + ], + "mask_size": [ + 500, + 327 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 268, + "output_name": "BUSI_0268_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (268).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (268)_mask.png", + "available_masks": [ + "benign (268)_mask.png" + ], + "image_size": [ + 506, + 330 + ], + "mask_size": [ + 506, + 330 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 269, + "output_name": "BUSI_0269_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (269).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (269)_mask.png", + "available_masks": [ + "benign (269)_mask.png" + ], + "image_size": [ + 465, + 390 + ], + "mask_size": [ + 465, + 390 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 270, + "output_name": "BUSI_0270_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (270).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (270)_mask.png", + "available_masks": [ + "benign (270)_mask.png" + ], + "image_size": [ + 500, + 328 + ], + "mask_size": [ + 500, + 328 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 271, + "output_name": "BUSI_0271_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (271).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (271)_mask.png", + "available_masks": [ + "benign (271)_mask.png" + ], + "image_size": [ + 510, + 324 + ], + "mask_size": [ + 510, + 324 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 272, + "output_name": "BUSI_0272_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (272).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (272)_mask.png", + "available_masks": [ + "benign (272)_mask.png" + ], + "image_size": [ + 498, + 326 + ], + "mask_size": [ + 498, + 326 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 273, + "output_name": "BUSI_0273_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (273).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (273)_mask.png", + "available_masks": [ + "benign (273)_mask.png" + ], + "image_size": [ + 560, + 469 + ], + "mask_size": [ + 560, + 469 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 274, + "output_name": "BUSI_0274_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (274).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (274)_mask.png", + "available_masks": [ + "benign (274)_mask.png" + ], + "image_size": [ + 556, + 471 + ], + "mask_size": [ + 556, + 471 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 275, + "output_name": "BUSI_0275_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (275).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (275)_mask.png", + "available_masks": [ + "benign (275)_mask.png" + ], + "image_size": [ + 556, + 463 + ], + "mask_size": [ + 556, + 463 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 276, + "output_name": "BUSI_0276_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (276).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (276)_mask.png", + "available_masks": [ + "benign (276)_mask.png" + ], + "image_size": [ + 550, + 474 + ], + "mask_size": [ + 550, + 474 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 277, + "output_name": "BUSI_0277_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (277).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (277)_mask.png", + "available_masks": [ + "benign (277)_mask.png" + ], + "image_size": [ + 556, + 469 + ], + "mask_size": [ + 556, + 469 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 278, + "output_name": "BUSI_0278_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (278).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (278)_mask.png", + "available_masks": [ + "benign (278)_mask.png" + ], + "image_size": [ + 561, + 464 + ], + "mask_size": [ + 561, + 464 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 279, + "output_name": "BUSI_0279_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (279).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (279)_mask.png", + "available_masks": [ + "benign (279)_mask.png" + ], + "image_size": [ + 551, + 467 + ], + "mask_size": [ + 551, + 467 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 280, + "output_name": "BUSI_0280_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (280).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (280)_mask.png", + "available_masks": [ + "benign (280)_mask.png" + ], + "image_size": [ + 556, + 471 + ], + "mask_size": [ + 556, + 471 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 281, + "output_name": "BUSI_0281_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (281).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (281)_mask.png", + "available_masks": [ + "benign (281)_mask.png" + ], + "image_size": [ + 605, + 392 + ], + "mask_size": [ + 605, + 392 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 282, + "output_name": "BUSI_0282_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (282).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (282)_mask.png", + "available_masks": [ + "benign (282)_mask.png" + ], + "image_size": [ + 560, + 465 + ], + "mask_size": [ + 560, + 465 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 283, + "output_name": "BUSI_0283_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (283).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (283)_mask.png", + "available_masks": [ + "benign (283)_mask.png" + ], + "image_size": [ + 621, + 508 + ], + "mask_size": [ + 621, + 508 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 284, + "output_name": "BUSI_0284_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (284).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (284)_mask.png", + "available_masks": [ + "benign (284)_mask.png" + ], + "image_size": [ + 622, + 497 + ], + "mask_size": [ + 622, + 497 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 285, + "output_name": "BUSI_0285_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (285).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (285)_mask.png", + "available_masks": [ + "benign (285)_mask.png" + ], + "image_size": [ + 625, + 494 + ], + "mask_size": [ + 625, + 494 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 286, + "output_name": "BUSI_0286_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (286).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (286)_mask.png", + "available_masks": [ + "benign (286)_mask.png" + ], + "image_size": [ + 620, + 490 + ], + "mask_size": [ + 620, + 490 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 287, + "output_name": "BUSI_0287_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (287).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (287)_mask.png", + "available_masks": [ + "benign (287)_mask.png" + ], + "image_size": [ + 466, + 390 + ], + "mask_size": [ + 466, + 390 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 288, + "output_name": "BUSI_0288_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (288).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (288)_mask.png", + "available_masks": [ + "benign (288)_mask.png" + ], + "image_size": [ + 463, + 390 + ], + "mask_size": [ + 463, + 390 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 289, + "output_name": "BUSI_0289_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (289).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (289)_mask.png", + "available_masks": [ + "benign (289)_mask.png" + ], + "image_size": [ + 468, + 393 + ], + "mask_size": [ + 468, + 393 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 290, + "output_name": "BUSI_0290_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (290).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (290)_mask.png", + "available_masks": [ + "benign (290)_mask.png" + ], + "image_size": [ + 465, + 389 + ], + "mask_size": [ + 465, + 389 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 291, + "output_name": "BUSI_0291_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (291).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (291)_mask.png", + "available_masks": [ + "benign (291)_mask.png" + ], + "image_size": [ + 462, + 404 + ], + "mask_size": [ + 462, + 404 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 292, + "output_name": "BUSI_0292_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (292).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (292)_mask.png", + "available_masks": [ + "benign (292)_mask.png" + ], + "image_size": [ + 460, + 391 + ], + "mask_size": [ + 460, + 391 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 293, + "output_name": "BUSI_0293_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (293).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (293)_mask.png", + "available_masks": [ + "benign (293)_mask.png" + ], + "image_size": [ + 473, + 389 + ], + "mask_size": [ + 473, + 389 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 294, + "output_name": "BUSI_0294_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (294).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (294)_mask.png", + "available_masks": [ + "benign (294)_mask.png" + ], + "image_size": [ + 469, + 394 + ], + "mask_size": [ + 469, + 394 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 295, + "output_name": "BUSI_0295_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (295).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (295)_mask.png", + "available_masks": [ + "benign (295)_mask.png" + ], + "image_size": [ + 472, + 387 + ], + "mask_size": [ + 472, + 387 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 296, + "output_name": "BUSI_0296_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (296).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (296)_mask.png", + "available_masks": [ + "benign (296)_mask.png" + ], + "image_size": [ + 503, + 328 + ], + "mask_size": [ + 503, + 328 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 297, + "output_name": "BUSI_0297_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (297).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (297)_mask.png", + "available_masks": [ + "benign (297)_mask.png" + ], + "image_size": [ + 467, + 390 + ], + "mask_size": [ + 467, + 390 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 298, + "output_name": "BUSI_0298_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (298).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (298)_mask.png", + "available_masks": [ + "benign (298)_mask.png" + ], + "image_size": [ + 466, + 391 + ], + "mask_size": [ + 466, + 391 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 299, + "output_name": "BUSI_0299_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (299).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (299)_mask.png", + "available_masks": [ + "benign (299)_mask.png" + ], + "image_size": [ + 463, + 392 + ], + "mask_size": [ + 463, + 392 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 300, + "output_name": "BUSI_0300_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (300).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (300)_mask.png", + "available_masks": [ + "benign (300)_mask.png" + ], + "image_size": [ + 463, + 387 + ], + "mask_size": [ + 463, + 387 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 301, + "output_name": "BUSI_0301_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (301).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (301)_mask.png", + "available_masks": [ + "benign (301)_mask.png" + ], + "image_size": [ + 463, + 383 + ], + "mask_size": [ + 463, + 383 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 302, + "output_name": "BUSI_0302_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (302).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (302)_mask.png", + "available_masks": [ + "benign (302)_mask.png" + ], + "image_size": [ + 466, + 390 + ], + "mask_size": [ + 466, + 390 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 303, + "output_name": "BUSI_0303_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (303).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (303)_mask.png", + "available_masks": [ + "benign (303)_mask.png" + ], + "image_size": [ + 463, + 398 + ], + "mask_size": [ + 463, + 398 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 304, + "output_name": "BUSI_0304_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (304).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (304)_mask.png", + "available_masks": [ + "benign (304)_mask.png" + ], + "image_size": [ + 467, + 387 + ], + "mask_size": [ + 467, + 387 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 305, + "output_name": "BUSI_0305_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (305).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (305)_mask.png", + "available_masks": [ + "benign (305)_mask.png" + ], + "image_size": [ + 466, + 389 + ], + "mask_size": [ + 466, + 389 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 306, + "output_name": "BUSI_0306_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (306).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (306)_mask.png", + "available_masks": [ + "benign (306)_mask.png" + ], + "image_size": [ + 471, + 386 + ], + "mask_size": [ + 471, + 386 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 307, + "output_name": "BUSI_0307_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (307).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (307)_mask.png", + "available_masks": [ + "benign (307)_mask.png" + ], + "image_size": [ + 775, + 587 + ], + "mask_size": [ + 775, + 587 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 308, + "output_name": "BUSI_0308_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (308).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (308)_mask.png", + "available_masks": [ + "benign (308)_mask.png" + ], + "image_size": [ + 552, + 468 + ], + "mask_size": [ + 552, + 468 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 309, + "output_name": "BUSI_0309_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (309).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (309)_mask.png", + "available_masks": [ + "benign (309)_mask.png" + ], + "image_size": [ + 769, + 487 + ], + "mask_size": [ + 769, + 487 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 310, + "output_name": "BUSI_0310_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (310).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (310)_mask.png", + "available_masks": [ + "benign (310)_mask.png" + ], + "image_size": [ + 544, + 468 + ], + "mask_size": [ + 544, + 468 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 311, + "output_name": "BUSI_0311_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (311).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (311)_mask.png", + "available_masks": [ + "benign (311)_mask.png" + ], + "image_size": [ + 549, + 496 + ], + "mask_size": [ + 549, + 496 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 312, + "output_name": "BUSI_0312_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (312).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (312)_mask.png", + "available_masks": [ + "benign (312)_mask.png" + ], + "image_size": [ + 552, + 490 + ], + "mask_size": [ + 552, + 490 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 313, + "output_name": "BUSI_0313_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (313).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (313)_mask.png", + "available_masks": [ + "benign (313)_mask.png" + ], + "image_size": [ + 555, + 468 + ], + "mask_size": [ + 555, + 468 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 314, + "output_name": "BUSI_0314_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (314).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (314)_mask.png", + "available_masks": [ + "benign (314)_mask.png" + ], + "image_size": [ + 554, + 493 + ], + "mask_size": [ + 554, + 493 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 315, + "output_name": "BUSI_0315_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (315).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (315)_mask_1.png", + "available_masks": [ + "benign (315)_mask.png", + "benign (315)_mask_1.png" + ], + "image_size": [ + 551, + 470 + ], + "mask_size": [ + 551, + 470 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 316, + "output_name": "BUSI_0316_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (316).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (316)_mask.png", + "available_masks": [ + "benign (316)_mask.png" + ], + "image_size": [ + 550, + 469 + ], + "mask_size": [ + 550, + 469 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 317, + "output_name": "BUSI_0317_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (317).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (317)_mask.png", + "available_masks": [ + "benign (317)_mask.png" + ], + "image_size": [ + 551, + 491 + ], + "mask_size": [ + 551, + 491 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 318, + "output_name": "BUSI_0318_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (318).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (318)_mask.png", + "available_masks": [ + "benign (318)_mask.png" + ], + "image_size": [ + 554, + 465 + ], + "mask_size": [ + 554, + 465 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 319, + "output_name": "BUSI_0319_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (319).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (319)_mask.png", + "available_masks": [ + "benign (319)_mask.png" + ], + "image_size": [ + 560, + 467 + ], + "mask_size": [ + 560, + 467 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 320, + "output_name": "BUSI_0320_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (320).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (320)_mask.png", + "available_masks": [ + "benign (320)_mask.png" + ], + "image_size": [ + 558, + 475 + ], + "mask_size": [ + 558, + 475 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 321, + "output_name": "BUSI_0321_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (321).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (321)_mask.png", + "available_masks": [ + "benign (321)_mask.png" + ], + "image_size": [ + 546, + 467 + ], + "mask_size": [ + 546, + 467 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 322, + "output_name": "BUSI_0322_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (322).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (322)_mask.png", + "available_masks": [ + "benign (322)_mask.png" + ], + "image_size": [ + 555, + 491 + ], + "mask_size": [ + 555, + 491 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 323, + "output_name": "BUSI_0323_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (323).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (323)_mask.png", + "available_masks": [ + "benign (323)_mask.png" + ], + "image_size": [ + 560, + 468 + ], + "mask_size": [ + 560, + 468 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 324, + "output_name": "BUSI_0324_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (324).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (324)_mask.png", + "available_masks": [ + "benign (324)_mask.png" + ], + "image_size": [ + 626, + 583 + ], + "mask_size": [ + 626, + 583 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 325, + "output_name": "BUSI_0325_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (325).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (325)_mask.png", + "available_masks": [ + "benign (325)_mask.png" + ], + "image_size": [ + 613, + 583 + ], + "mask_size": [ + 613, + 583 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 326, + "output_name": "BUSI_0326_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (326).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (326)_mask.png", + "available_masks": [ + "benign (326)_mask.png" + ], + "image_size": [ + 754, + 619 + ], + "mask_size": [ + 754, + 619 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 327, + "output_name": "BUSI_0327_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (327).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (327)_mask.png", + "available_masks": [ + "benign (327)_mask.png" + ], + "image_size": [ + 689, + 578 + ], + "mask_size": [ + 689, + 578 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 328, + "output_name": "BUSI_0328_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (328).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (328)_mask.png", + "available_masks": [ + "benign (328)_mask.png" + ], + "image_size": [ + 685, + 567 + ], + "mask_size": [ + 685, + 567 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 329, + "output_name": "BUSI_0329_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (329).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (329)_mask.png", + "available_masks": [ + "benign (329)_mask.png" + ], + "image_size": [ + 665, + 576 + ], + "mask_size": [ + 665, + 576 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 330, + "output_name": "BUSI_0330_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (330).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (330)_mask.png", + "available_masks": [ + "benign (330)_mask.png" + ], + "image_size": [ + 669, + 567 + ], + "mask_size": [ + 669, + 567 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 331, + "output_name": "BUSI_0331_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (331).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (331)_mask.png", + "available_masks": [ + "benign (331)_mask.png" + ], + "image_size": [ + 695, + 527 + ], + "mask_size": [ + 695, + 527 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 332, + "output_name": "BUSI_0332_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (332).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (332)_mask.png", + "available_masks": [ + "benign (332)_mask.png" + ], + "image_size": [ + 703, + 531 + ], + "mask_size": [ + 703, + 531 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 333, + "output_name": "BUSI_0333_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (333).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (333)_mask.png", + "available_masks": [ + "benign (333)_mask.png" + ], + "image_size": [ + 777, + 569 + ], + "mask_size": [ + 777, + 569 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 334, + "output_name": "BUSI_0334_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (334).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (334)_mask.png", + "available_masks": [ + "benign (334)_mask.png" + ], + "image_size": [ + 589, + 426 + ], + "mask_size": [ + 589, + 426 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 335, + "output_name": "BUSI_0335_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (335).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (335)_mask.png", + "available_masks": [ + "benign (335)_mask.png" + ], + "image_size": [ + 681, + 559 + ], + "mask_size": [ + 681, + 559 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 336, + "output_name": "BUSI_0336_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (336).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (336)_mask.png", + "available_masks": [ + "benign (336)_mask.png" + ], + "image_size": [ + 783, + 585 + ], + "mask_size": [ + 783, + 585 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 337, + "output_name": "BUSI_0337_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (337).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (337)_mask.png", + "available_masks": [ + "benign (337)_mask.png" + ], + "image_size": [ + 555, + 487 + ], + "mask_size": [ + 555, + 487 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 338, + "output_name": "BUSI_0338_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (338).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (338)_mask.png", + "available_masks": [ + "benign (338)_mask.png" + ], + "image_size": [ + 611, + 382 + ], + "mask_size": [ + 611, + 382 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 339, + "output_name": "BUSI_0339_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (339).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (339)_mask.png", + "available_masks": [ + "benign (339)_mask.png" + ], + "image_size": [ + 557, + 465 + ], + "mask_size": [ + 557, + 465 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 340, + "output_name": "BUSI_0340_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (340).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (340)_mask.png", + "available_masks": [ + "benign (340)_mask.png" + ], + "image_size": [ + 770, + 425 + ], + "mask_size": [ + 770, + 425 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 341, + "output_name": "BUSI_0341_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (341).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (341)_mask.png", + "available_masks": [ + "benign (341)_mask.png" + ], + "image_size": [ + 683, + 562 + ], + "mask_size": [ + 683, + 562 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 342, + "output_name": "BUSI_0342_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (342).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (342)_mask.png", + "available_masks": [ + "benign (342)_mask.png" + ], + "image_size": [ + 581, + 431 + ], + "mask_size": [ + 581, + 431 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 343, + "output_name": "BUSI_0343_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (343).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (343)_mask.png", + "available_masks": [ + "benign (343)_mask.png" + ], + "image_size": [ + 564, + 467 + ], + "mask_size": [ + 564, + 467 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 344, + "output_name": "BUSI_0344_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (344).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (344)_mask.png", + "available_masks": [ + "benign (344)_mask.png" + ], + "image_size": [ + 576, + 434 + ], + "mask_size": [ + 576, + 434 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 345, + "output_name": "BUSI_0345_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (345).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (345)_mask.png", + "available_masks": [ + "benign (345)_mask.png" + ], + "image_size": [ + 566, + 466 + ], + "mask_size": [ + 566, + 466 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 346, + "output_name": "BUSI_0346_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (346).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (346)_mask_1.png", + "available_masks": [ + "benign (346)_mask.png", + "benign (346)_mask_1.png" + ], + "image_size": [ + 610, + 373 + ], + "mask_size": [ + 610, + 373 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 347, + "output_name": "BUSI_0347_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (347).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (347)_mask.png", + "available_masks": [ + "benign (347)_mask.png" + ], + "image_size": [ + 605, + 683 + ], + "mask_size": [ + 605, + 683 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 348, + "output_name": "BUSI_0348_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (348).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (348)_mask.png", + "available_masks": [ + "benign (348)_mask.png" + ], + "image_size": [ + 1028, + 565 + ], + "mask_size": [ + 1028, + 565 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 349, + "output_name": "BUSI_0349_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (349).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (349)_mask.png", + "available_masks": [ + "benign (349)_mask.png" + ], + "image_size": [ + 555, + 471 + ], + "mask_size": [ + 555, + 471 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 350, + "output_name": "BUSI_0350_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (350).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (350)_mask.png", + "available_masks": [ + "benign (350)_mask.png" + ], + "image_size": [ + 786, + 580 + ], + "mask_size": [ + 786, + 580 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 351, + "output_name": "BUSI_0351_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (351).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (351)_mask.png", + "available_masks": [ + "benign (351)_mask.png" + ], + "image_size": [ + 585, + 429 + ], + "mask_size": [ + 585, + 429 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 352, + "output_name": "BUSI_0352_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (352).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (352)_mask.png", + "available_masks": [ + "benign (352)_mask.png" + ], + "image_size": [ + 573, + 428 + ], + "mask_size": [ + 573, + 428 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 353, + "output_name": "BUSI_0353_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (353).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (353)_mask.png", + "available_masks": [ + "benign (353)_mask.png" + ], + "image_size": [ + 680, + 583 + ], + "mask_size": [ + 680, + 583 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 354, + "output_name": "BUSI_0354_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (354).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (354)_mask.png", + "available_masks": [ + "benign (354)_mask.png" + ], + "image_size": [ + 606, + 605 + ], + "mask_size": [ + 606, + 605 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 355, + "output_name": "BUSI_0355_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (355).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (355)_mask.png", + "available_masks": [ + "benign (355)_mask.png" + ], + "image_size": [ + 675, + 562 + ], + "mask_size": [ + 675, + 562 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 356, + "output_name": "BUSI_0356_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (356).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (356)_mask.png", + "available_masks": [ + "benign (356)_mask.png" + ], + "image_size": [ + 556, + 468 + ], + "mask_size": [ + 556, + 468 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 357, + "output_name": "BUSI_0357_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (357).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (357)_mask.png", + "available_masks": [ + "benign (357)_mask.png" + ], + "image_size": [ + 581, + 429 + ], + "mask_size": [ + 581, + 429 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 358, + "output_name": "BUSI_0358_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (358).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (358)_mask.png", + "available_masks": [ + "benign (358)_mask.png" + ], + "image_size": [ + 555, + 467 + ], + "mask_size": [ + 555, + 467 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 359, + "output_name": "BUSI_0359_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (359).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (359)_mask.png", + "available_masks": [ + "benign (359)_mask.png" + ], + "image_size": [ + 567, + 462 + ], + "mask_size": [ + 567, + 462 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 360, + "output_name": "BUSI_0360_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (360).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (360)_mask.png", + "available_masks": [ + "benign (360)_mask.png" + ], + "image_size": [ + 683, + 574 + ], + "mask_size": [ + 683, + 574 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 361, + "output_name": "BUSI_0361_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (361).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (361)_mask.png", + "available_masks": [ + "benign (361)_mask.png" + ], + "image_size": [ + 558, + 470 + ], + "mask_size": [ + 558, + 470 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 362, + "output_name": "BUSI_0362_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (362).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (362)_mask.png", + "available_masks": [ + "benign (362)_mask.png" + ], + "image_size": [ + 557, + 464 + ], + "mask_size": [ + 557, + 464 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 363, + "output_name": "BUSI_0363_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (363).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (363)_mask.png", + "available_masks": [ + "benign (363)_mask.png" + ], + "image_size": [ + 586, + 433 + ], + "mask_size": [ + 586, + 433 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 364, + "output_name": "BUSI_0364_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (364).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (364)_mask.png", + "available_masks": [ + "benign (364)_mask.png" + ], + "image_size": [ + 557, + 465 + ], + "mask_size": [ + 557, + 465 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 365, + "output_name": "BUSI_0365_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (365).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (365)_mask.png", + "available_masks": [ + "benign (365)_mask.png" + ], + "image_size": [ + 582, + 431 + ], + "mask_size": [ + 582, + 431 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 366, + "output_name": "BUSI_0366_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (366).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (366)_mask.png", + "available_masks": [ + "benign (366)_mask.png" + ], + "image_size": [ + 562, + 463 + ], + "mask_size": [ + 562, + 463 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 367, + "output_name": "BUSI_0367_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (367).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (367)_mask.png", + "available_masks": [ + "benign (367)_mask.png" + ], + "image_size": [ + 560, + 462 + ], + "mask_size": [ + 560, + 462 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 368, + "output_name": "BUSI_0368_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (368).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (368)_mask.png", + "available_masks": [ + "benign (368)_mask.png" + ], + "image_size": [ + 689, + 575 + ], + "mask_size": [ + 689, + 575 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 369, + "output_name": "BUSI_0369_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (369).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (369)_mask.png", + "available_masks": [ + "benign (369)_mask.png" + ], + "image_size": [ + 772, + 581 + ], + "mask_size": [ + 772, + 581 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 370, + "output_name": "BUSI_0370_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (370).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (370)_mask.png", + "available_masks": [ + "benign (370)_mask.png" + ], + "image_size": [ + 549, + 458 + ], + "mask_size": [ + 549, + 458 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 371, + "output_name": "BUSI_0371_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (371).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (371)_mask.png", + "available_masks": [ + "benign (371)_mask.png" + ], + "image_size": [ + 756, + 589 + ], + "mask_size": [ + 756, + 589 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 372, + "output_name": "BUSI_0372_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (372).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (372)_mask.png", + "available_masks": [ + "benign (372)_mask.png" + ], + "image_size": [ + 544, + 469 + ], + "mask_size": [ + 544, + 469 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 373, + "output_name": "BUSI_0373_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (373).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (373)_mask.png", + "available_masks": [ + "benign (373)_mask.png" + ], + "image_size": [ + 555, + 457 + ], + "mask_size": [ + 555, + 457 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 374, + "output_name": "BUSI_0374_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (374).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (374)_mask.png", + "available_masks": [ + "benign (374)_mask.png" + ], + "image_size": [ + 544, + 468 + ], + "mask_size": [ + 544, + 468 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 375, + "output_name": "BUSI_0375_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (375).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (375)_mask.png", + "available_masks": [ + "benign (375)_mask.png" + ], + "image_size": [ + 775, + 571 + ], + "mask_size": [ + 775, + 571 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 376, + "output_name": "BUSI_0376_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (376).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (376)_mask.png", + "available_masks": [ + "benign (376)_mask.png" + ], + "image_size": [ + 546, + 467 + ], + "mask_size": [ + 546, + 467 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 377, + "output_name": "BUSI_0377_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (377).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (377)_mask.png", + "available_masks": [ + "benign (377)_mask.png" + ], + "image_size": [ + 752, + 578 + ], + "mask_size": [ + 752, + 578 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 378, + "output_name": "BUSI_0378_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (378).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (378)_mask.png", + "available_masks": [ + "benign (378)_mask.png" + ], + "image_size": [ + 548, + 464 + ], + "mask_size": [ + 548, + 464 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 379, + "output_name": "BUSI_0379_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (379).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (379)_mask.png", + "available_masks": [ + "benign (379)_mask.png" + ], + "image_size": [ + 1010, + 583 + ], + "mask_size": [ + 1010, + 583 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 380, + "output_name": "BUSI_0380_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (380).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (380)_mask.png", + "available_masks": [ + "benign (380)_mask.png" + ], + "image_size": [ + 750, + 572 + ], + "mask_size": [ + 750, + 572 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 381, + "output_name": "BUSI_0381_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (381).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (381)_mask.png", + "available_masks": [ + "benign (381)_mask.png" + ], + "image_size": [ + 747, + 576 + ], + "mask_size": [ + 747, + 576 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 382, + "output_name": "BUSI_0382_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (382).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (382)_mask.png", + "available_masks": [ + "benign (382)_mask.png" + ], + "image_size": [ + 730, + 475 + ], + "mask_size": [ + 730, + 475 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 383, + "output_name": "BUSI_0383_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (383).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (383)_mask.png", + "available_masks": [ + "benign (383)_mask.png" + ], + "image_size": [ + 552, + 493 + ], + "mask_size": [ + 552, + 493 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 384, + "output_name": "BUSI_0384_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (384).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (384)_mask.png", + "available_masks": [ + "benign (384)_mask.png" + ], + "image_size": [ + 760, + 425 + ], + "mask_size": [ + 760, + 425 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 385, + "output_name": "BUSI_0385_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (385).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (385)_mask.png", + "available_masks": [ + "benign (385)_mask.png" + ], + "image_size": [ + 551, + 458 + ], + "mask_size": [ + 551, + 458 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 386, + "output_name": "BUSI_0386_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (386).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (386)_mask.png", + "available_masks": [ + "benign (386)_mask.png" + ], + "image_size": [ + 768, + 578 + ], + "mask_size": [ + 768, + 578 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 387, + "output_name": "BUSI_0387_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (387).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (387)_mask.png", + "available_masks": [ + "benign (387)_mask.png" + ], + "image_size": [ + 549, + 486 + ], + "mask_size": [ + 549, + 486 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 388, + "output_name": "BUSI_0388_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (388).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (388)_mask.png", + "available_masks": [ + "benign (388)_mask.png" + ], + "image_size": [ + 763, + 572 + ], + "mask_size": [ + 763, + 572 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 389, + "output_name": "BUSI_0389_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (389).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (389)_mask.png", + "available_masks": [ + "benign (389)_mask.png" + ], + "image_size": [ + 927, + 567 + ], + "mask_size": [ + 927, + 567 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 390, + "output_name": "BUSI_0390_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (390).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (390)_mask.png", + "available_masks": [ + "benign (390)_mask.png" + ], + "image_size": [ + 779, + 583 + ], + "mask_size": [ + 779, + 583 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 391, + "output_name": "BUSI_0391_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (391).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (391)_mask.png", + "available_masks": [ + "benign (391)_mask.png" + ], + "image_size": [ + 687, + 578 + ], + "mask_size": [ + 687, + 578 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 392, + "output_name": "BUSI_0392_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (392).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (392)_mask.png", + "available_masks": [ + "benign (392)_mask.png" + ], + "image_size": [ + 729, + 477 + ], + "mask_size": [ + 729, + 477 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 393, + "output_name": "BUSI_0393_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (393).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (393)_mask.png", + "available_masks": [ + "benign (393)_mask.png" + ], + "image_size": [ + 685, + 583 + ], + "mask_size": [ + 685, + 583 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 394, + "output_name": "BUSI_0394_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (394).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (394)_mask.png", + "available_masks": [ + "benign (394)_mask.png" + ], + "image_size": [ + 558, + 468 + ], + "mask_size": [ + 558, + 468 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 395, + "output_name": "BUSI_0395_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (395).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (395)_mask.png", + "available_masks": [ + "benign (395)_mask.png" + ], + "image_size": [ + 615, + 576 + ], + "mask_size": [ + 615, + 576 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 396, + "output_name": "BUSI_0396_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (396).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (396)_mask.png", + "available_masks": [ + "benign (396)_mask.png" + ], + "image_size": [ + 420, + 474 + ], + "mask_size": [ + 420, + 474 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 397, + "output_name": "BUSI_0397_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (397).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (397)_mask.png", + "available_masks": [ + "benign (397)_mask.png" + ], + "image_size": [ + 554, + 470 + ], + "mask_size": [ + 554, + 470 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 398, + "output_name": "BUSI_0398_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (398).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (398)_mask.png", + "available_masks": [ + "benign (398)_mask.png" + ], + "image_size": [ + 563, + 469 + ], + "mask_size": [ + 563, + 469 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 399, + "output_name": "BUSI_0399_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (399).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (399)_mask.png", + "available_masks": [ + "benign (399)_mask.png" + ], + "image_size": [ + 555, + 468 + ], + "mask_size": [ + 555, + 468 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 400, + "output_name": "BUSI_0400_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (400).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (400)_mask.png", + "available_masks": [ + "benign (400)_mask.png" + ], + "image_size": [ + 779, + 580 + ], + "mask_size": [ + 779, + 580 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 401, + "output_name": "BUSI_0401_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (401).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (401)_mask.png", + "available_masks": [ + "benign (401)_mask.png" + ], + "image_size": [ + 557, + 469 + ], + "mask_size": [ + 557, + 469 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 402, + "output_name": "BUSI_0402_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (402).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (402)_mask.png", + "available_masks": [ + "benign (402)_mask.png" + ], + "image_size": [ + 561, + 469 + ], + "mask_size": [ + 561, + 469 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 403, + "output_name": "BUSI_0403_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (403).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (403)_mask.png", + "available_masks": [ + "benign (403)_mask.png" + ], + "image_size": [ + 549, + 467 + ], + "mask_size": [ + 549, + 467 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 404, + "output_name": "BUSI_0404_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (404).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (404)_mask.png", + "available_masks": [ + "benign (404)_mask.png" + ], + "image_size": [ + 772, + 578 + ], + "mask_size": [ + 772, + 578 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 405, + "output_name": "BUSI_0405_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (405).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (405)_mask.png", + "available_masks": [ + "benign (405)_mask.png" + ], + "image_size": [ + 566, + 465 + ], + "mask_size": [ + 566, + 465 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 406, + "output_name": "BUSI_0406_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (406).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (406)_mask.png", + "available_masks": [ + "benign (406)_mask.png" + ], + "image_size": [ + 563, + 463 + ], + "mask_size": [ + 563, + 463 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 407, + "output_name": "BUSI_0407_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (407).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (407)_mask.png", + "available_masks": [ + "benign (407)_mask.png" + ], + "image_size": [ + 560, + 467 + ], + "mask_size": [ + 560, + 467 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 408, + "output_name": "BUSI_0408_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (408).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (408)_mask.png", + "available_masks": [ + "benign (408)_mask.png" + ], + "image_size": [ + 554, + 465 + ], + "mask_size": [ + 554, + 465 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 409, + "output_name": "BUSI_0409_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (409).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (409)_mask.png", + "available_masks": [ + "benign (409)_mask.png" + ], + "image_size": [ + 558, + 466 + ], + "mask_size": [ + 558, + 466 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 410, + "output_name": "BUSI_0410_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (410).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (410)_mask.png", + "available_masks": [ + "benign (410)_mask.png" + ], + "image_size": [ + 558, + 468 + ], + "mask_size": [ + 558, + 468 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 411, + "output_name": "BUSI_0411_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (411).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (411)_mask.png", + "available_masks": [ + "benign (411)_mask.png" + ], + "image_size": [ + 602, + 587 + ], + "mask_size": [ + 602, + 587 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 412, + "output_name": "BUSI_0412_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (412).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (412)_mask.png", + "available_masks": [ + "benign (412)_mask.png" + ], + "image_size": [ + 779, + 576 + ], + "mask_size": [ + 779, + 576 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 413, + "output_name": "BUSI_0413_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (413).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (413)_mask.png", + "available_masks": [ + "benign (413)_mask.png" + ], + "image_size": [ + 433, + 478 + ], + "mask_size": [ + 433, + 478 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 414, + "output_name": "BUSI_0414_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (414).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (414)_mask.png", + "available_masks": [ + "benign (414)_mask.png" + ], + "image_size": [ + 812, + 703 + ], + "mask_size": [ + 812, + 703 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 415, + "output_name": "BUSI_0415_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (415).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (415)_mask.png", + "available_masks": [ + "benign (415)_mask.png" + ], + "image_size": [ + 781, + 578 + ], + "mask_size": [ + 781, + 578 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 416, + "output_name": "BUSI_0416_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (416).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (416)_mask.png", + "available_masks": [ + "benign (416)_mask.png" + ], + "image_size": [ + 878, + 574 + ], + "mask_size": [ + 878, + 574 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 417, + "output_name": "BUSI_0417_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (417).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (417)_mask.png", + "available_masks": [ + "benign (417)_mask.png" + ], + "image_size": [ + 599, + 416 + ], + "mask_size": [ + 599, + 416 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 418, + "output_name": "BUSI_0418_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (418).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (418)_mask.png", + "available_masks": [ + "benign (418)_mask.png" + ], + "image_size": [ + 607, + 414 + ], + "mask_size": [ + 607, + 414 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 419, + "output_name": "BUSI_0419_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (419).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (419)_mask.png", + "available_masks": [ + "benign (419)_mask.png" + ], + "image_size": [ + 772, + 574 + ], + "mask_size": [ + 772, + 574 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 420, + "output_name": "BUSI_0420_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (420).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (420)_mask.png", + "available_masks": [ + "benign (420)_mask.png" + ], + "image_size": [ + 768, + 574 + ], + "mask_size": [ + 768, + 574 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 421, + "output_name": "BUSI_0421_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (421).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (421)_mask.png", + "available_masks": [ + "benign (421)_mask.png" + ], + "image_size": [ + 551, + 487 + ], + "mask_size": [ + 551, + 487 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 422, + "output_name": "BUSI_0422_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (422).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (422)_mask.png", + "available_masks": [ + "benign (422)_mask.png" + ], + "image_size": [ + 768, + 487 + ], + "mask_size": [ + 768, + 487 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 423, + "output_name": "BUSI_0423_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (423).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (423)_mask.png", + "available_masks": [ + "benign (423)_mask.png" + ], + "image_size": [ + 561, + 470 + ], + "mask_size": [ + 561, + 470 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 424, + "output_name": "BUSI_0424_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (424).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (424)_mask_1.png", + "available_masks": [ + "benign (424)_mask.png", + "benign (424)_mask_1.png" + ], + "image_size": [ + 544, + 469 + ], + "mask_size": [ + 544, + 469 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 425, + "output_name": "BUSI_0425_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (425).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (425)_mask.png", + "available_masks": [ + "benign (425)_mask.png" + ], + "image_size": [ + 544, + 469 + ], + "mask_size": [ + 544, + 469 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 426, + "output_name": "BUSI_0426_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (426).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (426)_mask.png", + "available_masks": [ + "benign (426)_mask.png" + ], + "image_size": [ + 549, + 465 + ], + "mask_size": [ + 549, + 465 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 427, + "output_name": "BUSI_0427_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (427).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (427)_mask.png", + "available_masks": [ + "benign (427)_mask.png" + ], + "image_size": [ + 780, + 380 + ], + "mask_size": [ + 780, + 380 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 428, + "output_name": "BUSI_0428_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (428).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (428)_mask.png", + "available_masks": [ + "benign (428)_mask.png" + ], + "image_size": [ + 769, + 382 + ], + "mask_size": [ + 769, + 382 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 429, + "output_name": "BUSI_0429_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (429).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (429)_mask.png", + "available_masks": [ + "benign (429)_mask.png" + ], + "image_size": [ + 582, + 437 + ], + "mask_size": [ + 582, + 437 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 430, + "output_name": "BUSI_0430_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (430).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (430)_mask.png", + "available_masks": [ + "benign (430)_mask.png" + ], + "image_size": [ + 768, + 581 + ], + "mask_size": [ + 768, + 581 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 431, + "output_name": "BUSI_0431_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (431).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (431)_mask.png", + "available_masks": [ + "benign (431)_mask.png" + ], + "image_size": [ + 582, + 431 + ], + "mask_size": [ + 582, + 431 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 432, + "output_name": "BUSI_0432_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (432).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (432)_mask.png", + "available_masks": [ + "benign (432)_mask.png" + ], + "image_size": [ + 469, + 394 + ], + "mask_size": [ + 469, + 394 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 433, + "output_name": "BUSI_0433_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (433).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (433)_mask.png", + "available_masks": [ + "benign (433)_mask.png" + ], + "image_size": [ + 550, + 462 + ], + "mask_size": [ + 550, + 462 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 434, + "output_name": "BUSI_0434_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (434).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (434)_mask.png", + "available_masks": [ + "benign (434)_mask.png" + ], + "image_size": [ + 501, + 609 + ], + "mask_size": [ + 501, + 609 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 435, + "output_name": "BUSI_0435_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (435).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (435)_mask.png", + "available_masks": [ + "benign (435)_mask.png" + ], + "image_size": [ + 552, + 469 + ], + "mask_size": [ + 552, + 469 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 436, + "output_name": "BUSI_0436_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (436).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (436)_mask.png", + "available_masks": [ + "benign (436)_mask.png" + ], + "image_size": [ + 502, + 474 + ], + "mask_size": [ + 502, + 474 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "benign", + "class_code": "B", + "image_id": 437, + "output_name": "BUSI_0437_B.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (437).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/benign/benign (437)_mask.png", + "available_masks": [ + "benign (437)_mask.png" + ], + "image_size": [ + 768, + 585 + ], + "mask_size": [ + 768, + 585 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 1, + "output_name": "BUSI_0001_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (1).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (1)_mask.png", + "available_masks": [ + "malignant (1)_mask.png" + ], + "image_size": [ + 449, + 598 + ], + "mask_size": [ + 449, + 598 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 2, + "output_name": "BUSI_0002_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (2).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (2)_mask.png", + "available_masks": [ + "malignant (2)_mask.png" + ], + "image_size": [ + 548, + 495 + ], + "mask_size": [ + 548, + 495 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 3, + "output_name": "BUSI_0003_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (3).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (3)_mask.png", + "available_masks": [ + "malignant (3)_mask.png" + ], + "image_size": [ + 425, + 475 + ], + "mask_size": [ + 425, + 475 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 4, + "output_name": "BUSI_0004_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (4).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (4)_mask.png", + "available_masks": [ + "malignant (4)_mask.png" + ], + "image_size": [ + 432, + 473 + ], + "mask_size": [ + 432, + 473 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 5, + "output_name": "BUSI_0005_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (5).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (5)_mask.png", + "available_masks": [ + "malignant (5)_mask.png" + ], + "image_size": [ + 431, + 476 + ], + "mask_size": [ + 431, + 476 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 6, + "output_name": "BUSI_0006_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (6).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (6)_mask.png", + "available_masks": [ + "malignant (6)_mask.png" + ], + "image_size": [ + 432, + 478 + ], + "mask_size": [ + 432, + 478 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 7, + "output_name": "BUSI_0007_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (7).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (7)_mask.png", + "available_masks": [ + "malignant (7)_mask.png" + ], + "image_size": [ + 432, + 474 + ], + "mask_size": [ + 432, + 474 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 8, + "output_name": "BUSI_0008_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (8).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (8)_mask.png", + "available_masks": [ + "malignant (8)_mask.png" + ], + "image_size": [ + 426, + 473 + ], + "mask_size": [ + 426, + 473 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 9, + "output_name": "BUSI_0009_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (9).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (9)_mask.png", + "available_masks": [ + "malignant (9)_mask.png" + ], + "image_size": [ + 430, + 480 + ], + "mask_size": [ + 430, + 480 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 10, + "output_name": "BUSI_0010_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (10).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (10)_mask.png", + "available_masks": [ + "malignant (10)_mask.png" + ], + "image_size": [ + 462, + 393 + ], + "mask_size": [ + 462, + 393 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 11, + "output_name": "BUSI_0011_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (11).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (11)_mask.png", + "available_masks": [ + "malignant (11)_mask.png" + ], + "image_size": [ + 471, + 393 + ], + "mask_size": [ + 471, + 393 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 12, + "output_name": "BUSI_0012_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (12).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (12)_mask.png", + "available_masks": [ + "malignant (12)_mask.png" + ], + "image_size": [ + 479, + 392 + ], + "mask_size": [ + 479, + 392 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 13, + "output_name": "BUSI_0013_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (13).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (13)_mask.png", + "available_masks": [ + "malignant (13)_mask.png" + ], + "image_size": [ + 468, + 393 + ], + "mask_size": [ + 468, + 393 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 14, + "output_name": "BUSI_0014_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (14).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (14)_mask.png", + "available_masks": [ + "malignant (14)_mask.png" + ], + "image_size": [ + 273, + 398 + ], + "mask_size": [ + 273, + 398 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 15, + "output_name": "BUSI_0015_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (15).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (15)_mask.png", + "available_masks": [ + "malignant (15)_mask.png" + ], + "image_size": [ + 361, + 398 + ], + "mask_size": [ + 361, + 398 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 16, + "output_name": "BUSI_0016_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (16).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (16)_mask.png", + "available_masks": [ + "malignant (16)_mask.png" + ], + "image_size": [ + 511, + 472 + ], + "mask_size": [ + 511, + 472 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 17, + "output_name": "BUSI_0017_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (17).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (17)_mask.png", + "available_masks": [ + "malignant (17)_mask.png" + ], + "image_size": [ + 765, + 590 + ], + "mask_size": [ + 765, + 590 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 18, + "output_name": "BUSI_0018_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (18).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (18)_mask.png", + "available_masks": [ + "malignant (18)_mask.png" + ], + "image_size": [ + 579, + 437 + ], + "mask_size": [ + 579, + 437 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 19, + "output_name": "BUSI_0019_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (19).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (19)_mask.png", + "available_masks": [ + "malignant (19)_mask.png" + ], + "image_size": [ + 554, + 459 + ], + "mask_size": [ + 554, + 459 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 20, + "output_name": "BUSI_0020_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (20).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (20)_mask.png", + "available_masks": [ + "malignant (20)_mask.png" + ], + "image_size": [ + 558, + 475 + ], + "mask_size": [ + 558, + 475 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 21, + "output_name": "BUSI_0021_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (21).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (21)_mask.png", + "available_masks": [ + "malignant (21)_mask.png" + ], + "image_size": [ + 601, + 367 + ], + "mask_size": [ + 601, + 367 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 22, + "output_name": "BUSI_0022_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (22).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (22)_mask.png", + "available_masks": [ + "malignant (22)_mask.png" + ], + "image_size": [ + 570, + 474 + ], + "mask_size": [ + 570, + 474 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 23, + "output_name": "BUSI_0023_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (23).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (23)_mask.png", + "available_masks": [ + "malignant (23)_mask.png" + ], + "image_size": [ + 569, + 468 + ], + "mask_size": [ + 569, + 468 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 24, + "output_name": "BUSI_0024_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (24).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (24)_mask.png", + "available_masks": [ + "malignant (24)_mask.png" + ], + "image_size": [ + 564, + 462 + ], + "mask_size": [ + 564, + 462 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 25, + "output_name": "BUSI_0025_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (25).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (25)_mask.png", + "available_masks": [ + "malignant (25)_mask.png" + ], + "image_size": [ + 563, + 470 + ], + "mask_size": [ + 563, + 470 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 26, + "output_name": "BUSI_0026_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (26).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (26)_mask.png", + "available_masks": [ + "malignant (26)_mask.png" + ], + "image_size": [ + 564, + 469 + ], + "mask_size": [ + 564, + 469 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 27, + "output_name": "BUSI_0027_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (27).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (27)_mask.png", + "available_masks": [ + "malignant (27)_mask.png" + ], + "image_size": [ + 567, + 475 + ], + "mask_size": [ + 567, + 475 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 28, + "output_name": "BUSI_0028_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (28).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (28)_mask.png", + "available_masks": [ + "malignant (28)_mask.png" + ], + "image_size": [ + 562, + 470 + ], + "mask_size": [ + 562, + 470 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 29, + "output_name": "BUSI_0029_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (29).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (29)_mask.png", + "available_masks": [ + "malignant (29)_mask.png" + ], + "image_size": [ + 567, + 470 + ], + "mask_size": [ + 567, + 470 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 30, + "output_name": "BUSI_0030_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (30).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (30)_mask.png", + "available_masks": [ + "malignant (30)_mask.png" + ], + "image_size": [ + 573, + 468 + ], + "mask_size": [ + 573, + 468 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 31, + "output_name": "BUSI_0031_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (31).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (31)_mask.png", + "available_masks": [ + "malignant (31)_mask.png" + ], + "image_size": [ + 723, + 509 + ], + "mask_size": [ + 723, + 509 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 32, + "output_name": "BUSI_0032_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (32).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (32)_mask.png", + "available_masks": [ + "malignant (32)_mask.png" + ], + "image_size": [ + 557, + 492 + ], + "mask_size": [ + 557, + 492 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 33, + "output_name": "BUSI_0033_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (33).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (33)_mask.png", + "available_masks": [ + "malignant (33)_mask.png" + ], + "image_size": [ + 557, + 496 + ], + "mask_size": [ + 557, + 496 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 34, + "output_name": "BUSI_0034_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (34).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (34)_mask.png", + "available_masks": [ + "malignant (34)_mask.png" + ], + "image_size": [ + 620, + 589 + ], + "mask_size": [ + 620, + 589 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 35, + "output_name": "BUSI_0035_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (35).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (35)_mask.png", + "available_masks": [ + "malignant (35)_mask.png" + ], + "image_size": [ + 592, + 387 + ], + "mask_size": [ + 592, + 387 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 36, + "output_name": "BUSI_0036_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (36).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (36)_mask.png", + "available_masks": [ + "malignant (36)_mask.png" + ], + "image_size": [ + 623, + 494 + ], + "mask_size": [ + 623, + 494 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 37, + "output_name": "BUSI_0037_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (37).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (37)_mask.png", + "available_masks": [ + "malignant (37)_mask.png" + ], + "image_size": [ + 626, + 490 + ], + "mask_size": [ + 626, + 490 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 38, + "output_name": "BUSI_0038_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (38).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (38)_mask.png", + "available_masks": [ + "malignant (38)_mask.png" + ], + "image_size": [ + 1048, + 578 + ], + "mask_size": [ + 1048, + 578 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 39, + "output_name": "BUSI_0039_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (39).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (39)_mask.png", + "available_masks": [ + "malignant (39)_mask.png" + ], + "image_size": [ + 564, + 469 + ], + "mask_size": [ + 564, + 469 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 40, + "output_name": "BUSI_0040_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (40).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (40)_mask.png", + "available_masks": [ + "malignant (40)_mask.png" + ], + "image_size": [ + 548, + 461 + ], + "mask_size": [ + 548, + 461 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 41, + "output_name": "BUSI_0041_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (41).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (41)_mask.png", + "available_masks": [ + "malignant (41)_mask.png" + ], + "image_size": [ + 580, + 476 + ], + "mask_size": [ + 580, + 476 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 42, + "output_name": "BUSI_0042_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (42).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (42)_mask.png", + "available_masks": [ + "malignant (42)_mask.png" + ], + "image_size": [ + 578, + 439 + ], + "mask_size": [ + 578, + 439 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 43, + "output_name": "BUSI_0043_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (43).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (43)_mask.png", + "available_masks": [ + "malignant (43)_mask.png" + ], + "image_size": [ + 543, + 571 + ], + "mask_size": [ + 543, + 571 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 44, + "output_name": "BUSI_0044_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (44).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (44)_mask.png", + "available_masks": [ + "malignant (44)_mask.png" + ], + "image_size": [ + 765, + 580 + ], + "mask_size": [ + 765, + 580 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 45, + "output_name": "BUSI_0045_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (45).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (45)_mask.png", + "available_masks": [ + "malignant (45)_mask.png" + ], + "image_size": [ + 781, + 592 + ], + "mask_size": [ + 781, + 592 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 46, + "output_name": "BUSI_0046_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (46).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (46)_mask.png", + "available_masks": [ + "malignant (46)_mask.png" + ], + "image_size": [ + 785, + 571 + ], + "mask_size": [ + 785, + 571 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 47, + "output_name": "BUSI_0047_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (47).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (47)_mask.png", + "available_masks": [ + "malignant (47)_mask.png" + ], + "image_size": [ + 562, + 471 + ], + "mask_size": [ + 562, + 471 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 48, + "output_name": "BUSI_0048_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (48).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (48)_mask.png", + "available_masks": [ + "malignant (48)_mask.png" + ], + "image_size": [ + 552, + 493 + ], + "mask_size": [ + 552, + 493 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 49, + "output_name": "BUSI_0049_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (49).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (49)_mask.png", + "available_masks": [ + "malignant (49)_mask.png" + ], + "image_size": [ + 622, + 491 + ], + "mask_size": [ + 622, + 491 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 50, + "output_name": "BUSI_0050_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (50).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (50)_mask.png", + "available_masks": [ + "malignant (50)_mask.png" + ], + "image_size": [ + 567, + 469 + ], + "mask_size": [ + 567, + 469 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 51, + "output_name": "BUSI_0051_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (51).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (51)_mask.png", + "available_masks": [ + "malignant (51)_mask.png" + ], + "image_size": [ + 588, + 437 + ], + "mask_size": [ + 588, + 437 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 52, + "output_name": "BUSI_0052_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (52).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (52)_mask.png", + "available_masks": [ + "malignant (52)_mask.png" + ], + "image_size": [ + 552, + 462 + ], + "mask_size": [ + 552, + 462 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 53, + "output_name": "BUSI_0053_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (53).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (53)_mask_1.png", + "available_masks": [ + "malignant (53)_mask.png", + "malignant (53)_mask_1.png" + ], + "image_size": [ + 569, + 471 + ], + "mask_size": [ + 569, + 471 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 54, + "output_name": "BUSI_0054_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (54).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (54)_mask.png", + "available_masks": [ + "malignant (54)_mask.png" + ], + "image_size": [ + 777, + 580 + ], + "mask_size": [ + 777, + 580 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 55, + "output_name": "BUSI_0055_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (55).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (55)_mask.png", + "available_masks": [ + "malignant (55)_mask.png" + ], + "image_size": [ + 786, + 556 + ], + "mask_size": [ + 786, + 556 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 56, + "output_name": "BUSI_0056_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (56).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (56)_mask.png", + "available_masks": [ + "malignant (56)_mask.png" + ], + "image_size": [ + 690, + 538 + ], + "mask_size": [ + 690, + 538 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 57, + "output_name": "BUSI_0057_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (57).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (57)_mask.png", + "available_masks": [ + "malignant (57)_mask.png" + ], + "image_size": [ + 717, + 533 + ], + "mask_size": [ + 717, + 533 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 58, + "output_name": "BUSI_0058_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (58).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (58)_mask.png", + "available_masks": [ + "malignant (58)_mask.png" + ], + "image_size": [ + 688, + 558 + ], + "mask_size": [ + 688, + 558 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 59, + "output_name": "BUSI_0059_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (59).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (59)_mask.png", + "available_masks": [ + "malignant (59)_mask.png" + ], + "image_size": [ + 682, + 561 + ], + "mask_size": [ + 682, + 561 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 60, + "output_name": "BUSI_0060_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (60).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (60)_mask.png", + "available_masks": [ + "malignant (60)_mask.png" + ], + "image_size": [ + 681, + 559 + ], + "mask_size": [ + 681, + 559 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 61, + "output_name": "BUSI_0061_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (61).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (61)_mask.png", + "available_masks": [ + "malignant (61)_mask.png" + ], + "image_size": [ + 566, + 462 + ], + "mask_size": [ + 566, + 462 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 62, + "output_name": "BUSI_0062_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (62).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (62)_mask.png", + "available_masks": [ + "malignant (62)_mask.png" + ], + "image_size": [ + 693, + 565 + ], + "mask_size": [ + 693, + 565 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 63, + "output_name": "BUSI_0063_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (63).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (63)_mask.png", + "available_masks": [ + "malignant (63)_mask.png" + ], + "image_size": [ + 795, + 572 + ], + "mask_size": [ + 795, + 572 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 64, + "output_name": "BUSI_0064_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (64).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (64)_mask.png", + "available_masks": [ + "malignant (64)_mask.png" + ], + "image_size": [ + 772, + 479 + ], + "mask_size": [ + 772, + 479 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 65, + "output_name": "BUSI_0065_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (65).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (65)_mask.png", + "available_masks": [ + "malignant (65)_mask.png" + ], + "image_size": [ + 922, + 584 + ], + "mask_size": [ + 922, + 584 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 66, + "output_name": "BUSI_0066_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (66).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (66)_mask.png", + "available_masks": [ + "malignant (66)_mask.png" + ], + "image_size": [ + 655, + 584 + ], + "mask_size": [ + 655, + 584 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 67, + "output_name": "BUSI_0067_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (67).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (67)_mask.png", + "available_masks": [ + "malignant (67)_mask.png" + ], + "image_size": [ + 946, + 604 + ], + "mask_size": [ + 946, + 604 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 68, + "output_name": "BUSI_0068_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (68).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (68)_mask.png", + "available_masks": [ + "malignant (68)_mask.png" + ], + "image_size": [ + 574, + 464 + ], + "mask_size": [ + 574, + 464 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 69, + "output_name": "BUSI_0069_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (69).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (69)_mask.png", + "available_masks": [ + "malignant (69)_mask.png" + ], + "image_size": [ + 646, + 461 + ], + "mask_size": [ + 646, + 461 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 70, + "output_name": "BUSI_0070_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (70).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (70)_mask.png", + "available_masks": [ + "malignant (70)_mask.png" + ], + "image_size": [ + 668, + 463 + ], + "mask_size": [ + 668, + 463 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 71, + "output_name": "BUSI_0071_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (71).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (71)_mask.png", + "available_masks": [ + "malignant (71)_mask.png" + ], + "image_size": [ + 528, + 592 + ], + "mask_size": [ + 528, + 592 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 72, + "output_name": "BUSI_0072_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (72).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (72)_mask.png", + "available_masks": [ + "malignant (72)_mask.png" + ], + "image_size": [ + 528, + 598 + ], + "mask_size": [ + 528, + 598 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 73, + "output_name": "BUSI_0073_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (73).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (73)_mask.png", + "available_masks": [ + "malignant (73)_mask.png" + ], + "image_size": [ + 549, + 474 + ], + "mask_size": [ + 549, + 474 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 74, + "output_name": "BUSI_0074_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (74).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (74)_mask.png", + "available_masks": [ + "malignant (74)_mask.png" + ], + "image_size": [ + 558, + 464 + ], + "mask_size": [ + 558, + 464 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 75, + "output_name": "BUSI_0075_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (75).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (75)_mask.png", + "available_masks": [ + "malignant (75)_mask.png" + ], + "image_size": [ + 441, + 412 + ], + "mask_size": [ + 441, + 412 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 76, + "output_name": "BUSI_0076_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (76).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (76)_mask.png", + "available_masks": [ + "malignant (76)_mask.png" + ], + "image_size": [ + 769, + 494 + ], + "mask_size": [ + 769, + 494 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 77, + "output_name": "BUSI_0077_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (77).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (77)_mask.png", + "available_masks": [ + "malignant (77)_mask.png" + ], + "image_size": [ + 801, + 587 + ], + "mask_size": [ + 801, + 587 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 78, + "output_name": "BUSI_0078_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (78).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (78)_mask.png", + "available_masks": [ + "malignant (78)_mask.png" + ], + "image_size": [ + 880, + 567 + ], + "mask_size": [ + 880, + 567 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 79, + "output_name": "BUSI_0079_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (79).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (79)_mask.png", + "available_masks": [ + "malignant (79)_mask.png" + ], + "image_size": [ + 564, + 468 + ], + "mask_size": [ + 564, + 468 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 80, + "output_name": "BUSI_0080_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (80).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (80)_mask.png", + "available_masks": [ + "malignant (80)_mask.png" + ], + "image_size": [ + 643, + 443 + ], + "mask_size": [ + 643, + 443 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 81, + "output_name": "BUSI_0081_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (81).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (81)_mask.png", + "available_masks": [ + "malignant (81)_mask.png" + ], + "image_size": [ + 764, + 452 + ], + "mask_size": [ + 764, + 452 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 82, + "output_name": "BUSI_0082_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (82).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (82)_mask.png", + "available_masks": [ + "malignant (82)_mask.png" + ], + "image_size": [ + 569, + 459 + ], + "mask_size": [ + 569, + 459 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 83, + "output_name": "BUSI_0083_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (83).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (83)_mask.png", + "available_masks": [ + "malignant (83)_mask.png" + ], + "image_size": [ + 654, + 616 + ], + "mask_size": [ + 654, + 616 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 84, + "output_name": "BUSI_0084_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (84).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (84)_mask.png", + "available_masks": [ + "malignant (84)_mask.png" + ], + "image_size": [ + 649, + 612 + ], + "mask_size": [ + 649, + 612 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 85, + "output_name": "BUSI_0085_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (85).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (85)_mask.png", + "available_masks": [ + "malignant (85)_mask.png" + ], + "image_size": [ + 733, + 485 + ], + "mask_size": [ + 733, + 485 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 86, + "output_name": "BUSI_0086_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (86).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (86)_mask.png", + "available_masks": [ + "malignant (86)_mask.png" + ], + "image_size": [ + 735, + 483 + ], + "mask_size": [ + 735, + 483 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 87, + "output_name": "BUSI_0087_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (87).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (87)_mask.png", + "available_masks": [ + "malignant (87)_mask.png" + ], + "image_size": [ + 561, + 499 + ], + "mask_size": [ + 561, + 499 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 88, + "output_name": "BUSI_0088_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (88).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (88)_mask.png", + "available_masks": [ + "malignant (88)_mask.png" + ], + "image_size": [ + 775, + 591 + ], + "mask_size": [ + 775, + 591 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 89, + "output_name": "BUSI_0089_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (89).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (89)_mask.png", + "available_masks": [ + "malignant (89)_mask.png" + ], + "image_size": [ + 786, + 585 + ], + "mask_size": [ + 786, + 585 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 90, + "output_name": "BUSI_0090_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (90).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (90)_mask.png", + "available_masks": [ + "malignant (90)_mask.png" + ], + "image_size": [ + 783, + 587 + ], + "mask_size": [ + 783, + 587 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 91, + "output_name": "BUSI_0091_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (91).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (91)_mask.png", + "available_masks": [ + "malignant (91)_mask.png" + ], + "image_size": [ + 550, + 494 + ], + "mask_size": [ + 550, + 494 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 92, + "output_name": "BUSI_0092_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (92).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (92)_mask.png", + "available_masks": [ + "malignant (92)_mask.png" + ], + "image_size": [ + 617, + 581 + ], + "mask_size": [ + 617, + 581 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 93, + "output_name": "BUSI_0093_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (93).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (93)_mask.png", + "available_masks": [ + "malignant (93)_mask.png" + ], + "image_size": [ + 554, + 470 + ], + "mask_size": [ + 554, + 470 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 94, + "output_name": "BUSI_0094_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (94).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (94)_mask.png", + "available_masks": [ + "malignant (94)_mask.png" + ], + "image_size": [ + 564, + 452 + ], + "mask_size": [ + 564, + 452 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 95, + "output_name": "BUSI_0095_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (95).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (95)_mask.png", + "available_masks": [ + "malignant (95)_mask.png" + ], + "image_size": [ + 781, + 486 + ], + "mask_size": [ + 781, + 486 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 96, + "output_name": "BUSI_0096_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (96).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (96)_mask.png", + "available_masks": [ + "malignant (96)_mask.png" + ], + "image_size": [ + 560, + 483 + ], + "mask_size": [ + 560, + 483 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 97, + "output_name": "BUSI_0097_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (97).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (97)_mask.png", + "available_masks": [ + "malignant (97)_mask.png" + ], + "image_size": [ + 583, + 486 + ], + "mask_size": [ + 583, + 486 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 98, + "output_name": "BUSI_0098_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (98).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (98)_mask.png", + "available_masks": [ + "malignant (98)_mask.png" + ], + "image_size": [ + 770, + 486 + ], + "mask_size": [ + 770, + 486 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 99, + "output_name": "BUSI_0099_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (99).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (99)_mask.png", + "available_masks": [ + "malignant (99)_mask.png" + ], + "image_size": [ + 550, + 486 + ], + "mask_size": [ + 550, + 486 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 100, + "output_name": "BUSI_0100_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (100).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (100)_mask.png", + "available_masks": [ + "malignant (100)_mask.png" + ], + "image_size": [ + 557, + 476 + ], + "mask_size": [ + 557, + 476 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 101, + "output_name": "BUSI_0101_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (101).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (101)_mask.png", + "available_masks": [ + "malignant (101)_mask.png" + ], + "image_size": [ + 883, + 559 + ], + "mask_size": [ + 883, + 559 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 102, + "output_name": "BUSI_0102_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (102).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (102)_mask.png", + "available_masks": [ + "malignant (102)_mask.png" + ], + "image_size": [ + 916, + 551 + ], + "mask_size": [ + 916, + 551 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 103, + "output_name": "BUSI_0103_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (103).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (103)_mask.png", + "available_masks": [ + "malignant (103)_mask.png" + ], + "image_size": [ + 555, + 488 + ], + "mask_size": [ + 555, + 488 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 104, + "output_name": "BUSI_0104_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (104).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (104)_mask.png", + "available_masks": [ + "malignant (104)_mask.png" + ], + "image_size": [ + 554, + 494 + ], + "mask_size": [ + 554, + 494 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 105, + "output_name": "BUSI_0105_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (105).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (105)_mask.png", + "available_masks": [ + "malignant (105)_mask.png" + ], + "image_size": [ + 577, + 450 + ], + "mask_size": [ + 577, + 450 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 106, + "output_name": "BUSI_0106_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (106).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (106)_mask.png", + "available_masks": [ + "malignant (106)_mask.png" + ], + "image_size": [ + 667, + 458 + ], + "mask_size": [ + 667, + 458 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 107, + "output_name": "BUSI_0107_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (107).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (107)_mask.png", + "available_masks": [ + "malignant (107)_mask.png" + ], + "image_size": [ + 576, + 454 + ], + "mask_size": [ + 576, + 454 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 108, + "output_name": "BUSI_0108_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (108).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (108)_mask.png", + "available_masks": [ + "malignant (108)_mask.png" + ], + "image_size": [ + 660, + 459 + ], + "mask_size": [ + 660, + 459 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 109, + "output_name": "BUSI_0109_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (109).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (109)_mask.png", + "available_masks": [ + "malignant (109)_mask.png" + ], + "image_size": [ + 552, + 471 + ], + "mask_size": [ + 552, + 471 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 110, + "output_name": "BUSI_0110_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (110).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (110)_mask.png", + "available_masks": [ + "malignant (110)_mask.png" + ], + "image_size": [ + 557, + 470 + ], + "mask_size": [ + 557, + 470 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 111, + "output_name": "BUSI_0111_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (111).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (111)_mask.png", + "available_masks": [ + "malignant (111)_mask.png" + ], + "image_size": [ + 421, + 470 + ], + "mask_size": [ + 421, + 470 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 112, + "output_name": "BUSI_0112_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (112).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (112)_mask.png", + "available_masks": [ + "malignant (112)_mask.png" + ], + "image_size": [ + 549, + 471 + ], + "mask_size": [ + 549, + 471 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 113, + "output_name": "BUSI_0113_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (113).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (113)_mask.png", + "available_masks": [ + "malignant (113)_mask.png" + ], + "image_size": [ + 745, + 482 + ], + "mask_size": [ + 745, + 482 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 114, + "output_name": "BUSI_0114_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (114).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (114)_mask.png", + "available_masks": [ + "malignant (114)_mask.png" + ], + "image_size": [ + 340, + 439 + ], + "mask_size": [ + 340, + 439 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 115, + "output_name": "BUSI_0115_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (115).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (115)_mask.png", + "available_masks": [ + "malignant (115)_mask.png" + ], + "image_size": [ + 581, + 438 + ], + "mask_size": [ + 581, + 438 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 116, + "output_name": "BUSI_0116_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (116).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (116)_mask.png", + "available_masks": [ + "malignant (116)_mask.png" + ], + "image_size": [ + 582, + 434 + ], + "mask_size": [ + 582, + 434 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 117, + "output_name": "BUSI_0117_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (117).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (117)_mask.png", + "available_masks": [ + "malignant (117)_mask.png" + ], + "image_size": [ + 611, + 434 + ], + "mask_size": [ + 611, + 434 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 118, + "output_name": "BUSI_0118_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (118).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (118)_mask.png", + "available_masks": [ + "malignant (118)_mask.png" + ], + "image_size": [ + 562, + 473 + ], + "mask_size": [ + 562, + 473 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 119, + "output_name": "BUSI_0119_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (119).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (119)_mask.png", + "available_masks": [ + "malignant (119)_mask.png" + ], + "image_size": [ + 564, + 469 + ], + "mask_size": [ + 564, + 469 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 120, + "output_name": "BUSI_0120_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (120).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (120)_mask.png", + "available_masks": [ + "malignant (120)_mask.png" + ], + "image_size": [ + 564, + 470 + ], + "mask_size": [ + 564, + 470 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 121, + "output_name": "BUSI_0121_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (121).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (121)_mask.png", + "available_masks": [ + "malignant (121)_mask.png" + ], + "image_size": [ + 562, + 476 + ], + "mask_size": [ + 562, + 476 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 122, + "output_name": "BUSI_0122_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (122).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (122)_mask.png", + "available_masks": [ + "malignant (122)_mask.png" + ], + "image_size": [ + 554, + 467 + ], + "mask_size": [ + 554, + 467 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 123, + "output_name": "BUSI_0123_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (123).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (123)_mask.png", + "available_masks": [ + "malignant (123)_mask.png" + ], + "image_size": [ + 321, + 483 + ], + "mask_size": [ + 321, + 483 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 124, + "output_name": "BUSI_0124_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (124).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (124)_mask.png", + "available_masks": [ + "malignant (124)_mask.png" + ], + "image_size": [ + 545, + 494 + ], + "mask_size": [ + 545, + 494 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 125, + "output_name": "BUSI_0125_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (125).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (125)_mask.png", + "available_masks": [ + "malignant (125)_mask.png" + ], + "image_size": [ + 557, + 465 + ], + "mask_size": [ + 557, + 465 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 126, + "output_name": "BUSI_0126_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (126).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (126)_mask.png", + "available_masks": [ + "malignant (126)_mask.png" + ], + "image_size": [ + 557, + 478 + ], + "mask_size": [ + 557, + 478 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 127, + "output_name": "BUSI_0127_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (127).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (127)_mask.png", + "available_masks": [ + "malignant (127)_mask.png" + ], + "image_size": [ + 591, + 464 + ], + "mask_size": [ + 591, + 464 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 128, + "output_name": "BUSI_0128_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (128).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (128)_mask.png", + "available_masks": [ + "malignant (128)_mask.png" + ], + "image_size": [ + 625, + 468 + ], + "mask_size": [ + 625, + 468 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 129, + "output_name": "BUSI_0129_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (129).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (129)_mask.png", + "available_masks": [ + "malignant (129)_mask.png" + ], + "image_size": [ + 569, + 458 + ], + "mask_size": [ + 569, + 458 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 130, + "output_name": "BUSI_0130_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (130).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (130)_mask.png", + "available_masks": [ + "malignant (130)_mask.png" + ], + "image_size": [ + 555, + 463 + ], + "mask_size": [ + 555, + 463 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 131, + "output_name": "BUSI_0131_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (131).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (131)_mask.png", + "available_masks": [ + "malignant (131)_mask.png" + ], + "image_size": [ + 604, + 461 + ], + "mask_size": [ + 604, + 461 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 132, + "output_name": "BUSI_0132_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (132).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (132)_mask.png", + "available_masks": [ + "malignant (132)_mask.png" + ], + "image_size": [ + 451, + 581 + ], + "mask_size": [ + 451, + 581 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 133, + "output_name": "BUSI_0133_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (133).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (133)_mask.png", + "available_masks": [ + "malignant (133)_mask.png" + ], + "image_size": [ + 479, + 485 + ], + "mask_size": [ + 479, + 485 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 134, + "output_name": "BUSI_0134_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (134).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (134)_mask.png", + "available_masks": [ + "malignant (134)_mask.png" + ], + "image_size": [ + 556, + 467 + ], + "mask_size": [ + 556, + 467 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 135, + "output_name": "BUSI_0135_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (135).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (135)_mask.png", + "available_masks": [ + "malignant (135)_mask.png" + ], + "image_size": [ + 933, + 571 + ], + "mask_size": [ + 933, + 571 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 136, + "output_name": "BUSI_0136_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (136).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (136)_mask.png", + "available_masks": [ + "malignant (136)_mask.png" + ], + "image_size": [ + 190, + 335 + ], + "mask_size": [ + 190, + 335 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 137, + "output_name": "BUSI_0137_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (137).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (137)_mask.png", + "available_masks": [ + "malignant (137)_mask.png" + ], + "image_size": [ + 233, + 339 + ], + "mask_size": [ + 233, + 339 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 138, + "output_name": "BUSI_0138_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (138).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (138)_mask.png", + "available_masks": [ + "malignant (138)_mask.png" + ], + "image_size": [ + 556, + 467 + ], + "mask_size": [ + 556, + 467 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 139, + "output_name": "BUSI_0139_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (139).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (139)_mask.png", + "available_masks": [ + "malignant (139)_mask.png" + ], + "image_size": [ + 549, + 474 + ], + "mask_size": [ + 549, + 474 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 140, + "output_name": "BUSI_0140_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (140).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (140)_mask.png", + "available_masks": [ + "malignant (140)_mask.png" + ], + "image_size": [ + 546, + 463 + ], + "mask_size": [ + 546, + 463 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 141, + "output_name": "BUSI_0141_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (141).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (141)_mask.png", + "available_masks": [ + "malignant (141)_mask.png" + ], + "image_size": [ + 588, + 434 + ], + "mask_size": [ + 588, + 434 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 142, + "output_name": "BUSI_0142_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (142).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (142)_mask.png", + "available_masks": [ + "malignant (142)_mask.png" + ], + "image_size": [ + 556, + 465 + ], + "mask_size": [ + 556, + 465 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 143, + "output_name": "BUSI_0143_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (143).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (143)_mask.png", + "available_masks": [ + "malignant (143)_mask.png" + ], + "image_size": [ + 562, + 467 + ], + "mask_size": [ + 562, + 467 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 144, + "output_name": "BUSI_0144_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (144).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (144)_mask.png", + "available_masks": [ + "malignant (144)_mask.png" + ], + "image_size": [ + 544, + 470 + ], + "mask_size": [ + 544, + 470 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 145, + "output_name": "BUSI_0145_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (145).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (145)_mask.png", + "available_masks": [ + "malignant (145)_mask.png" + ], + "image_size": [ + 550, + 462 + ], + "mask_size": [ + 550, + 462 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 146, + "output_name": "BUSI_0146_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (146).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (146)_mask.png", + "available_masks": [ + "malignant (146)_mask.png" + ], + "image_size": [ + 575, + 432 + ], + "mask_size": [ + 575, + 432 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 147, + "output_name": "BUSI_0147_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (147).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (147)_mask.png", + "available_masks": [ + "malignant (147)_mask.png" + ], + "image_size": [ + 552, + 471 + ], + "mask_size": [ + 552, + 471 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 148, + "output_name": "BUSI_0148_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (148).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (148)_mask.png", + "available_masks": [ + "malignant (148)_mask.png" + ], + "image_size": [ + 556, + 463 + ], + "mask_size": [ + 556, + 463 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 149, + "output_name": "BUSI_0149_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (149).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (149)_mask.png", + "available_masks": [ + "malignant (149)_mask.png" + ], + "image_size": [ + 763, + 572 + ], + "mask_size": [ + 763, + 572 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 150, + "output_name": "BUSI_0150_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (150).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (150)_mask.png", + "available_masks": [ + "malignant (150)_mask.png" + ], + "image_size": [ + 557, + 463 + ], + "mask_size": [ + 557, + 463 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 151, + "output_name": "BUSI_0151_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (151).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (151)_mask.png", + "available_masks": [ + "malignant (151)_mask.png" + ], + "image_size": [ + 513, + 467 + ], + "mask_size": [ + 513, + 467 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 152, + "output_name": "BUSI_0152_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (152).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (152)_mask.png", + "available_masks": [ + "malignant (152)_mask.png" + ], + "image_size": [ + 776, + 574 + ], + "mask_size": [ + 776, + 574 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 153, + "output_name": "BUSI_0153_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (153).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (153)_mask.png", + "available_masks": [ + "malignant (153)_mask.png" + ], + "image_size": [ + 650, + 603 + ], + "mask_size": [ + 650, + 603 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 154, + "output_name": "BUSI_0154_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (154).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (154)_mask.png", + "available_masks": [ + "malignant (154)_mask.png" + ], + "image_size": [ + 556, + 464 + ], + "mask_size": [ + 556, + 464 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 155, + "output_name": "BUSI_0155_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (155).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (155)_mask.png", + "available_masks": [ + "malignant (155)_mask.png" + ], + "image_size": [ + 551, + 487 + ], + "mask_size": [ + 551, + 487 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 156, + "output_name": "BUSI_0156_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (156).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (156)_mask.png", + "available_masks": [ + "malignant (156)_mask.png" + ], + "image_size": [ + 562, + 457 + ], + "mask_size": [ + 562, + 457 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 157, + "output_name": "BUSI_0157_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (157).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (157)_mask.png", + "available_masks": [ + "malignant (157)_mask.png" + ], + "image_size": [ + 564, + 471 + ], + "mask_size": [ + 564, + 471 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 158, + "output_name": "BUSI_0158_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (158).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (158)_mask.png", + "available_masks": [ + "malignant (158)_mask.png" + ], + "image_size": [ + 313, + 444 + ], + "mask_size": [ + 313, + 444 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 159, + "output_name": "BUSI_0159_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (159).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (159)_mask.png", + "available_masks": [ + "malignant (159)_mask.png" + ], + "image_size": [ + 556, + 482 + ], + "mask_size": [ + 556, + 482 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 160, + "output_name": "BUSI_0160_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (160).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (160)_mask.png", + "available_masks": [ + "malignant (160)_mask.png" + ], + "image_size": [ + 626, + 587 + ], + "mask_size": [ + 626, + 587 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 161, + "output_name": "BUSI_0161_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (161).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (161)_mask.png", + "available_masks": [ + "malignant (161)_mask.png" + ], + "image_size": [ + 694, + 576 + ], + "mask_size": [ + 694, + 576 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 162, + "output_name": "BUSI_0162_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (162).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (162)_mask.png", + "available_masks": [ + "malignant (162)_mask.png" + ], + "image_size": [ + 620, + 587 + ], + "mask_size": [ + 620, + 587 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 163, + "output_name": "BUSI_0163_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (163).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (163)_mask.png", + "available_masks": [ + "malignant (163)_mask.png" + ], + "image_size": [ + 643, + 570 + ], + "mask_size": [ + 643, + 570 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 164, + "output_name": "BUSI_0164_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (164).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (164)_mask.png", + "available_masks": [ + "malignant (164)_mask.png" + ], + "image_size": [ + 551, + 473 + ], + "mask_size": [ + 551, + 473 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 165, + "output_name": "BUSI_0165_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (165).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (165)_mask.png", + "available_masks": [ + "malignant (165)_mask.png" + ], + "image_size": [ + 505, + 332 + ], + "mask_size": [ + 505, + 332 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 166, + "output_name": "BUSI_0166_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (166).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (166)_mask.png", + "available_masks": [ + "malignant (166)_mask.png" + ], + "image_size": [ + 555, + 488 + ], + "mask_size": [ + 555, + 488 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 167, + "output_name": "BUSI_0167_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (167).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (167)_mask.png", + "available_masks": [ + "malignant (167)_mask.png" + ], + "image_size": [ + 563, + 459 + ], + "mask_size": [ + 563, + 459 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 168, + "output_name": "BUSI_0168_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (168).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (168)_mask.png", + "available_masks": [ + "malignant (168)_mask.png" + ], + "image_size": [ + 557, + 469 + ], + "mask_size": [ + 557, + 469 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 169, + "output_name": "BUSI_0169_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (169).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (169)_mask.png", + "available_masks": [ + "malignant (169)_mask.png" + ], + "image_size": [ + 557, + 463 + ], + "mask_size": [ + 557, + 463 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 170, + "output_name": "BUSI_0170_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (170).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (170)_mask.png", + "available_masks": [ + "malignant (170)_mask.png" + ], + "image_size": [ + 556, + 463 + ], + "mask_size": [ + 556, + 463 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 171, + "output_name": "BUSI_0171_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (171).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (171)_mask.png", + "available_masks": [ + "malignant (171)_mask.png" + ], + "image_size": [ + 624, + 589 + ], + "mask_size": [ + 624, + 589 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 172, + "output_name": "BUSI_0172_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (172).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (172)_mask.png", + "available_masks": [ + "malignant (172)_mask.png" + ], + "image_size": [ + 602, + 469 + ], + "mask_size": [ + 602, + 469 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 173, + "output_name": "BUSI_0173_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (173).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (173)_mask.png", + "available_masks": [ + "malignant (173)_mask.png" + ], + "image_size": [ + 573, + 451 + ], + "mask_size": [ + 573, + 451 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 174, + "output_name": "BUSI_0174_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (174).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (174)_mask.png", + "available_masks": [ + "malignant (174)_mask.png" + ], + "image_size": [ + 633, + 581 + ], + "mask_size": [ + 633, + 581 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 175, + "output_name": "BUSI_0175_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (175).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (175)_mask.png", + "available_masks": [ + "malignant (175)_mask.png" + ], + "image_size": [ + 564, + 470 + ], + "mask_size": [ + 564, + 470 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 176, + "output_name": "BUSI_0176_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (176).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (176)_mask.png", + "available_masks": [ + "malignant (176)_mask.png" + ], + "image_size": [ + 640, + 594 + ], + "mask_size": [ + 640, + 594 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 177, + "output_name": "BUSI_0177_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (177).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (177)_mask.png", + "available_masks": [ + "malignant (177)_mask.png" + ], + "image_size": [ + 613, + 581 + ], + "mask_size": [ + 613, + 581 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 178, + "output_name": "BUSI_0178_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (178).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (178)_mask.png", + "available_masks": [ + "malignant (178)_mask.png" + ], + "image_size": [ + 562, + 467 + ], + "mask_size": [ + 562, + 467 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 179, + "output_name": "BUSI_0179_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (179).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (179)_mask.png", + "available_masks": [ + "malignant (179)_mask.png" + ], + "image_size": [ + 432, + 476 + ], + "mask_size": [ + 432, + 476 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 180, + "output_name": "BUSI_0180_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (180).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (180)_mask.png", + "available_masks": [ + "malignant (180)_mask.png" + ], + "image_size": [ + 562, + 461 + ], + "mask_size": [ + 562, + 461 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 181, + "output_name": "BUSI_0181_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (181).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (181)_mask.png", + "available_masks": [ + "malignant (181)_mask.png" + ], + "image_size": [ + 497, + 488 + ], + "mask_size": [ + 497, + 488 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 182, + "output_name": "BUSI_0182_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (182).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (182)_mask.png", + "available_masks": [ + "malignant (182)_mask.png" + ], + "image_size": [ + 689, + 583 + ], + "mask_size": [ + 689, + 583 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 183, + "output_name": "BUSI_0183_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (183).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (183)_mask.png", + "available_masks": [ + "malignant (183)_mask.png" + ], + "image_size": [ + 557, + 457 + ], + "mask_size": [ + 557, + 457 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 184, + "output_name": "BUSI_0184_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (184).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (184)_mask.png", + "available_masks": [ + "malignant (184)_mask.png" + ], + "image_size": [ + 552, + 492 + ], + "mask_size": [ + 552, + 492 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 185, + "output_name": "BUSI_0185_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (185).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (185)_mask.png", + "available_masks": [ + "malignant (185)_mask.png" + ], + "image_size": [ + 694, + 582 + ], + "mask_size": [ + 694, + 582 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 186, + "output_name": "BUSI_0186_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (186).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (186)_mask.png", + "available_masks": [ + "malignant (186)_mask.png" + ], + "image_size": [ + 566, + 506 + ], + "mask_size": [ + 566, + 506 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 187, + "output_name": "BUSI_0187_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (187).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (187)_mask.png", + "available_masks": [ + "malignant (187)_mask.png" + ], + "image_size": [ + 765, + 585 + ], + "mask_size": [ + 765, + 585 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 188, + "output_name": "BUSI_0188_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (188).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (188)_mask.png", + "available_masks": [ + "malignant (188)_mask.png" + ], + "image_size": [ + 724, + 473 + ], + "mask_size": [ + 724, + 473 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 189, + "output_name": "BUSI_0189_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (189).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (189)_mask.png", + "available_masks": [ + "malignant (189)_mask.png" + ], + "image_size": [ + 433, + 400 + ], + "mask_size": [ + 433, + 400 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 190, + "output_name": "BUSI_0190_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (190).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (190)_mask.png", + "available_masks": [ + "malignant (190)_mask.png" + ], + "image_size": [ + 576, + 427 + ], + "mask_size": [ + 576, + 427 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 191, + "output_name": "BUSI_0191_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (191).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (191)_mask.png", + "available_masks": [ + "malignant (191)_mask.png" + ], + "image_size": [ + 673, + 471 + ], + "mask_size": [ + 673, + 471 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 192, + "output_name": "BUSI_0192_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (192).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (192)_mask.png", + "available_masks": [ + "malignant (192)_mask.png" + ], + "image_size": [ + 556, + 488 + ], + "mask_size": [ + 556, + 488 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 193, + "output_name": "BUSI_0193_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (193).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (193)_mask.png", + "available_masks": [ + "malignant (193)_mask.png" + ], + "image_size": [ + 781, + 574 + ], + "mask_size": [ + 781, + 574 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 194, + "output_name": "BUSI_0194_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (194).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (194)_mask.png", + "available_masks": [ + "malignant (194)_mask.png" + ], + "image_size": [ + 923, + 555 + ], + "mask_size": [ + 923, + 555 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 195, + "output_name": "BUSI_0195_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (195).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (195)_mask.png", + "available_masks": [ + "malignant (195)_mask.png" + ], + "image_size": [ + 555, + 475 + ], + "mask_size": [ + 555, + 475 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 196, + "output_name": "BUSI_0196_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (196).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (196)_mask.png", + "available_masks": [ + "malignant (196)_mask.png" + ], + "image_size": [ + 557, + 465 + ], + "mask_size": [ + 557, + 465 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 197, + "output_name": "BUSI_0197_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (197).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (197)_mask.png", + "available_masks": [ + "malignant (197)_mask.png" + ], + "image_size": [ + 552, + 484 + ], + "mask_size": [ + 552, + 484 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 198, + "output_name": "BUSI_0198_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (198).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (198)_mask.png", + "available_masks": [ + "malignant (198)_mask.png" + ], + "image_size": [ + 616, + 677 + ], + "mask_size": [ + 616, + 677 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 199, + "output_name": "BUSI_0199_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (199).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (199)_mask.png", + "available_masks": [ + "malignant (199)_mask.png" + ], + "image_size": [ + 504, + 473 + ], + "mask_size": [ + 504, + 473 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 200, + "output_name": "BUSI_0200_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (200).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (200)_mask.png", + "available_masks": [ + "malignant (200)_mask.png" + ], + "image_size": [ + 438, + 463 + ], + "mask_size": [ + 438, + 463 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 201, + "output_name": "BUSI_0201_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (201).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (201)_mask.png", + "available_masks": [ + "malignant (201)_mask.png" + ], + "image_size": [ + 678, + 576 + ], + "mask_size": [ + 678, + 576 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 202, + "output_name": "BUSI_0202_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (202).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (202)_mask.png", + "available_masks": [ + "malignant (202)_mask.png" + ], + "image_size": [ + 550, + 491 + ], + "mask_size": [ + 550, + 491 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 203, + "output_name": "BUSI_0203_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (203).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (203)_mask.png", + "available_masks": [ + "malignant (203)_mask.png" + ], + "image_size": [ + 577, + 411 + ], + "mask_size": [ + 577, + 411 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 204, + "output_name": "BUSI_0204_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (204).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (204)_mask.png", + "available_masks": [ + "malignant (204)_mask.png" + ], + "image_size": [ + 875, + 585 + ], + "mask_size": [ + 875, + 585 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 205, + "output_name": "BUSI_0205_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (205).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (205)_mask.png", + "available_masks": [ + "malignant (205)_mask.png" + ], + "image_size": [ + 510, + 470 + ], + "mask_size": [ + 510, + 470 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 206, + "output_name": "BUSI_0206_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (206).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (206)_mask.png", + "available_masks": [ + "malignant (206)_mask.png" + ], + "image_size": [ + 792, + 571 + ], + "mask_size": [ + 792, + 571 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 207, + "output_name": "BUSI_0207_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (207).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (207)_mask.png", + "available_masks": [ + "malignant (207)_mask.png" + ], + "image_size": [ + 557, + 458 + ], + "mask_size": [ + 557, + 458 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 208, + "output_name": "BUSI_0208_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (208).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (208)_mask.png", + "available_masks": [ + "malignant (208)_mask.png" + ], + "image_size": [ + 617, + 664 + ], + "mask_size": [ + 617, + 664 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 209, + "output_name": "BUSI_0209_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (209).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (209)_mask.png", + "available_masks": [ + "malignant (209)_mask.png" + ], + "image_size": [ + 508, + 471 + ], + "mask_size": [ + 508, + 471 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + }, + { + "class_name": "malignant", + "class_code": "M", + "image_id": 210, + "output_name": "BUSI_0210_M.png", + "source_image": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (210).png", + "selected_mask": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/malignant/malignant (210)_mask.png", + "available_masks": [ + "malignant (210)_mask.png" + ], + "image_size": [ + 775, + 587 + ], + "mask_size": [ + 775, + 587 + ], + "image_mode": "RGB", + "selected_mask_mode": "1" + } + ] + }, + "post_export": { + "images_dir": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/BUSI/all_images", + "masks_dir": "/Users/amaraly/Desktop/Bulk_data/ORIGINAL/Dataset_BUSI_with_GT-20250804T201752Z-1-001/Dataset_BUSI_with_GT/BUSI/all_masks", + "image_count": 647, + "mask_count": 647, + "errors": [] + } +} \ No newline at end of file diff --git a/MODEL_RUN_COMMANDS.md b/MODEL_RUN_COMMANDS.md new file mode 100644 index 0000000000000000000000000000000000000000..c3560d93c66302daccc7902831fe0c24728cb78c --- /dev/null +++ b/MODEL_RUN_COMMANDS.md @@ -0,0 +1,121 @@ +# Per-model run commands — `foldsrunner_simplified_after_ablation.py` + +Base config is already set in the file: `STRATEGIES=[2,3]`, 10 phases (`PHASE_EXECUTION_MODE="auto"`), +100% data, `BATCH_SIZE=48`, `NUM_WORKERS=12`, `STRATEGY_2_MAX_EPOCHS=100`, `STRATEGY_3_MAX_EPOCHS=120`, +`RUN_OPTUNA=False`, `STRATEGY2_CHECKPOINT_MODE="best"` (strategy 3 uses the strategy-2 base trained in +the same run — no checkpoint wiring needed). + +**Validated at 128px:** DPT+ViT-tiny and UPerNet+Swin-tiny were dropped (weights locked to 224px) and +replaced with **PVTv2 + UPerNet** (b1 and b2), which run natively at 128px. Re-run +`python validate_models.py` to confirm all 6 pass on your box before launching. + +--- + +## 1. SegFormer-B0 (transformer → SegFormer params, proj 192) + +```bash +cd /workspace +sed -i -E \ + -e 's/^SMP_ENCODER_NAME = .*/SMP_ENCODER_NAME = "mit_b0"/' \ + -e 's/^SMP_DECODER_TYPE = .*/SMP_DECODER_TYPE = "Segformer"/' \ + -e 's/^SMP_ENCODER_PROJ_DIM = .*/SMP_ENCODER_PROJ_DIM = 192/' \ + -e 's/^SMP_ENCODER_DEPTH = .*/SMP_ENCODER_DEPTH = 5/' \ + -e 's/^MODEL_NAME = .*/MODEL_NAME = "Segformer_B0"/' \ + -e 's#"2:100": "[^"]*"#"2:100": "params/segformer_b0/best_params_strat2.json"#' \ + -e 's#"3:100": "[^"]*"#"3:100": "params/segformer_b0/best_params_strat3.json"#' \ + foldsrunner_simplified_after_ablation.py +python foldsrunner_simplified_after_ablation.py +``` + +## 2. U-Net + EfficientNet-B0 (CNN → U-Net params, proj 256) + +```bash +cd /workspace +sed -i -E \ + -e 's/^SMP_ENCODER_NAME = .*/SMP_ENCODER_NAME = "efficientnet-b0"/' \ + -e 's/^SMP_DECODER_TYPE = .*/SMP_DECODER_TYPE = "Unet"/' \ + -e 's/^SMP_ENCODER_PROJ_DIM = .*/SMP_ENCODER_PROJ_DIM = 256/' \ + -e 's/^SMP_ENCODER_DEPTH = .*/SMP_ENCODER_DEPTH = 5/' \ + -e 's/^MODEL_NAME = .*/MODEL_NAME = "Unet_EffB0"/' \ + -e 's#"2:100": "[^"]*"#"2:100": "params/unet_effb0/best_params_strat2.json"#' \ + -e 's#"3:100": "[^"]*"#"3:100": "params/unet_effb0/best_params_strat3.json"#' \ + foldsrunner_simplified_after_ablation.py +python foldsrunner_simplified_after_ablation.py +``` + +## 3. DeepLabV3+ + ResNet34 (CNN → U-Net params, proj 256) + +```bash +cd /workspace +sed -i -E \ + -e 's/^SMP_ENCODER_NAME = .*/SMP_ENCODER_NAME = "resnet34"/' \ + -e 's/^SMP_DECODER_TYPE = .*/SMP_DECODER_TYPE = "DeepLabV3Plus"/' \ + -e 's/^SMP_ENCODER_PROJ_DIM = .*/SMP_ENCODER_PROJ_DIM = 256/' \ + -e 's/^SMP_ENCODER_DEPTH = .*/SMP_ENCODER_DEPTH = 5/' \ + -e 's/^MODEL_NAME = .*/MODEL_NAME = "DeepLabV3Plus_ResNet34"/' \ + -e 's#"2:100": "[^"]*"#"2:100": "params/deeplabv3plus_r34/best_params_strat2.json"#' \ + -e 's#"3:100": "[^"]*"#"3:100": "params/deeplabv3plus_r34/best_params_strat3.json"#' \ + foldsrunner_simplified_after_ablation.py +python foldsrunner_simplified_after_ablation.py +``` + +## 4. LinkNet + MobileNetV3-Large (CNN → U-Net params, proj 256) + +```bash +cd /workspace +sed -i -E \ + -e 's/^SMP_ENCODER_NAME = .*/SMP_ENCODER_NAME = "timm-mobilenetv3_large_100"/' \ + -e 's/^SMP_DECODER_TYPE = .*/SMP_DECODER_TYPE = "Linknet"/' \ + -e 's/^SMP_ENCODER_PROJ_DIM = .*/SMP_ENCODER_PROJ_DIM = 256/' \ + -e 's/^SMP_ENCODER_DEPTH = .*/SMP_ENCODER_DEPTH = 5/' \ + -e 's/^MODEL_NAME = .*/MODEL_NAME = "Linknet_MobileNetV3"/' \ + -e 's#"2:100": "[^"]*"#"2:100": "params/linknet_mbv3/best_params_strat2.json"#' \ + -e 's#"3:100": "[^"]*"#"3:100": "params/linknet_mbv3/best_params_strat3.json"#' \ + foldsrunner_simplified_after_ablation.py +python foldsrunner_simplified_after_ablation.py +``` + +## 5. UPerNet + PVTv2-b1 (transformer → SegFormer params, proj 192) + +```bash +cd /workspace +sed -i -E \ + -e 's/^SMP_ENCODER_NAME = .*/SMP_ENCODER_NAME = "tu-pvt_v2_b1"/' \ + -e 's/^SMP_DECODER_TYPE = .*/SMP_DECODER_TYPE = "UPerNet"/' \ + -e 's/^SMP_ENCODER_PROJ_DIM = .*/SMP_ENCODER_PROJ_DIM = 192/' \ + -e 's/^SMP_ENCODER_DEPTH = .*/SMP_ENCODER_DEPTH = 5/' \ + -e 's/^MODEL_NAME = .*/MODEL_NAME = "UPerNet_PVTv2_b1"/' \ + -e 's#"2:100": "[^"]*"#"2:100": "params/upernet_pvtv2_b1/best_params_strat2.json"#' \ + -e 's#"3:100": "[^"]*"#"3:100": "params/upernet_pvtv2_b1/best_params_strat3.json"#' \ + foldsrunner_simplified_after_ablation.py +python foldsrunner_simplified_after_ablation.py +``` + +## 6. UPerNet + PVTv2-b2 (transformer → SegFormer params, proj 192) + +```bash +cd /workspace +sed -i -E \ + -e 's/^SMP_ENCODER_NAME = .*/SMP_ENCODER_NAME = "tu-pvt_v2_b2"/' \ + -e 's/^SMP_DECODER_TYPE = .*/SMP_DECODER_TYPE = "UPerNet"/' \ + -e 's/^SMP_ENCODER_PROJ_DIM = .*/SMP_ENCODER_PROJ_DIM = 192/' \ + -e 's/^SMP_ENCODER_DEPTH = .*/SMP_ENCODER_DEPTH = 5/' \ + -e 's/^MODEL_NAME = .*/MODEL_NAME = "UPerNet_PVTv2_b2"/' \ + -e 's#"2:100": "[^"]*"#"2:100": "params/upernet_pvtv2_b2/best_params_strat2.json"#' \ + -e 's#"3:100": "[^"]*"#"3:100": "params/upernet_pvtv2_b2/best_params_strat3.json"#' \ + foldsrunner_simplified_after_ablation.py +python foldsrunner_simplified_after_ablation.py +``` + +--- + +## After the runs — plots + +```bash +cd /workspace +python plot_s2_vs_s3.py +``` + +One titled figure per model → `runs/_plots/__s2_vs_s3.png` (6 panels: BIoU band, BIoU +contour, inference time, total training time, time per epoch, time to best checkpoint — S2 vs S3, +mean ± std across the 10 phases, Δ annotated), plus `runs/_plots/summary_s2_vs_s3.csv`. diff --git a/foldsrunner_simplified_after_ablation.py b/foldsrunner_simplified_after_ablation.py new file mode 100644 index 0000000000000000000000000000000000000000..605da5ea6b309c3c01548bdc48c725101fe1d284 --- /dev/null +++ b/foldsrunner_simplified_after_ablation.py @@ -0,0 +1,12733 @@ +from __future__ import annotations +import copy +import csv +from dataclasses import dataclass +from decimal import Decimal, InvalidOperation +from datetime import datetime, timezone +import gc +import hashlib +import importlib +import inspect +import json +import math +import os +import random +import shutil +import sqlite3 +import subprocess +import sys +import tarfile +import tempfile +import threading +import time +import traceback +import weakref +from collections import Counter +from contextlib import contextmanager, nullcontext +from pathlib import Path +from typing import Any, Iterator, Literal + +# Suppress the C++ "[W] Could not initialize NNPACK! Reason: Unsupported hardware." warning +# spam. It is emitted once per process, including every DataLoader worker (hence the bursts of +# identical lines). Must be set BEFORE torch is first imported (torch is pulled in by +# segmentation_models_pytorch below) so all forked/spawned workers inherit it. NNPACK only +# accelerates CPU convolutions; GPU training is unaffected. +os.environ.setdefault("TORCH_CPP_LOG_LEVEL", "ERROR") + +import matplotlib + +matplotlib.use("Agg") +import matplotlib.pyplot as plt +import numpy as np +import optuna +import pandas as pd +import segmentation_models_pytorch as smp +os.environ.setdefault("NNPACK_DISABLE", "1") +import torch +torch.backends.nnpack.enabled = False +import torch.nn as nn +import torch.nn.functional as F +from optuna.storages import RDBStorage +from PIL import Image as PILImage +from scipy import ndimage +from torch.optim import Adam, AdamW +from torch.optim.lr_scheduler import CosineAnnealingLR +from torch.utils.data import DataLoader, Dataset +from tqdm.auto import tqdm + +"""============================================================================= +EDIT ME +============================================================================= +""" + +PROJECT_DIR = Path(__file__).resolve().parent #Path("/content/drive/MyDrive/SDP_ultrasound") ## +TRANSUNET_REPO_DIR = PROJECT_DIR / "TransUNet" +TRANSUNET_VIT_NAME = "R50-ViT-B_16" +TRANSUNET_N_SKIP = 3 +TRANSUNET_PRETRAINED_PATH = PROJECT_DIR / "model" / "vit_checkpoint" / "imagenet21k" / "R50+ViT-B_16.npz" + +RUNS_ROOT = PROJECT_DIR / "runs" +HARD_CODED_PARAM_DIR = PROJECT_DIR +MODEL_NAME = "UPerNet_PVTv2_b2" + +EXPERIMENT_MODE = "repeated_holdout" # "single_run" or "repeated_holdout" +SUPPORTED_EXPERIMENT_MODES = ("single_run", "repeated_holdout") +SPLIT_GENERATION_MODE = "fixed_stratified_phases_8_1_1" # "repeated_holdout" or "fixed_stratified_phases_8_1_1" +SUPPORTED_SPLIT_GENERATION_MODES = ("repeated_holdout", "fixed_stratified_phases_8_1_1") +NUM_STRATIFIED_SPLIT_REPEATS = 5 +NUM_PHASES = 10 +PHASE_VAL_OFFSET = 1 +DATASET_PERCENT_REPEAT_COUNTS: dict[int, int] = { + # 5: 4, + # 15: 3, + # 30: 3, + # 50: 2, + 100: 1, +} +PERCENT_SAMPLING_MODE = "incremental" # "independent" or "incremental" +SUPPORTED_PERCENT_SAMPLING_MODES = ("independent", "incremental") +PERCENT_EXECUTION_MODE = "manual" # "auto" or "manual" +SUPPORTED_PERCENT_EXECUTION_MODES = ("auto", "manual") +SELECTED_DATASET_PERCENTS: list[int] = [100] +SPLIT_EXECUTION_MODE = "manual" # "auto" or "manual" +SUPPORTED_SPLIT_EXECUTION_MODES = ("auto", "manual") +SELECTED_SPLIT_INDICES: list[int] = [1] + +PHASE_EXECUTION_MODE = "manual" +SUPPORTED_PHASE_EXECUTION_MODES = ("auto", "manual") +SELECTED_PHASES: list[int] = [2, 3, 4, 9, 10] + +REPEAT_EXECUTION_MODE = "auto" # "auto" or "manual" +SUPPORTED_REPEAT_EXECUTION_MODES = ("auto", "manual") +SELECTED_REPEAT_INDICES: list[int] = [1] + +FOLDS_EXPERIMENT_NAME = "stratified_holdout_v1" +RESUME_FOLDS = False +ASYNC_REPO_BACKUP_AFTER_PHASE = False +# Hugging Face dataset repo to mirror the project into. Set via env so nothing is +# hardcoded: export HF_REPO_ID="your-username/ADVAI24JUN-backup" and HF_TOKEN=... +HF_REPO_ID = os.environ.get("HF_REPO_ID", "") +HF_REPO_TYPE = "dataset" +# Only upload after every Nth phase (boundary), so we don't hammer HF every phase. +HF_BACKUP_EVERY_N_PHASES = 1 +HF_BACKUP_MAX_RETRIES = 5 +# Run one synchronous backup BEFORE training starts: it creates the repo and uploads +# the current project state, proving the whole backup pipeline works before we commit +# hours of compute. Phase backups later refresh this same repo. +HF_BACKUP_ON_START = False +# Glob patterns excluded from the upload (matched against repo-relative paths). +HF_IGNORE_PATTERNS = ( + "**/.git/**", + "**/__pycache__/**", + "**/.ipynb_checkpoints/**", + "**/.cache/**", + "**/.venv/**", + "*.pyc", + ".DS_Store", +) + +DATASET_NAME = "BUSI_with_classes" # "BUSI" or "BUSI_with_classes" +SUPPORTED_DATASET_NAMES = ("BUSI", "BUSI_with_classes") +DATA_ROOT = PROJECT_DIR / DATASET_NAME +BUSI_WITH_CLASSES_SPLIT_POLICY = "stratified" # "balanced_train" or "stratified" +SUPPORTED_BUSI_WITH_CLASSES_SPLIT_POLICIES = ("balanced_train", "stratified") + +SUPPORTED_STRATEGIES: tuple[int, ...] = (2,3) +STRATEGIES = [2,3] +DATASET_PERCENTS = [] #ignored in the folding [0.25, 0.3, 0.35, 0.4, 0.45, 0.5, 1.0] #, 0.5, 1.0] #, 0.5, 1.0] +SPLIT_TYPE = "80_10_10" +SUPPORTED_SPLIT_TYPES = ("80_10_10", "70_10_20") +DATASET_SPLITS_JSON = PROJECT_DIR / "dataset_splits.json" +DATASET_SPLITS_VERSION = 1 +TRAIN_SUBSET_VARIANT = 1 # 0 uses the persisted subset; >0 deterministically resamples only the train subset from the frozen base train split. +NUM_TRIALS = 20 # fast tuning: TPE(Bayesian) converges in ~20 with aggressive pruning +STUDY_DIRECTION = "maximize" +BEST_CHECKPOINT_METRICS = { + 2: "val_iou", + 3: "val_refine_score", +} +OPTUNA_BEST_OBSERVED_OBJECTIVE_ATTR = "best_observed_objective" +OPTUNA_BEST_OBSERVED_OBJECTIVE_NAME_ATTR = "best_observed_objective_name" +SUPPORTED_CHECKPOINT_METRICS = { + "val_loss", + "val_dice", + "val_iou", + "val_biou", + "val_refine_score", + "val_decoder_dice", + "val_decoder_iou", + "val_decoder_biou", + "val_dice_gain", + "val_iou_gain", + "val_biou_gain", + "val_actor_loss", + "val_critic_loss", + "val_ce_loss", + "val_dice_loss", + "val_reward", + "val_entropy", +} + +SEED = 42 +IMG_SIZE = 128 +# d = 0 -> auto (floor(0.02 * diag)); any positive int overrides. +# Recommended: 0 (auto) -> resolves to ~4 px for IMG_SIZE=128. +BOUNDARY_IOU_D: int = 0 +BATCH_SIZE = 48 # A100 80GB fits TransUNet (105M) at 128px comfortably; larger batch = better GPU utilization. Try 48 if memory allows; lower to 16 if OOM. +NUM_WORKERS = 12 # Recommended with RAM-preloaded datasets to avoid worker RAM duplication. +USE_PIN_MEMORY = True +USE_PERSISTENT_WORKERS = True +PRELOAD_TO_RAM = True + +SMP_ENCODER_NAME = "tu-pvt_v2_b2" +SMP_ENCODER_WEIGHTS = "imagenet" +SMP_ENCODER_DEPTH = 5 +SMP_ENCODER_PROJ_DIM = 192 +SMP_DECODER_TYPE = "UPerNet" +BACKBONE_FAMILY = "smp" # "smp" or "custom_vgg" +ENABLE_CUSTOM_VGG_BACKBONE = False +VGG_FEATURE_SCALES = 4 +VGG_FEATURE_DILATION = 1 + +USE_IMAGENET_NORM = True +REPLACE_BN_WITH_GN = True +GN_NUM_GROUPS = 8 +NUM_ACTIONS = 2 + +STRATEGY_1_MAX_EPOCHS = 100 +STRATEGY_2_MAX_EPOCHS = 100 # TUNING value (short trials). Restore to 100 for the final 10-phase run. +STRATEGY_3_MAX_EPOCHS = 120 # TUNING value (S3 plateaus by ~15ep). Restore to 120 for the final run. +STRATEGY_4_MAX_EPOCHS = 100 +STRATEGY_5_MAX_EPOCHS = 100 +VALIDATE_EVERY_N_EPOCHS = 1 +CHECKPOINT_EVERY_N_EPOCHS = 0 +SAVE_LATEST_EVERY_EPOCH = True # master enable for latest.pt (frequency controlled by SAVE_LATEST_EVERY_N_EPOCHS) +SAVE_LATEST_EVERY_N_EPOCHS = 50 # write latest.pt every N epochs (plus final epoch + on early-stop) instead of every epoch, to cut network-volume I/O on RunPod +SAVE_HISTORY_INCREMENTALLY = False +EARLY_STOPPING_PATIENCE = 0 +VERBOSE_EPOCH_LOG = False + +DEFAULT_HEAD_LR = 1e-4 +DEFAULT_ENCODER_LR = 1e-5 +DEFAULT_WEIGHT_DECAY = 1e-4 +DEFAULT_TMAX = 5 +TEST_ITERATION_CONTROL = False # If True, validation/evaluation/inference uses TEST_ITERATION_T instead of full tmax. +TEST_ITERATION_T = 1 # Applied only when TEST_ITERATION_CONTROL=True. Clamped to [1, tmax]. +DEFAULT_GAMMA = 0.95 +DEFAULT_CRITIC_LOSS_WEIGHT = 0.5 +DEFAULT_ENTROPY_ALPHA_INIT = 0.2 +DEFAULT_ENTROPY_TARGET_RATIO = 0.25 +DEFAULT_ENTROPY_LR = 3e-4 +DEFAULT_CE_WEIGHT = 0.5 +DEFAULT_DICE_WEIGHT = 0.5 +DEFAULT_DROPOUT_P = 0.2 +DEFAULT_GRAD_CLIP_NORM = 6.0 +DEFAULT_MASK_UPDATE_STEP = 0.1 +DEFAULT_FOREGROUND_REWARD_WEIGHT = 0.0 +DEFAULT_RECALL_REWARD_WEIGHT = 1.0 +DEFAULT_DICE_REWARD_WEIGHT = 0.35 +DEFAULT_BOUNDARY_REWARD_WEIGHT = 0.5 +DEFAULT_PRIOR_REWARD_WEIGHT = 0.01 +DEFAULT_DECODER_GAIN_REWARD_WEIGHT = 0.5 +DEFAULT_REWARD_SCALE = 1.0 +DEFAULT_STRATEGY3_FREEZE_BOOTSTRAPPED_SEGMENTATION = True +DEFAULT_STRATEGY3_VARIANT = "lite" +DEFAULT_STRATEGY3_NUM_ACTIONS = 3 +DEFAULT_REFINE_DELTA_SMALL = 0.03 +DEFAULT_REFINE_DELTA_LARGE = 0.08 +DEFAULT_STRATEGY3_AUX_CE_WEIGHT = 0.40 +DEFAULT_STRATEGY3_AUX_CE_ANNEAL_START_EPOCH = 25 +DEFAULT_STRATEGY3_AUX_CE_ANNEAL_EPOCHS = 15 +DEFAULT_STRATEGY3_AUX_CE_FLOOR_FRACTION = 0.10 +DEFAULT_STRATEGY3_EARLY_STOPPING_PATIENCE = 30 +DEFAULT_STRATEGY3_PROBE_MODE = "rolling_random" +DEFAULT_STRATEGY3_RL_GRAD_CLIP_NORM = 0.25 +DEFAULT_STRATEGY3_RL_LOSS_SCALE = 10.0 +DEFAULT_STRATEGY3_DELTA_MAX = 0.10 +DEFAULT_STRATEGY3_SAM_ATTENTION_GRID = 64 +DEFAULT_STRATEGY3_R1_PROGRESS_WEIGHT = 1.0 +DEFAULT_STRATEGY3_ADVANTAGE_NORMALIZE = False +DEFAULT_BIOU_REWARD_WEIGHT = 1.0 +DEFAULT_IOU_REWARD_WEIGHT = 1.0 +DEFAULT_KEEP_CORRECT_REWARD_WEIGHT = 0.05 +DEFAULT_STRATEGY3_A3C_ENTROPY_COEFF = 0.0 +DEFAULT_STRATEGY3_ENTROPY_TARGET_RATIO = 0.20 +DEFAULT_STRATEGY3_ENTROPY_ALPHA_INIT = 0.005 +DEFAULT_STRATEGY3_BOUNDARY_REWARD_WEIGHT = 0.5 +DEFAULT_EARLY_STOPPING_MONITOR = "auto" +DEFAULT_EARLY_STOPPING_MODE = "auto" +DEFAULT_EARLY_STOPPING_MIN_DELTA = 0.0 +DEFAULT_EARLY_STOPPING_START_EPOCH = 30 +DEFAULT_EXPLORATION_EPS = 0.1 +EXPLORATION_EPS_EPOCHS = 20 +ATTENTION_MAX_TOKENS = 1024 +ATTENTION_MIN_POOL_SIZE = 16 + +_STRATEGY3_SAM_GRID_WARNED: set[int] = set() + +SCHEDULER_FACTOR = 0.5 +SCHEDULER_PATIENCE = 5 +SCHEDULER_THRESHOLD = 1e-3 +SCHEDULER_MIN_LR = 1e-5 + +HEAD_LR_RANGE = (1e-5, 3e-3) +ENCODER_LR_RANGE = (1e-6, 3e-3) +WEIGHT_DECAY_RANGE = (1e-6, 1e-2) +TMAX_RANGE = (3, 10) +ENTROPY_LR_RANGE = (1e-5, 1e-3) +DROPOUT_P_RANGE = (0.0, 0.5) + +USE_TRIAL_PRUNING = True +TRIAL_PRUNER_WARMUP_STEPS = 8 # start pruning weak trials at epoch 8 (was 80 -> nothing got pruned). Biggest speedup. +TRIAL_PRUNER_PATIENCE_STEPS = 6 +LOAD_EXISTING_STUDIES = False +SKIP_EXISTING_FINALS = False +RUN_OPTUNA = False # run the Optuna study (set back to False + USE_EXISTING_BEST_PARAMS_WHEN_OPTUNA_OFF=True for the final run) +RESET_ALL_STUDIES_EACH_RUN = False +USE_EXISTING_BEST_PARAMS_WHEN_OPTUNA_OFF = False + +EXECUTION_MODE = "train_eval" # "train_eval" or "eval_only" +EVAL_CHECKPOINT_MODE = "best" # "latest", "best", or "specific" +EVAL_SPECIFIC_CHECKPOINT = "" +STRATEGY2_CHECKPOINT_MODE = "best" +STRATEGY2_SPECIFIC_CHECKPOINT = { + # Non-phase mode — keyed by dataset percent (float): + # 0.1: "runs/EfficientNet_Strategy2_New/pct_10/strategy_2/final/checkpoints/epoch_0089.pt", + # 0.5: "Strategy2_Checkpoints/strat2_50_best.pt", + # 1.0: "runs/EfficientNet_Strategy2_New/pct_100/strategy_2/final/checkpoints/best.pt", + # Phase mode — keyed by phase index (int): + 1: "/content/UNET_REVAMP/best_strat2.pt", + 2: "/content/UNET_REVAMP/best_strat2_2.pt", + 3: "/content/UNET_REVAMP/best_strat2_3.pt", +} +STRATEGY3_BOOTSTRAP_FROM_STRATEGY2 = True +TRAIN_RESUME_MODE = "off" # "off", "latest", "best", or "specific" +TRAIN_RESUME_SPECIFIC_CHECKPOINT = "" +OPTUNA_HEARTBEAT_INTERVAL = 60 +OPTUNA_HEARTBEAT_GRACE_PERIOD = 180 + +USE_AMP = True +AMP_DTYPE = "bfloat16" # A100 has native bf16 Tensor Cores -> best speed+stability (no GradScaler needed) +USE_CHANNELS_LAST = True # A100: NHWC speeds the conv-heavy ResNet50 hybrid + decoder. Verified output-identical for TransUNet; auto-disabled only for EfficientNet+AMP. +USE_TORCH_COMPILE = True # A100: Inductor kernel fusion. (TransUNet's encoder->decoder cache may cause a graph break; that's fine, it still compiles the rest.) +STEPWISE_BACKWARD = True +ALLOW_TF32 = True # A100: TF32 tensor cores for fp32 matmuls (huge for the ViT attention/MLP) +CUDNN_BENCHMARK = True # A100: autotune conv algorithms for the fixed 128x128 input (faster). Trades exact bitwise reproducibility for speed. + +RUN_SMOKE_TEST = True +SMOKE_TEST_SAMPLE_INDEX = 0 +RUN_OVERFIT_TEST = False +OVERFIT_N_BATCHES = 2 +OVERFIT_N_EPOCHS = 100 +OVERFIT_HEAD_LR = 1e-3 +OVERFIT_ENCODER_LR = 1e-4 +OVERFIT_PRINT_EVERY = 5 +WRITE_EPOCH_DIAGNOSTIC = False # per-epoch param snapshot + grad/param diagnostics + probe re-evals + growing JSON write. Heavy on RunPod; off for production. +EPOCH_DIAGNOSTIC_TRAIN_BATCHES = 2 +EPOCH_DIAGNOSTIC_VAL_BATCHES = 2 +CONTROLLED_MASK_THRESHOLD = 0.50 + +REQUIRED_HPARAM_KEYS = ("head_lr", "encoder_lr", "weight_decay", "dropout_p", "tmax", "entropy_lr") + +_TRANSUNET_REQUIRED_NPZ_KEYS: tuple[str, ...] = ( + "embedding/kernel", + "embedding/bias", + "Transformer/encoder_norm/scale", + "Transformer/encoder_norm/bias", + "Transformer/posembed_input/pos_embedding", + "conv_root/kernel", + "gn_root/scale", + "gn_root/bias", + "Transformer/encoderblock_0/MultiHeadDotProductAttention_1/query/kernel", +) +_TRANSUNET_ENCODER_ALIASES: set[str] = {"vitb16r50", "r50vitb16"} +_TRANSUNET_VISION_TRANSFORMER: Any | None = None +_TRANSUNET_CONFIGS: dict[str, Any] | None = None +_TEST_ITERATION_NOTICE_CACHE: set[tuple[str, int, int]] = set() + +"""============================================================================= +IF OPTUNA IS OFF --> USE ME +============================================================================= +""" + +# Key format: ":" +# Each value is a JSON filename in HARD_CODED_PARAM_DIR containing the required hyperparameters. +MANUAL_HPARAMS_IF_OPTUNA_OFF: dict[str, str] = { + "2:100": "params/upernet_pvtv2_b2/best_params_strat2.json", + "3:100": "params/upernet_pvtv2_b2/best_params_strat3.json", +} + +"""============================================================================= +RUNTIME SETUP +============================================================================= +""" + +torch.set_float32_matmul_precision("high") +if torch.cuda.is_available(): + torch.backends.cuda.matmul.allow_tf32 = ALLOW_TF32 + torch.backends.cudnn.allow_tf32 = ALLOW_TF32 +torch.backends.cudnn.deterministic = not CUDNN_BENCHMARK +torch.backends.cudnn.benchmark = CUDNN_BENCHMARK + +def select_runtime_device() -> tuple[torch.device, str]: + if torch.cuda.is_available(): + return torch.device("cuda"), "cuda" + + mps_backend = getattr(torch.backends, "mps", None) + if mps_backend is not None and mps_backend.is_available(): + try: + _probe = torch.zeros(1, device="mps") + del _probe + return torch.device("mps"), "mps" + except Exception as exc: + print(f"[Device] MPS detected but failed to initialize ({exc}). Falling back to CPU.") + + return torch.device("cpu"), "cpu" + +DEVICE, DEVICE_FALLBACK_SOURCE = select_runtime_device() +CURRENT_JOB_PARAMS: dict[str, Any] = {} + +@dataclass(frozen=True) +class RuntimeModelConfig: + backbone_family: str + smp_encoder_name: str + smp_encoder_weights: str | None + smp_encoder_depth: int + smp_encoder_proj_dim: int + smp_decoder_type: str + vgg_feature_scales: int + vgg_feature_dilation: int + + @classmethod + def from_globals(cls) -> RuntimeModelConfig: + return cls( + backbone_family=str(BACKBONE_FAMILY).strip().lower(), + smp_encoder_name=str(SMP_ENCODER_NAME), + smp_encoder_weights=SMP_ENCODER_WEIGHTS, + smp_encoder_depth=int(SMP_ENCODER_DEPTH), + smp_encoder_proj_dim=int(SMP_ENCODER_PROJ_DIM), + smp_decoder_type=str(SMP_DECODER_TYPE), + vgg_feature_scales=int(VGG_FEATURE_SCALES), + vgg_feature_dilation=int(VGG_FEATURE_DILATION), + ) + + @classmethod + def from_payload(cls, payload: dict[str, Any] | None) -> RuntimeModelConfig: + payload = payload or {} + return cls( + backbone_family=str(payload.get("backbone_family", "smp")).strip().lower(), + smp_encoder_name=str(payload.get("smp_encoder_name", SMP_ENCODER_NAME)), + smp_encoder_weights=payload.get("smp_encoder_weights", SMP_ENCODER_WEIGHTS), + smp_encoder_depth=int(payload.get("smp_encoder_depth", SMP_ENCODER_DEPTH)), + smp_encoder_proj_dim=int(payload.get("smp_encoder_proj_dim", SMP_ENCODER_PROJ_DIM)), + smp_decoder_type=str(payload.get("smp_decoder_type", SMP_DECODER_TYPE)), + vgg_feature_scales=int(payload.get("vgg_feature_scales", VGG_FEATURE_SCALES)), + vgg_feature_dilation=int(payload.get("vgg_feature_dilation", VGG_FEATURE_DILATION)), + ) + + def validate(self) -> RuntimeModelConfig: + if self.backbone_family not in {"smp", "custom_vgg"}: + raise ValueError(f"BACKBONE_FAMILY must be 'smp' or 'custom_vgg', got {self.backbone_family!r}") + if self.vgg_feature_scales not in {3, 4}: + raise ValueError(f"VGG_FEATURE_SCALES must be 3 or 4, got {self.vgg_feature_scales}") + if self.vgg_feature_dilation < 1: + raise ValueError(f"VGG_FEATURE_DILATION must be >= 1, got {self.vgg_feature_dilation}") + if self.smp_encoder_depth < 1: + raise ValueError(f"SMP_ENCODER_DEPTH must be >= 1, got {self.smp_encoder_depth}") + if self.smp_encoder_proj_dim < 0: + raise ValueError(f"SMP_ENCODER_PROJ_DIM must be >= 0, got {self.smp_encoder_proj_dim}") + if _normalized_model_token(self.smp_decoder_type) == "transunet": + if _normalized_model_token(self.smp_encoder_name) not in _TRANSUNET_ENCODER_ALIASES: + print( + "[RuntimeModelConfig] Warning: SMP_DECODER_TYPE='TransUNet' is wired for " + "SMP_ENCODER_NAME='ViTB16R50' (or 'R50ViTB16'). " + f"Received {self.smp_encoder_name!r}." + ) + if IMG_SIZE % 16 != 0: + raise ValueError( + f"TransUNet requires IMG_SIZE divisible by 16, got IMG_SIZE={IMG_SIZE}." + ) + return self + + def to_payload(self) -> dict[str, Any]: + return { + "backbone_family": self.backbone_family, + "smp_encoder_name": self.smp_encoder_name, + "smp_encoder_weights": self.smp_encoder_weights, + "smp_encoder_depth": self.smp_encoder_depth, + "smp_encoder_proj_dim": self.smp_encoder_proj_dim, + "smp_decoder_type": self.smp_decoder_type, + "vgg_feature_scales": self.vgg_feature_scales, + "vgg_feature_dilation": self.vgg_feature_dilation, + } + + def backbone_tag(self) -> str: + return self.backbone_family + + def backbone_display_name(self) -> str: + if self.backbone_family == "custom_vgg": + return f"Custom VGG (scales={self.vgg_feature_scales}, dilation={self.vgg_feature_dilation})" + return f"SMP {self.smp_encoder_name}" + +def current_model_config() -> RuntimeModelConfig: + return RuntimeModelConfig.from_globals().validate() + +"""============================================================================= +UTILITIES +============================================================================= +""" + +def _normalized_model_token(value: str | None) -> str: + return "".join(ch for ch in str(value or "") if ch.isalnum()).lower() + + +def _is_transunet_selection( + model_config: RuntimeModelConfig | None = None, + *, + encoder_name: str | None = None, + decoder_type: str | None = None, +) -> bool: + if model_config is not None: + encoder_name = model_config.smp_encoder_name + decoder_type = model_config.smp_decoder_type + enc = _normalized_model_token(encoder_name) + dec = _normalized_model_token(decoder_type) + return dec == "transunet" and enc in _TRANSUNET_ENCODER_ALIASES + + +def _resolve_test_iteration_tmax(tmax: int, *, context: str) -> int: + effective_tmax = max(int(tmax), 1) + if not TEST_ITERATION_CONTROL: + return effective_tmax + + requested_t = int(TEST_ITERATION_T) + if requested_t < 1: + raise ValueError( + f"TEST_ITERATION_T must be >= 1 when TEST_ITERATION_CONTROL=True, got {requested_t}." + ) + + effective_tmax = min(effective_tmax, requested_t) + cache_key = (context, int(tmax), effective_tmax) + if cache_key not in _TEST_ITERATION_NOTICE_CACHE: + if requested_t > int(tmax): + print( + f"[Test Iteration Control] {context}: TEST_ITERATION_T={requested_t} exceeds tmax={int(tmax)}; " + f"using t={effective_tmax}." + ) + else: + print( + f"[Test Iteration Control] {context}: overriding test rollout steps " + f"from tmax={int(tmax)} to t={effective_tmax}." + ) + _TEST_ITERATION_NOTICE_CACHE.add(cache_key) + return effective_tmax + +def banner(title: str) -> None: + line = "=" * 80 + print(f"\n{line}\n{title}\n{line}") + +def section(title: str) -> None: + print(f"\n{'-' * 80}\n{title}\n{'-' * 80}") + +def ensure_dir(path: str | Path) -> Path: + path = Path(path).expanduser().resolve() + path.mkdir(parents=True, exist_ok=True) + return path + +def save_json(path: str | Path, payload: Any) -> None: + path = Path(path) + ensure_dir(path.parent) + with path.open("w", encoding="utf-8") as f: + json.dump(payload, f, indent=2) + +def load_json(path: str | Path) -> Any: + with Path(path).open("r", encoding="utf-8") as f: + return json.load(f) + +def _format_history_log_value(key: str, value: Any) -> str: + if isinstance(value, float): + if key == "lr" or key.endswith("_lr"): + return f"{value:.6e}" + return json.dumps(value) + return json.dumps(value) + +def format_history_log_row(row: dict[str, Any]) -> str: + return ", ".join(f"{key}={_format_history_log_value(key, value)}" for key, value in row.items()) + +def _format_epoch_metric(value: Any, *, scientific: bool = False) -> str: + if value is None: + return "null" + if isinstance(value, (float, int, np.floating, np.integer)): + value = float(value) + return f"{value:.6e}" if scientific else f"{value:.4f}" + return str(value) + +def format_concise_epoch_log( + row: dict[str, Any], + *, + best_metric_name: str, + best_metric_value: float, +) -> str: + fields: list[tuple[str, Any, bool]] = [ + ("train_loss", row.get("train_loss"), False), + ("train_iou", row.get("train_iou"), False), + ("train_entropy", row.get("train_entropy"), False), + ("val_loss", row.get("val_loss"), False), + ("val_iou", row.get("val_iou"), False), + ("val_dice", row.get("val_dice"), False), + ("val_iou_gain", row.get("val_iou_gain"), False), + ("val_biou_gain", row.get("val_biou_gain"), False), + ("head_lr", row.get("lr"), True), + ("encoder_lr", row.get("encoder_lr"), True), + (best_metric_name, best_metric_value, False), + ("study_best", row.get("study_best_objective"), False), + ] + parts = [ + f"{name}={_format_epoch_metric(value, scientific=scientific)}" + for name, value, scientific in fields + if value is not None + ] + early_monitor_name = row.get("early_stopping_monitor_name") + if early_monitor_name: + parts.append(f"es_monitor={early_monitor_name}") + if row.get("early_stopping_monitor_value") is not None: + parts.append(f"es_value={_format_epoch_metric(row.get('early_stopping_monitor_value'))}") + if row.get("early_stopping_best_value") is not None: + parts.append(f"es_best={_format_epoch_metric(row.get('early_stopping_best_value'))}") + if row.get("early_stopping_wait") is not None and row.get("early_stopping_patience") is not None: + parts.append( + f"es_wait={int(row.get('early_stopping_wait'))}/{int(row.get('early_stopping_patience'))}" + ) + if row.get("early_stopping_active") is not None: + parts.append(f"es_active={bool(row.get('early_stopping_active'))}") + if row.get("strategy3_freeze_active") is not None: + parts.append(f"s3_frozen={bool(row.get('strategy3_freeze_active'))}") + if row.get("study_best_trial") is not None: + parts.append(f"study_best_trial={int(row.get('study_best_trial'))}") + return ", ".join(parts) + +def _optuna_direction_is_maximize(direction: Any) -> bool: + direction_name = str(getattr(direction, "name", direction)).lower() + return direction_name.endswith("maximize") + +def _optuna_value_is_better( + candidate: float | None, + current: float | None, + *, + direction: Any, +) -> bool: + if candidate is None: + return False + if current is None: + return True + return float(candidate) > float(current) if _optuna_direction_is_maximize(direction) else float(candidate) < float(current) + +def _optuna_trial_state_name(trial: Any) -> str: + state = getattr(trial, "state", None) + return str(getattr(state, "name", state)).upper() + +def _optuna_trial_user_attr_float(trial: Any, attr_name: str) -> float | None: + user_attrs = getattr(trial, "user_attrs", None) + if not isinstance(user_attrs, dict): + return None + value = user_attrs.get(attr_name) + if value is None: + return None + try: + return float(value) + except (TypeError, ValueError): + return None + +def _optuna_trial_best_intermediate_value( + trial: Any, + *, + direction: Any, +) -> float | None: + best_value: float | None = None + for value in getattr(trial, "intermediate_values", {}).values(): + if value is None: + continue + candidate_value = float(value) + if _optuna_value_is_better(candidate_value, best_value, direction=direction): + best_value = candidate_value + return best_value + +def _optuna_trial_best_observed_value( + trial: Any, + *, + direction: Any, + current_best_value: float | None = None, +) -> float | None: + if current_best_value is not None: + return float(current_best_value) + + best_observed = _optuna_trial_user_attr_float(trial, OPTUNA_BEST_OBSERVED_OBJECTIVE_ATTR) + if best_observed is not None: + return best_observed + + state_name = _optuna_trial_state_name(trial) + if state_name == "COMPLETE": + value = getattr(trial, "value", None) + return None if value is None else float(value) + + best_intermediate = _optuna_trial_best_intermediate_value(trial, direction=direction) + if best_intermediate is not None: + return best_intermediate + + value = getattr(trial, "value", None) + return None if value is None else float(value) + +def _current_optuna_study_best_candidate( + study: optuna.study.Study, + *, + current_trial: optuna.trial.Trial | None = None, + current_best_value: float | None = None, +) -> tuple[Any | None, float | None]: + direction = getattr(study, "direction", STUDY_DIRECTION) + best_trial: Any | None = None + best_value: float | None = None + + for study_trial in getattr(study, "trials", []): + if _optuna_trial_state_name(study_trial) not in {"COMPLETE", "PRUNED"}: + continue + candidate_value = _optuna_trial_best_observed_value(study_trial, direction=direction) + if _optuna_value_is_better(candidate_value, best_value, direction=direction): + best_trial = study_trial + best_value = candidate_value + + if current_trial is not None: + live_trial_best = _optuna_trial_best_observed_value( + current_trial, + direction=direction, + current_best_value=current_best_value, + ) + if _optuna_value_is_better(live_trial_best, best_value, direction=direction): + best_trial = current_trial + best_value = live_trial_best + + return best_trial, best_value + +def _current_optuna_study_best_snapshot( + trial: optuna.trial.Trial | None, + *, + current_best_value: float | None = None, +) -> tuple[float | None, int | None]: + if trial is None: + return None, None + study = getattr(trial, "study", None) + if study is None: + return None, None + + best_trial, best_value = _current_optuna_study_best_candidate( + study, + current_trial=trial, + current_best_value=current_best_value, + ) + best_trial_number = None if best_trial is None else int(getattr(best_trial, "number", -1)) + return best_value, best_trial_number + +def set_global_seed(seed: int = 42) -> None: + random.seed(seed) + np.random.seed(seed) + torch.manual_seed(seed) + if torch.cuda.is_available(): + torch.cuda.manual_seed_all(seed) + os.environ["PYTHONHASHSEED"] = str(seed) + torch.backends.cudnn.deterministic = not CUDNN_BENCHMARK + torch.backends.cudnn.benchmark = CUDNN_BENCHMARK + +def stable_int_from_text(text: str) -> int: + value = 0 + for byte in text.encode("utf-8"): + value = (value * 131 + byte) % (2 ** 31 - 1) + return value + +def seed_worker(worker_id: int) -> None: + del worker_id + try: # each DataLoader worker is its own process; disable NNPACK here too to kill the warning at the source + torch.backends.nnpack.enabled = False + except Exception: + pass + worker_seed = torch.initial_seed() % (2 ** 32) + random.seed(worker_seed) + np.random.seed(worker_seed) + torch.manual_seed(worker_seed) + +def make_seeded_generator(seed: int, tag: str) -> torch.Generator: + generator = torch.Generator() + generator.manual_seed(seed + stable_int_from_text(tag)) + return generator + +def cuda_memory_snapshot() -> str: + if DEVICE.type != "cuda" or not torch.cuda.is_available(): + return "allocated=0.00 GB, reserved=0.00 GB, peak=0.00 GB" + allocated = torch.cuda.memory_allocated(device=DEVICE) / (1024 ** 3) + reserved = torch.cuda.memory_reserved(device=DEVICE) / (1024 ** 3) + peak = torch.cuda.max_memory_allocated(device=DEVICE) / (1024 ** 3) + return f"allocated={allocated:.2f} GB, reserved={reserved:.2f} GB, peak={peak:.2f} GB" + +def run_cuda_cleanup(context: str | None = None) -> None: + gc.collect() + if DEVICE.type != "cuda" or not torch.cuda.is_available(): + return + try: + torch.cuda.synchronize(device=DEVICE) + except Exception: + pass + try: + torch.cuda.empty_cache() + except Exception: + pass + try: + torch.cuda.ipc_collect() + except Exception: + pass + if context is not None: + print(f"[CUDA Cleanup] {context}: {cuda_memory_snapshot()}") + try: + torch.cuda.reset_peak_memory_stats(device=DEVICE) + except Exception: + pass + +def prune_directory_except(root: Path, keep_file_names: set[str]) -> None: + if not root.exists(): + return + keep_paths = {root / name for name in keep_file_names} + for path in sorted((p for p in root.rglob("*") if p.is_file()), reverse=True): + if path not in keep_paths: + path.unlink() + for path in sorted((p for p in root.rglob("*") if p.is_dir()), reverse=True): + if path != root: + try: + path.rmdir() + except OSError: + pass + +def prune_optuna_trial_dir(trial_dir: Path) -> None: + if trial_dir.exists(): + shutil.rmtree(trial_dir, ignore_errors=True) + +def prune_optuna_study_dir(study_root: Path) -> None: + prune_directory_except(study_root, {"best_params.json", "summary.json", "study.sqlite3"}) + +def to_device(batch: Any, device: torch.device) -> Any: + if torch.is_tensor(batch): + return batch.to(device, non_blocking=True) + if isinstance(batch, dict): + return {k: to_device(v, device) for k, v in batch.items()} + if isinstance(batch, list): + return [to_device(v, device) for v in batch] + if isinstance(batch, tuple): + return tuple(to_device(v, device) for v in batch) + return batch + +def _normalized_decimal_text(value: Decimal) -> str: + normalized = value.normalize() + text = format(normalized, "f") + if "." in text: + text = text.rstrip("0").rstrip(".") + return text or "0" + +def _fraction_decimal(value: Any, *, field_name: str) -> Decimal: + if isinstance(value, bool): + raise TypeError(f"{field_name} must be a real number in (0, 1], got boolean {value!r}.") + try: + decimal_value = Decimal(str(value).strip()) + except (InvalidOperation, ValueError) as exc: + raise ValueError(f"{field_name} must be a real number in (0, 1], got {value!r}.") from exc + if not decimal_value.is_finite(): + raise ValueError(f"{field_name} must be finite, got {value!r}.") + if decimal_value <= 0 or decimal_value > 1: + raise ValueError(f"{field_name} must be in the interval (0, 1], got {value!r}.") + return decimal_value + +def _percent_decimal(value: Any, *, field_name: str = "dataset percent") -> Decimal: + return _fraction_decimal(value, field_name=field_name) * Decimal("100") + +def normalize_dataset_percents(values: list[float] | tuple[float, ...]) -> list[float]: + if not values: + raise ValueError("DATASET_PERCENTS must contain at least one fraction in (0, 1].") + normalized: dict[str, float] = {} + for value in values: + fraction = _fraction_decimal(value, field_name="DATASET_PERCENTS entry") + normalized[_normalized_decimal_text(fraction)] = float(fraction) + return [normalized[key] for key in sorted(normalized, key=Decimal)] + +def percent_label(percent: float) -> str: + return _normalized_decimal_text(_percent_decimal(percent)).replace(".", "p") + +def percent_display(percent: float) -> str: + return _normalized_decimal_text(_percent_decimal(percent)) + +def percent_text(percent: float) -> str: + return f"{percent_display(percent)}%" + + +def run_identity_parts( + *, + strategy: int | None = None, + percent: float | None = None, + trial_number: int | None = None, + split_payload: dict[str, Any] | None = None, +) -> list[str]: + parts: list[str] = [] + payload = split_payload or {} + split_generation_mode = str(payload.get("split_generation_mode", "")).strip().lower() + phase_index = payload.get("phase_index") + split_repeat_index = payload.get("split_repeat_index") + subset_repeat_index = payload.get("subset_repeat_index") + split_type = payload.get("split_type") + train_subset_variant = payload.get("train_subset_variant") + + if phase_index is not None or split_generation_mode == "fixed_stratified_phases_8_1_1": + effective_phase_index = phase_index if phase_index is not None else split_repeat_index + if effective_phase_index is not None: + parts.append(f"phase={int(effective_phase_index):03d}") + elif split_repeat_index is not None: + parts.append(f"split={int(split_repeat_index):03d}") + elif split_type is not None: + parts.append(f"split={split_type}") + + if subset_repeat_index is not None: + parts.append(f"repeat={int(subset_repeat_index):02d}") + elif train_subset_variant is not None and int(train_subset_variant) > 0: + parts.append(f"variant={int(train_subset_variant):02d}") + + if strategy is not None: + parts.append(f"strategy={int(strategy)}") + + effective_percent = percent + if effective_percent is None and payload.get("dataset_percent") is not None: + effective_percent = float(payload["dataset_percent"]) + if effective_percent is not None: + parts.append(f"pct={percent_text(float(effective_percent))}") + + if trial_number is not None: + parts.append(f"trial={int(trial_number):03d}") + + return parts + + +def run_identity_label( + *, + strategy: int | None = None, + percent: float | None = None, + trial_number: int | None = None, + split_payload: dict[str, Any] | None = None, +) -> str: + parts = run_identity_parts( + strategy=strategy, + percent=percent, + trial_number=trial_number, + split_payload=split_payload, + ) + return " | ".join(parts) if parts else "run" + + +def run_identity_slug( + *, + strategy: int | None = None, + percent: float | None = None, + trial_number: int | None = None, + split_payload: dict[str, Any] | None = None, +) -> str: + payload = split_payload or {} + parts: list[str] = [] + split_generation_mode = str(payload.get("split_generation_mode", "")).strip().lower() + phase_index = payload.get("phase_index") + split_repeat_index = payload.get("split_repeat_index") + subset_repeat_index = payload.get("subset_repeat_index") + split_type = payload.get("split_type") + train_subset_variant = payload.get("train_subset_variant") + + if phase_index is not None or split_generation_mode == "fixed_stratified_phases_8_1_1": + effective_phase_index = phase_index if phase_index is not None else split_repeat_index + if effective_phase_index is not None: + parts.append(f"phase_{int(effective_phase_index):03d}") + elif split_repeat_index is not None: + parts.append(f"split_{int(split_repeat_index):03d}") + elif split_type is not None: + parts.append(f"split_{str(split_type)}") + + if subset_repeat_index is not None: + parts.append(f"repeat_{int(subset_repeat_index):02d}") + elif train_subset_variant is not None and int(train_subset_variant) > 0: + parts.append(f"variant_{int(train_subset_variant):02d}") + + if strategy is not None: + parts.append(f"strategy_{int(strategy)}") + + effective_percent = percent + if effective_percent is None and payload.get("dataset_percent") is not None: + effective_percent = float(payload["dataset_percent"]) + if effective_percent is not None: + parts.append(f"pct_{percent_label(float(effective_percent))}") + + if trial_number is not None: + parts.append(f"trial_{int(trial_number):03d}") + + return "__".join(parts) if parts else "run" + + +def current_dataset_name() -> str: + dataset_name = str(DATASET_NAME).strip() + if dataset_name not in SUPPORTED_DATASET_NAMES: + raise ValueError(f"DATASET_NAME must be one of {SUPPORTED_DATASET_NAMES}, got {dataset_name!r}") + return dataset_name + +def current_busi_with_classes_split_policy() -> str: + split_policy = str(BUSI_WITH_CLASSES_SPLIT_POLICY).strip().lower() + if split_policy not in SUPPORTED_BUSI_WITH_CLASSES_SPLIT_POLICIES: + raise ValueError( + f"BUSI_WITH_CLASSES_SPLIT_POLICY must be one of {SUPPORTED_BUSI_WITH_CLASSES_SPLIT_POLICIES}, " + f"got {split_policy!r}" + ) + return split_policy + +def current_dataset_splits_json_path() -> Path: + dataset_name = current_dataset_name() + if dataset_name == "BUSI": + return DATASET_SPLITS_JSON + return PROJECT_DIR / f"dataset_splits_{dataset_name.lower()}_{current_busi_with_classes_split_policy()}.json" + +def current_dataset_dirs() -> tuple[Path, Path]: + dataset_name = current_dataset_name() + if dataset_name == "BUSI": + return DATA_ROOT / "images", DATA_ROOT / "annotations" + return DATA_ROOT / "all_images", DATA_ROOT / "all_masks" + +def current_pipeline_check_path() -> Path | None: + if current_dataset_name() != "BUSI_with_classes": + return None + return DATA_ROOT / "pipeline_check.json" + +def normalization_cache_tag() -> str: + dataset_name = current_dataset_name() + if dataset_name == "BUSI": + return "BUSI" + return f"{dataset_name}_{current_busi_with_classes_split_policy()}" + +def resolve_amp_dtype(key: str) -> torch.dtype: + key = key.lower().strip() + if key == "auto": + if DEVICE.type == "cuda": + try: + if torch.cuda.is_bf16_supported(): + return torch.bfloat16 + except Exception: + major, _minor = torch.cuda.get_device_capability() + if major >= 8: + return torch.bfloat16 + return torch.float16 + if key in {"float16", "fp16", "half"}: + return torch.float16 + if key in {"bfloat16", "bf16"}: + if DEVICE.type == "cuda": + try: + if torch.cuda.is_bf16_supported(): + return torch.bfloat16 + except Exception: + major, _minor = torch.cuda.get_device_capability() + if major >= 8: + return torch.bfloat16 + print("[AMP] bfloat16 requested but unsupported here. Falling back to float16.") + return torch.float16 + raise ValueError(f"Unsupported AMP_DTYPE: {key}") + +def amp_autocast_enabled(device: torch.device) -> bool: + return USE_AMP and device.type in {"cuda", "mps"} + +def autocast_ctx(enabled: bool, device: torch.device, amp_dtype: torch.dtype): + if not enabled: + return nullcontext() + return torch.autocast(device_type=device.type, dtype=amp_dtype, enabled=True) + +def make_grad_scaler(enabled: bool, amp_dtype: torch.dtype, device: torch.device): + if not enabled or device.type != "cuda" or amp_dtype == torch.bfloat16: + return None + try: + return torch.amp.GradScaler("cuda", enabled=True, init_scale=8192.0) + except Exception: + return torch.cuda.amp.GradScaler(enabled=True, init_scale=8192.0) + +def format_seconds(seconds: float) -> str: + seconds = int(seconds) + h, rem = divmod(seconds, 3600) + m, s = divmod(rem, 60) + return f"{h:02d}:{m:02d}:{s:02d}" + +def tensor_bytes(t: torch.Tensor) -> int: + return t.numel() * t.element_size() + +def bytes_to_gb(num_bytes: int) -> float: + return num_bytes / (1024 ** 3) + +def set_current_job_params(payload: dict[str, Any] | None = None) -> None: + CURRENT_JOB_PARAMS.clear() + if payload: + CURRENT_JOB_PARAMS.update(dict(payload)) + +def _job_param(name: str, default: Any) -> Any: + return CURRENT_JOB_PARAMS.get(name, default) + +def _alpha_log_floor() -> float: + return math.log(max(float(_job_param("min_alpha", math.exp(-5.0))), 1e-6)) + +def _keep_action_index(action_count: int) -> int: + action_count = max(int(action_count), 1) + if action_count >= 3: + return action_count // 2 + return action_count - 1 + +def _strategy3_variant() -> str: + raw = str(_job_param("strategy3_variant", DEFAULT_STRATEGY3_VARIANT)).strip().lower() + return raw or DEFAULT_STRATEGY3_VARIANT + +def _strategy3_annealed_weight( + base_weight: float, + *, + current_epoch: int, + anneal_start_epoch: int = 1, + anneal_epochs: int, +) -> float: + base_weight = float(base_weight) + if base_weight <= 0.0: + return 0.0 + anneal_start_epoch = max(int(anneal_start_epoch), 1) + anneal_epochs = max(int(anneal_epochs), 0) + if current_epoch < anneal_start_epoch: + return 0.0 + if anneal_epochs <= 0: + return base_weight + progress = min( + max((float(current_epoch) - float(anneal_start_epoch)) / float(anneal_epochs), 0.0), + 1.0, + ) + floor_fraction = float( + _job_param( + "strategy3_aux_ce_floor_fraction", + DEFAULT_STRATEGY3_AUX_CE_FLOOR_FRACTION, + ) + ) + floor_fraction = min(max(floor_fraction, 0.0), 1.0) + fraction = max(1.0 - progress, floor_fraction) + return base_weight * fraction + +def _strategy3_annealed_aux_ce_weight(current_epoch: int) -> float: + return _strategy3_annealed_weight( + float(_job_param("strategy3_aux_ce_weight", DEFAULT_STRATEGY3_AUX_CE_WEIGHT)), + current_epoch=int(current_epoch), + anneal_start_epoch=int( + _job_param( + "strategy3_aux_ce_anneal_start_epoch", + DEFAULT_STRATEGY3_AUX_CE_ANNEAL_START_EPOCH, + ) + ), + anneal_epochs=int( + _job_param( + "strategy3_aux_ce_anneal_epochs", + DEFAULT_STRATEGY3_AUX_CE_ANNEAL_EPOCHS, + ) + ), + ) + +def _strategy3_exploration_eps(current_epoch: int) -> float: + base_eps = max(float(_job_param("strategy3_exploration_eps", DEFAULT_EXPLORATION_EPS)), 0.0) + decay_epochs = max(int(_job_param("strategy3_exploration_eps_epochs", EXPLORATION_EPS_EPOCHS)), 0) + if base_eps <= 0.0: + return 0.0 + if decay_epochs <= 0: + return base_eps + progress = min(max((float(current_epoch) - 1.0) / float(decay_epochs), 0.0), 1.0) + return base_eps * (1.0 - progress) + +def _bootstrap_value_target(model: nn.Module, value_next: torch.Tensor) -> torch.Tensor: + neighborhood_value = getattr(model, "neighborhood_value", None) + if callable(neighborhood_value): + return neighborhood_value(value_next) + return value_next + +def _strategy3_delta_max() -> float: + return float(_job_param("strategy3_delta_max", DEFAULT_STRATEGY3_DELTA_MAX)) + +def _strategy3_policy_delta(policy_raw: torch.Tensor) -> torch.Tensor: + return torch.tanh(policy_raw.float()) * _strategy3_delta_max() + +def _strategy3_apply_delta(seg: torch.Tensor, delta: torch.Tensor) -> torch.Tensor: + seg_f = seg.float() + delta_f = delta.float() + return (seg_f + delta_f).clamp(0.0, 1.0).to(dtype=seg.dtype) + +def _strategy3_advantage_normalize_enabled() -> bool: + return bool(_job_param("strategy3_advantage_normalize", DEFAULT_STRATEGY3_ADVANTAGE_NORMALIZE)) + +def _normalize_strategy3_advantage_map(advantage_map: torch.Tensor) -> torch.Tensor: + if not _strategy3_advantage_normalize_enabled(): + return advantage_map + if advantage_map.ndim < 4: + mean = advantage_map.mean() + std = advantage_map.std(unbiased=False) + return (advantage_map - mean) / (std + 1e-6) + mean = advantage_map.mean(dim=(2, 3), keepdim=True) + std = advantage_map.std(dim=(2, 3), unbiased=False, keepdim=True) + return (advantage_map - mean) / (std + 1e-6) + +def _strategy3_actor_advantage( + reward_map: torch.Tensor, + value_t: torch.Tensor, + value_next: torch.Tensor, + *, + gamma: float, +) -> torch.Tensor: + advantage_map = reward_map + float(gamma) * value_next.detach() - value_t.detach() + return _normalize_strategy3_advantage_map(advantage_map) + +def _strategy3_critic_target( + reward_map: torch.Tensor, + value_next: torch.Tensor, + *, + gamma: float, +) -> torch.Tensor: + return reward_map.detach() + float(gamma) * value_next.detach() + +def _strategy3_delta_distribution(delta_map: torch.Tensor) -> dict[str, float]: + delta_f = delta_map.detach().float() + abs_delta = delta_f.abs() + return { + "mean_delta": float(delta_f.mean().item()), + "mean_abs_delta": float(abs_delta.mean().item()), + "positive_pct": float((delta_f > 1e-6).float().mean().item() * 100.0), + "negative_pct": float((delta_f < -1e-6).float().mean().item() * 100.0), + "near_zero_pct": float((abs_delta <= 1e-6).float().mean().item() * 100.0), + "max_abs_delta": float(abs_delta.max().item()), + } + +def _bernoulli_predictive_entropy(prob: torch.Tensor) -> torch.Tensor: + prob_f = prob.float().clamp(1e-6, 1.0 - 1e-6) + return -(prob_f * torch.log(prob_f) + (1.0 - prob_f) * torch.log1p(-prob_f)) + +def _iter_strategy3_dropout_modules(model: nn.Module) -> Iterator[nn.Module]: + for module in _unwrap_compiled(model).modules(): + if isinstance(module, (nn.Dropout, nn.Dropout2d)): + yield module + +# --- MC (Monte-Carlo dropout uncertainty) removed. These are inert stubs kept only so the +# --- shared validate/evaluate/train logging interface still resolves. No MC compute/cache. +def _strategy3_reset_mc_cache_stats(model: nn.Module) -> None: + return None + +def _strategy3_get_mc_cache_stats(model: nn.Module) -> dict[str, int]: + return {"ram_hits": 0, "disk_hits": 0, "misses": 0, "writes": 0} + +def _strategy3_bump_mc_cache_fingerprint(model: nn.Module, **kwargs) -> str: + return "" + + + + + + + + + + + + + + + + + + + + + + + +def _require_supported_strategy(strategy: int) -> int: + strategy = int(strategy) + if strategy not in SUPPORTED_STRATEGIES: + raise ValueError( + f"Unsupported strategy {strategy}. Supported strategies are {list(SUPPORTED_STRATEGIES)}." + ) + return strategy + +def _resolve_checkpoint_metric_name(metric_name: Any, *, strategy: int) -> str: + if not isinstance(metric_name, str) or not metric_name.strip(): + raise KeyError( + f"No best-checkpoint metric configured for strategy {strategy}. " + f"Set BEST_CHECKPOINT_METRICS[{strategy}] or best_checkpoint_metric_name to a non-empty metric name." + ) + metric_name = metric_name.strip() + if metric_name not in SUPPORTED_CHECKPOINT_METRICS: + raise KeyError( + f"Unsupported best-checkpoint metric {metric_name!r} for strategy {strategy}. " + f"Supported metrics: {sorted(SUPPORTED_CHECKPOINT_METRICS)}." + ) + return metric_name + +def _strategy_selection_metric_name(strategy: int) -> str: + strategy = _require_supported_strategy(strategy) + metric_name = _job_param( + f"strategy{strategy}_best_checkpoint_metric_name", + _job_param("best_checkpoint_metric_name", BEST_CHECKPOINT_METRICS.get(strategy)), + ) + return _resolve_checkpoint_metric_name(metric_name, strategy=strategy) + +def _strategy_selection_metric_value(strategy: int, metrics: dict[str, Any]) -> float: + metric_name = _strategy_selection_metric_name(strategy) + value = metrics.get(metric_name) + if value is None: + raise KeyError( + f"Configured best-checkpoint metric {metric_name!r} for strategy {strategy} " + f"is missing from metrics payload keys={sorted(metrics.keys())}." + ) + return float(value) + +def _early_stopping_monitor_name(strategy: int) -> str: + raw = str(_job_param("early_stopping_monitor", DEFAULT_EARLY_STOPPING_MONITOR)).strip() + if not raw or raw.lower() == "auto": + return _strategy_selection_metric_name(strategy) + return raw + +def _early_stopping_mode(strategy: int, monitor_name: str | None = None) -> str: + raw = str(_job_param("early_stopping_mode", DEFAULT_EARLY_STOPPING_MODE)).strip().lower() + if raw in {"min", "max"}: + return raw + if raw != "auto": + raise ValueError(f"Unsupported early_stopping_mode={raw!r}. Expected 'auto', 'min', or 'max'.") + monitor_name = monitor_name or _early_stopping_monitor_name(strategy) + lowered = monitor_name.lower() + if "loss" in lowered or lowered.startswith("hd") or lowered.endswith("error"): + return "min" + return "max" + +def _early_stopping_min_delta() -> float: + return max(float(_job_param("early_stopping_min_delta", DEFAULT_EARLY_STOPPING_MIN_DELTA)), 0.0) + +def _early_stopping_start_epoch() -> int: + return max(int(_job_param("early_stopping_start_epoch", DEFAULT_EARLY_STOPPING_START_EPOCH)), 1) + +def _early_stopping_patience() -> int: + return max(int(_job_param("early_stopping_patience", EARLY_STOPPING_PATIENCE)), 0) + +def _early_stopping_monitor_value( + metrics: dict[str, Any], + *, + strategy: int, + monitor_name: str, +) -> float | None: + value = metrics.get(monitor_name) + if value is None and monitor_name == _strategy_selection_metric_name(strategy): + value = _strategy_selection_metric_value(strategy, metrics) + if value is None: + return None + return float(value) + +def _early_stopping_improved( + current_value: float, + best_value: float | None, + *, + mode: str, + min_delta: float, +) -> bool: + if best_value is None: + return True + if mode == "min": + return current_value < (best_value - min_delta) + if mode == "max": + return current_value > (best_value + min_delta) + raise ValueError(f"Unsupported early stopping comparison mode: {mode!r}") + +def _strategy3_requested_bootstrap_freeze() -> bool: + return bool( + _job_param( + "strategy3_freeze_bootstrapped_segmentation", + DEFAULT_STRATEGY3_FREEZE_BOOTSTRAPPED_SEGMENTATION, + ) + ) + +def _module_freeze_state(module: nn.Module | None) -> str: + if not isinstance(module, nn.Module): + return "n/a" + requires_grad_flags = [bool(param.requires_grad) for param in module.parameters()] + if not requires_grad_flags: + return "n/a" + if all(not flag for flag in requires_grad_flags): + return "frozen" + if all(requires_grad_flags): + return "trainable" + return "mixed" + +def _strategy3_bootstrap_freeze_status(model: nn.Module) -> dict[str, Any]: + raw = _raw_decoder_rl_model(model) + status = { + "bootstrap_loaded": False, + "freeze_requested": False, + "freeze_active": False, + "encoder_state": "n/a", + "decoder_state": "n/a", + "segmentation_head_state": "n/a", + } + if raw is None: + return status + + status["bootstrap_loaded"] = bool(getattr(raw, "strategy2_bootstrap_loaded", False)) + status["freeze_requested"] = bool(getattr(raw, "freeze_bootstrapped_segmentation", False)) + smp_model = getattr(raw, "smp_model", None) + if smp_model is not None: + status["encoder_state"] = _module_freeze_state(getattr(smp_model, "encoder", None)) + status["decoder_state"] = _module_freeze_state(getattr(smp_model, "decoder", None)) + status["segmentation_head_state"] = _module_freeze_state(getattr(smp_model, "segmentation_head", None)) + else: + status["encoder_state"] = _module_freeze_state(getattr(raw, "encoder", None)) + status["segmentation_head_state"] = _module_freeze_state(getattr(raw, "segmentation_head", None)) + + relevant_states = [ + state + for state in ( + status["encoder_state"], + status["decoder_state"], + status["segmentation_head_state"], + ) + if state != "n/a" + ] + status["freeze_active"] = bool( + status["bootstrap_loaded"] and relevant_states and all(state == "frozen" for state in relevant_states) + ) + return status + +def _strategy3_decoder_is_frozen(model: nn.Module) -> bool: + return bool(_strategy3_bootstrap_freeze_status(model)["freeze_active"]) + +def _strategy3_loss_weights( + model: nn.Module, + *, + ce_weight: float, + dice_weight: float, +) -> dict[str, float]: + decoder_ce_default = 0.0 if _strategy3_decoder_is_frozen(model) else float(ce_weight) + decoder_dice_default = 0.0 if _strategy3_decoder_is_frozen(model) else float(dice_weight) + return { + "decoder_ce": float(_job_param("strategy3_decoder_ce_weight", decoder_ce_default)), + "decoder_dice": float(_job_param("strategy3_decoder_dice_weight", decoder_dice_default)), + } + +def _strategy3_keep_frozen_modules_in_eval(model: nn.Module) -> None: + raw = _raw_decoder_rl_model(model) + if raw is None or not bool(_strategy3_bootstrap_freeze_status(model)["freeze_active"]): + return + smp_model = getattr(raw, "smp_model", None) + if smp_model is not None: + module_names = ("encoder", "decoder", "segmentation_head") + module_root = smp_model + else: + module_names = ("encoder", "segmentation_head") + module_root = raw + for module_name in module_names: + module = getattr(module_root, module_name, None) + if isinstance(module, nn.Module): + module.eval() + +def _strategy3_apply_rollout_step( + seg: torch.Tensor, + actions: torch.Tensor, + *, + num_actions: int | None = None, +) -> torch.Tensor: + return apply_actions( + seg, + actions, + num_actions=int(num_actions if num_actions is not None else _job_param("num_actions", DEFAULT_STRATEGY3_NUM_ACTIONS)), + ).to(dtype=seg.dtype) + +def _refinement_deltas( + *, + action_count: int, + device: torch.device, + dtype: torch.dtype, +) -> torch.Tensor: + small = float(_job_param("refine_delta_small", DEFAULT_REFINE_DELTA_SMALL)) + large = float(_job_param("refine_delta_large", DEFAULT_REFINE_DELTA_LARGE)) + if action_count == 3: + values = (-large, 0.0, small) + elif action_count == 4: + values = (-large, -small, 0.0, small) + elif action_count == 5: + values = (-large, -small, 0.0, small, large) + else: + raise ValueError( + f"Unsupported Strategy 3 action count {action_count}. " + "Expected one of {3, 4, 5}." + ) + return torch.tensor(values, device=device, dtype=dtype) + +def threshold_binary_mask(mask: torch.Tensor, threshold: float | None = None) -> torch.Tensor: + threshold = float(_job_param("threshold", CONTROLLED_MASK_THRESHOLD)) if threshold is None else float(threshold) + return (mask > threshold).to(dtype=mask.dtype) + +def threshold_binary_long(mask: torch.Tensor, threshold: float | None = None) -> torch.Tensor: + threshold = float(_job_param("threshold", CONTROLLED_MASK_THRESHOLD)) if threshold is None else float(threshold) + return (mask > threshold).long() + +"""============================================================================= +BUSI SPLIT + NORMALIZATION +============================================================================= +""" + +IMAGENET_MEAN = np.array([0.485, 0.456, 0.406], dtype=np.float32) +IMAGENET_STD = np.array([0.229, 0.224, 0.225], dtype=np.float32) + +def validate_image_mask_consistency(images_dir: Path, annotations_dir: Path): + image_files = {f for f in os.listdir(images_dir) if not f.startswith(".") and f.lower().endswith(".png")} + mask_files = {f for f in os.listdir(annotations_dir) if not f.startswith(".") and f.lower().endswith(".png")} + matched = sorted(image_files & mask_files) + missing_masks = sorted(image_files - mask_files) + missing_images = sorted(mask_files - image_files) + return matched, missing_masks, missing_images + +def parse_busi_with_classes_label(filename: str) -> str: + upper_name = str(filename).upper() + if upper_name.endswith("_B.PNG"): + return "benign" + if upper_name.endswith("_M.PNG"): + return "malignant" + raise ValueError( + f"BUSI_with_classes filename must end with '_B.png' or '_M.png', got {filename!r}" + ) + +def _candidate_report_dicts(payload: dict[str, Any]) -> list[dict[str, Any]]: + candidates = [payload] + for key in ("counts", "summary", "dataset", "report", "metadata"): + value = payload.get(key) + if isinstance(value, dict): + candidates.append(value) + return candidates + +def _extract_report_int(payload: dict[str, Any], keys: tuple[str, ...]) -> int | None: + for candidate in _candidate_report_dicts(payload): + for key in keys: + value = candidate.get(key) + if isinstance(value, bool): + continue + if isinstance(value, (int, np.integer)): + return int(value) + if isinstance(value, float) and float(value).is_integer(): + return int(value) + return None + +def _extract_report_filenames(payload: dict[str, Any]) -> set[str] | None: + for candidate in _candidate_report_dicts(payload): + filenames = candidate.get("filenames") + if isinstance(filenames, list) and all(isinstance(item, str) for item in filenames): + return set(filenames) + + pairs = candidate.get("pairs") + if isinstance(pairs, list): + extracted = {item["filename"] for item in pairs if isinstance(item, dict) and isinstance(item.get("filename"), str)} + if extracted: + return extracted + return None + +def validate_busi_with_classes_pipeline_report(report_path: Path, sample_records: list[dict[str, str]]) -> None: + if not report_path.exists(): + return + + payload = load_json(report_path) + if not isinstance(payload, dict): + raise RuntimeError(f"Expected dict payload in {report_path}, found {type(payload).__name__}.") + + benign_count = sum(1 for record in sample_records if record.get("class_label") == "benign") + malignant_count = sum(1 for record in sample_records if record.get("class_label") == "malignant") + expected_counts = { + "total_pairs": len(sample_records), + "benign": benign_count, + "malignant": malignant_count, + } + report_counts = { + "total_pairs": _extract_report_int(payload, ("total_pairs", "pair_count", "num_pairs", "total")), + "benign": _extract_report_int(payload, ("benign", "benign_count", "num_benign")), + "malignant": _extract_report_int(payload, ("malignant", "malignant_count", "num_malignant")), + } + for key, expected_value in expected_counts.items(): + report_value = report_counts[key] + if report_value is not None and report_value != expected_value: + raise RuntimeError( + f"pipeline_check mismatch for {key}: discovered={expected_value}, report={report_value} ({report_path})" + ) + + report_filenames = _extract_report_filenames(payload) + if report_filenames is not None: + discovered_filenames = {record["filename"] for record in sample_records} + if report_filenames != discovered_filenames: + missing_from_report = sorted(discovered_filenames - report_filenames)[:10] + extra_in_report = sorted(report_filenames - discovered_filenames)[:10] + raise RuntimeError( + f"pipeline_check filenames mismatch for {report_path}: " + f"missing_from_report={missing_from_report}, extra_in_report={extra_in_report}" + ) + + print(f"[Pipeline Check] Validated BUSI_with_classes metadata from {report_path}") + +def check_data_leakage(splits: dict[str, list[str]]) -> dict[str, list[str]]: + leaks: dict[str, list[str]] = {} + split_names = list(splits.keys()) + for i, lhs in enumerate(split_names): + for rhs in split_names[i + 1 :]: + overlap = sorted(set(splits[lhs]) & set(splits[rhs])) + if overlap: + leaks[f"{lhs} ∩ {rhs}"] = overlap + return leaks + +def _project_relative_path(path: Path) -> str: + resolved = Path(path).resolve() + try: + return str(resolved.relative_to(PROJECT_DIR.resolve())) + except ValueError: + return str(resolved) + +def resolve_dataset_root_from_registry(split_registry: dict[str, Any]) -> Path: + dataset_root = Path(split_registry["dataset_root"]) + if dataset_root.is_absolute(): + return dataset_root + return (PROJECT_DIR / dataset_root).resolve() + +def make_sample_record( + filename: str, + images_subdir: str, + annotations_subdir: str, + *, + class_label: str | None = None, +) -> dict[str, str]: + record = { + "filename": filename, + "image_rel_path": str(Path(images_subdir) / filename), + "mask_rel_path": str(Path(annotations_subdir) / filename), + } + if class_label is not None: + record["class_label"] = class_label + return record + +def build_sample_records( + filenames: list[str], + *, + images_subdir: str, + annotations_subdir: str, + dataset_name: str, +) -> list[dict[str, str]]: + records = [] + for filename in sorted(filenames): + class_label = parse_busi_with_classes_label(filename) if dataset_name == "BUSI_with_classes" else None + records.append( + make_sample_record( + filename, + images_subdir, + annotations_subdir, + class_label=class_label, + ) + ) + return records + +def split_ratios_for_type(split_type: str) -> tuple[float, float]: + if split_type == "80_10_10": + return 0.80, 0.10 + if split_type == "70_10_20": + return 0.70, 0.10 + raise ValueError(f"Unsupported split_type: {split_type}") + +def deterministic_shuffle_records(records: list[dict[str, str]], *, seed: int, tag: str) -> list[dict[str, str]]: + rng = random.Random(seed + stable_int_from_text(tag)) + shuffled = [dict(record) for record in records] + rng.shuffle(shuffled) + return shuffled + +def train_subset_variant_suffix(variant: int | None = None) -> str: + variant_value = int(TRAIN_SUBSET_VARIANT if variant is None else variant) + return "" if variant_value <= 0 else f"_variant{variant_value:02d}" + +def group_records_by_class(sample_records: list[dict[str, str]]) -> dict[str, list[dict[str, str]]]: + grouped: dict[str, list[dict[str, str]]] = {} + for record in sample_records: + class_label = record.get("class_label") + if class_label is None: + raise RuntimeError("Expected class_label in sample record for class-aware splitting.") + grouped.setdefault(class_label, []).append(dict(record)) + return grouped + +def allocate_counts_by_ratio(total_size: int, available_counts: dict[str, int]) -> dict[str, int]: + allocation = {label: 0 for label in available_counts} + if total_size <= 0 or not available_counts: + return allocation + + total_available = sum(available_counts.values()) + if total_available <= 0: + return allocation + + exact = {label: total_size * available_counts[label] / total_available for label in available_counts} + for label in available_counts: + allocation[label] = min(available_counts[label], int(math.floor(exact[label]))) + + remaining = min(total_size, total_available) - sum(allocation.values()) + order = sorted( + available_counts.keys(), + key=lambda label: (exact[label] - math.floor(exact[label]), available_counts[label], label), + reverse=True, + ) + while remaining > 0: + progressed = False + for label in order: + if allocation[label] < available_counts[label]: + allocation[label] += 1 + remaining -= 1 + progressed = True + if remaining == 0: + break + if not progressed: + break + return allocation + +def allocate_balanced_counts(total_size: int, available_counts: dict[str, int]) -> dict[str, int]: + allocation = {label: 0 for label in available_counts} + if total_size <= 0 or not available_counts: + return allocation + + labels = sorted(available_counts.keys()) + half = total_size // 2 + for label in labels: + allocation[label] = min(available_counts[label], half) + + remaining = min(total_size, sum(available_counts.values())) - sum(allocation.values()) + while remaining > 0: + candidates = [label for label in labels if allocation[label] < available_counts[label]] + if not candidates: + break + best_label = max( + candidates, + key=lambda label: ( + available_counts[label] - allocation[label], + 1 if label == "benign" else 0, + label, + ), + ) + allocation[best_label] += 1 + remaining -= 1 + return allocation + +def build_unstratified_base_split( + sample_records: list[dict[str, str]], + *, + split_type: str, + seed: int, +) -> dict[str, list[dict[str, str]]]: + train_ratio, val_ratio = split_ratios_for_type(split_type) + records = deterministic_shuffle_records(sample_records, seed=seed, tag=f"base::{split_type}") + + total_samples = len(records) + train_end = int(total_samples * train_ratio) + val_end = int(total_samples * (train_ratio + val_ratio)) + return { + "train": records[:train_end], + "val": records[train_end:val_end], + "test": records[val_end:], + } + +def build_stratified_base_split( + sample_records: list[dict[str, str]], + *, + split_type: str, + seed: int, +) -> dict[str, list[dict[str, str]]]: + train_ratio, val_ratio = split_ratios_for_type(split_type) + grouped = group_records_by_class(sample_records) + splits = {"train": [], "val": [], "test": []} + + for class_label in sorted(grouped.keys()): + records = deterministic_shuffle_records( + grouped[class_label], + seed=seed, + tag=f"base::{split_type}::{class_label}", + ) + total_samples = len(records) + train_end = int(total_samples * train_ratio) + val_end = int(total_samples * (train_ratio + val_ratio)) + splits["train"].extend(records[:train_end]) + splits["val"].extend(records[train_end:val_end]) + splits["test"].extend(records[val_end:]) + + for split_name in splits: + splits[split_name] = deterministic_shuffle_records( + splits[split_name], + seed=seed, + tag=f"base::{split_type}::{split_name}", + ) + return splits + +def build_balanced_train_base_split( + sample_records: list[dict[str, str]], + *, + split_type: str, + seed: int, +) -> dict[str, list[dict[str, str]]]: + train_ratio, val_ratio = split_ratios_for_type(split_type) + test_ratio = 1.0 - train_ratio - val_ratio + grouped = group_records_by_class(sample_records) + if sorted(grouped.keys()) != ["benign", "malignant"]: + raise RuntimeError( + f"balanced_train split policy expects benign/malignant classes, found {sorted(grouped.keys())}" + ) + + shuffled = { + class_label: deterministic_shuffle_records( + records, + seed=seed, + tag=f"base::{split_type}::balanced_train::{class_label}", + ) + for class_label, records in grouped.items() + } + + nominal_train_size = int(len(sample_records) * train_ratio) + per_class_train = min( + nominal_train_size // 2, + *(len(records) for records in shuffled.values()), + ) + + train_records: list[dict[str, str]] = [] + remaining_by_class: dict[str, list[dict[str, str]]] = {} + for class_label in sorted(shuffled.keys()): + records = shuffled[class_label] + train_records.extend(records[:per_class_train]) + remaining_by_class[class_label] = records[per_class_train:] + + remainder_val_fraction = val_ratio / max(val_ratio + test_ratio, 1e-8) + val_records: list[dict[str, str]] = [] + test_records: list[dict[str, str]] = [] + for class_label in sorted(remaining_by_class.keys()): + records = remaining_by_class[class_label] + val_count = int(len(records) * remainder_val_fraction) + val_records.extend(records[:val_count]) + test_records.extend(records[val_count:]) + + return { + "train": deterministic_shuffle_records( + train_records, + seed=seed, + tag=f"base::{split_type}::balanced_train::train", + ), + "val": deterministic_shuffle_records( + val_records, + seed=seed, + tag=f"base::{split_type}::balanced_train::val", + ), + "test": deterministic_shuffle_records( + test_records, + seed=seed, + tag=f"base::{split_type}::balanced_train::test", + ), + } + +def build_nested_train_subsets( + train_records: list[dict[str, str]], + train_fractions: list[float], + *, + split_type: str, + seed: int, + split_policy: str | None = None, + subset_variant: int = 0, +) -> dict[str, list[dict[str, str]]]: + if not train_records: + return {} + + variant_tag = "" if int(subset_variant) <= 0 else f"::variant::{int(subset_variant)}" + ordered_records = deterministic_shuffle_records(train_records, seed=seed, tag=f"subset::{split_type}{variant_tag}") + use_class_labels = any("class_label" in record for record in train_records) + if not use_class_labels: + subsets: dict[str, list[dict[str, str]]] = {} + for fraction in normalize_dataset_percents(train_fractions): + if fraction <= 0.0 or fraction > 1.0: + raise ValueError(f"Invalid training fraction: {fraction}") + subset_key = percent_label(fraction) + subset_size = len(ordered_records) if fraction >= 1.0 else max(1, int(len(ordered_records) * fraction)) + subsets[subset_key] = [dict(record) for record in ordered_records[:subset_size]] + return subsets + + grouped = { + class_label: deterministic_shuffle_records( + records, + seed=seed, + tag=f"subset::{split_type}::{split_policy or 'stratified'}::{class_label}{variant_tag}", + ) + for class_label, records in group_records_by_class(train_records).items() + } + available_counts = {class_label: len(records) for class_label, records in grouped.items()} + + subsets: dict[str, list[dict[str, str]]] = {} + for fraction in normalize_dataset_percents(train_fractions): + if fraction <= 0.0 or fraction > 1.0: + raise ValueError(f"Invalid training fraction: {fraction}") + subset_key = percent_label(fraction) + subset_size = len(ordered_records) if fraction >= 1.0 else max(1, int(len(ordered_records) * fraction)) + if split_policy == "balanced_train": + class_counts = allocate_balanced_counts(subset_size, available_counts) + else: + class_counts = allocate_counts_by_ratio(subset_size, available_counts) + + subset_records: list[dict[str, str]] = [] + for class_label in sorted(grouped.keys()): + subset_records.extend([dict(record) for record in grouped[class_label][: class_counts[class_label]]]) + subsets[subset_key] = deterministic_shuffle_records( + subset_records, + seed=seed, + tag=f"subset::{split_type}::{split_policy or 'stratified'}::{subset_key}{variant_tag}", + ) + return subsets + +def train_fraction_from_subset_key(subset_key: str) -> float: + subset_text = str(subset_key).strip().lower() + if not subset_text: + raise RuntimeError(f"Invalid train subset key {subset_key!r} in dataset_splits.json.") + try: + percent = Decimal(subset_text.replace("p", ".")) + except InvalidOperation as exc: + raise RuntimeError(f"Invalid train subset key {subset_key!r} in dataset_splits.json.") from exc + if not percent.is_finite() or percent <= 0 or percent > 100: + raise RuntimeError(f"Train subset key {subset_key!r} must represent a percentage in the range (0, 100].") + return float(percent / Decimal("100")) + +def validate_persisted_split_no_leakage(split_type: str, split_entry: dict[str, Any], *, source: str) -> None: + base_splits = split_entry["base_splits"] + base_filenames: dict[str, list[str]] = {} + for split_name, records in base_splits.items(): + filenames = [record["filename"] for record in records] + if len(filenames) != len(set(filenames)): + raise RuntimeError(f"Duplicate filenames detected inside {split_name} for split_type={split_type}.") + base_filenames[split_name] = filenames + + leaks = check_data_leakage(base_filenames) + if leaks: + raise RuntimeError(f"Data leakage detected for split_type={split_type}: {list(leaks.keys())}") + + base_train = set(base_filenames["train"]) + previous_subset: set[str] = set() + for subset_key in sorted(split_entry["train_subsets"].keys(), key=train_fraction_from_subset_key): + subset_filenames = [record["filename"] for record in split_entry["train_subsets"][subset_key]] + if len(subset_filenames) != len(set(subset_filenames)): + raise RuntimeError( + f"Duplicate filenames detected inside train subset {subset_key} for split_type={split_type}." + ) + subset_set = set(subset_filenames) + missing = sorted(subset_set - base_train) + if missing: + raise RuntimeError( + f"Train subset {subset_key} contains files outside the base train split for split_type={split_type}." + ) + if previous_subset and not previous_subset.issubset(subset_set): + raise RuntimeError( + f"Train subsets are not nested for split_type={split_type}." + ) + previous_subset = subset_set + + print(f"[Split Check] No data leakage detected for split_type={split_type} ({source}).") + +def repair_persisted_train_subsets( + split_registry: dict[str, Any], + requested_train_fractions: list[float], + *, + split_json_path: Path, + seed: int, +) -> bool: + split_entries = split_registry.get("split_types", {}) + requested_fractions = normalize_dataset_percents(requested_train_fractions) + combined_fractions = {float(value) for value in split_registry.get("train_fractions", [])} + combined_fractions.update(requested_fractions) + dataset_name = str(split_registry.get("dataset_name", "BUSI")) + split_policy = split_registry.get("split_policy") if dataset_name == "BUSI_with_classes" else None + + for split_type in SUPPORTED_SPLIT_TYPES: + split_entry = split_entries[split_type] + train_subsets = split_entry.get("train_subsets", {}) + for subset_key in train_subsets.keys(): + combined_fractions.add(train_fraction_from_subset_key(subset_key)) + + combined_fractions_list = normalize_dataset_percents(list(combined_fractions)) + requested_keys = {percent_label(fraction) for fraction in requested_fractions} + registry_seed = int(split_registry.get("seed", seed)) + repaired = False + + if split_registry.get("train_fractions") != combined_fractions_list: + split_registry["train_fractions"] = combined_fractions_list + repaired = True + + for split_type in SUPPORTED_SPLIT_TYPES: + split_entry = split_entries[split_type] + train_subsets = split_entry.get("train_subsets", {}) + missing_requested_keys = sorted(requested_keys - set(train_subsets.keys()), key=train_fraction_from_subset_key) + if not missing_requested_keys: + continue + + split_entry["train_subsets"] = build_nested_train_subsets( + split_entry["base_splits"]["train"], + combined_fractions_list, + split_type=split_type, + seed=registry_seed, + split_policy=split_policy, + ) + print( + f"[Splits] Rebuilt missing train subsets {missing_requested_keys} " + f"for split_type={split_type} in {split_json_path}" + ) + repaired = True + + if repaired: + save_json(split_json_path, split_registry) + print(f"[Splits] Updated persisted dataset splits at {split_json_path}") + return repaired + +def load_or_create_dataset_splits( + images_dir: Path, + annotations_dir: Path, + split_json_path: Path, + train_fractions: list[float], + seed: int, +) -> tuple[dict[str, Any], str]: + train_fractions = normalize_dataset_percents(train_fractions) + images_dir = Path(images_dir).resolve() + annotations_dir = Path(annotations_dir).resolve() + split_json_path = Path(split_json_path).resolve() + dataset_name = current_dataset_name() + split_policy = current_busi_with_classes_split_policy() if dataset_name == "BUSI_with_classes" else None + if split_json_path.exists(): + split_registry = load_json(split_json_path) + if split_registry.get("version") != DATASET_SPLITS_VERSION: + raise RuntimeError( + f"Unsupported dataset_splits.json version in {split_json_path}. " + f"Expected version={DATASET_SPLITS_VERSION}." + ) + persisted_dataset_name = str(split_registry.get("dataset_name", "BUSI")) + if persisted_dataset_name != dataset_name: + raise RuntimeError( + f"dataset_splits.json at {split_json_path} targets dataset_name={persisted_dataset_name!r}, " + f"but current DATASET_NAME={dataset_name!r}." + ) + persisted_split_policy = split_registry.get("split_policy") + if dataset_name == "BUSI_with_classes" and persisted_split_policy != split_policy: + raise RuntimeError( + f"dataset_splits.json at {split_json_path} targets split_policy={persisted_split_policy!r}, " + f"but current BUSI_WITH_CLASSES_SPLIT_POLICY={split_policy!r}." + ) + split_entries = split_registry.get("split_types") + if not isinstance(split_entries, dict): + raise RuntimeError(f"Invalid split_types payload in {split_json_path}.") + for split_type in SUPPORTED_SPLIT_TYPES: + if split_type not in split_entries: + raise RuntimeError( + f"dataset_splits.json is missing split_type={split_type}. Delete it to regenerate cleanly." + ) + repaired = repair_persisted_train_subsets( + split_registry, + train_fractions, + split_json_path=split_json_path, + seed=seed, + ) + source = "repaired" if repaired else "loaded" + if dataset_name == "BUSI_with_classes": + sample_records = build_sample_records( + validate_image_mask_consistency(images_dir, annotations_dir)[0], + images_subdir=split_registry["images_subdir"], + annotations_subdir=split_registry["annotations_subdir"], + dataset_name=dataset_name, + ) + pipeline_check_path = current_pipeline_check_path() + if pipeline_check_path is not None: + validate_busi_with_classes_pipeline_report(pipeline_check_path, sample_records) + for split_type in SUPPORTED_SPLIT_TYPES: + validate_persisted_split_no_leakage(split_type, split_entries[split_type], source=source) + if repaired: + print(f"[Splits] Loaded and repaired persisted dataset splits from {split_json_path}") + else: + print(f"[Splits] Loaded persisted dataset splits from {split_json_path}") + return split_registry, source + + matched, missing_masks, missing_images = validate_image_mask_consistency(images_dir, annotations_dir) + if missing_masks or missing_images: + raise RuntimeError( + "BUSI image/mask mismatch detected. " + f"missing_masks={len(missing_masks)}, missing_images={len(missing_images)}" + ) + + dataset_root = images_dir.parent.resolve() + images_subdir = images_dir.relative_to(dataset_root).as_posix() + annotations_subdir = annotations_dir.relative_to(dataset_root).as_posix() + sample_records = build_sample_records( + matched, + images_subdir=images_subdir, + annotations_subdir=annotations_subdir, + dataset_name=dataset_name, + ) + if dataset_name == "BUSI_with_classes": + pipeline_check_path = current_pipeline_check_path() + if pipeline_check_path is not None: + validate_busi_with_classes_pipeline_report(pipeline_check_path, sample_records) + split_registry = { + "version": DATASET_SPLITS_VERSION, + "dataset_name": dataset_name, + "split_policy": split_policy, + "dataset_root": _project_relative_path(dataset_root), + "images_subdir": images_subdir, + "annotations_subdir": annotations_subdir, + "seed": seed, + "train_fractions": list(train_fractions), + "split_types": {}, + } + + for split_type in SUPPORTED_SPLIT_TYPES: + if dataset_name == "BUSI_with_classes": + if split_policy == "balanced_train": + base_splits = build_balanced_train_base_split( + sample_records, + split_type=split_type, + seed=seed, + ) + else: + base_splits = build_stratified_base_split( + sample_records, + split_type=split_type, + seed=seed, + ) + else: + base_splits = build_unstratified_base_split( + sample_records, + split_type=split_type, + seed=seed, + ) + train_subsets = build_nested_train_subsets( + base_splits["train"], + train_fractions, + split_type=split_type, + seed=seed, + split_policy=split_policy, + ) + split_entry = { + "split_type": split_type, + "base_splits": base_splits, + "train_subsets": train_subsets, + } + validate_persisted_split_no_leakage(split_type, split_entry, source="created") + split_registry["split_types"][split_type] = split_entry + + save_json(split_json_path, split_registry) + print(f"[Splits] Created persisted dataset splits at {split_json_path}") + return split_registry, "created" + +def select_persisted_split( + split_registry: dict[str, Any], + split_type: str, + train_fraction: float, +) -> dict[str, Any]: + if split_type not in SUPPORTED_SPLIT_TYPES: + raise ValueError(f"Unsupported split_type: {split_type}") + + split_entries = split_registry.get("split_types", {}) + if split_type not in split_entries: + raise KeyError( + f"Requested split_type={split_type} is not available in dataset_splits.json. " + "Delete the JSON file to regenerate it with the new configuration." + ) + + subset_key = percent_label(train_fraction) + split_entry = split_entries[split_type] + train_subsets = split_entry.get("train_subsets", {}) + if subset_key not in train_subsets: + raise KeyError( + f"Requested train fraction={train_fraction} (key={subset_key}) is not available in dataset_splits.json." + ) + + return { + "dataset_root": resolve_dataset_root_from_registry(split_registry), + "split_type": split_type, + "train_fraction": float(train_fraction), + "train_subset_key": subset_key, + "train_subset_variant": 0, + "train_subset_source": "persisted", + "base_train_records": split_entry["base_splits"]["train"], + "train_records": train_subsets[subset_key], + "val_records": split_entry["base_splits"]["val"], + "test_records": split_entry["base_splits"]["test"], + } + +def apply_train_subset_variant( + selected_split: dict[str, Any], + split_registry: dict[str, Any], + *, + subset_variant: int, +) -> dict[str, Any]: + variant = int(subset_variant) + if variant <= 0 or float(selected_split["train_fraction"]) >= 1.0: + return selected_split + + split_policy = split_registry.get("split_policy") if current_dataset_name() == "BUSI_with_classes" else None + variant_subsets = build_nested_train_subsets( + selected_split["base_train_records"], + [float(selected_split["train_fraction"])], + split_type=str(selected_split["split_type"]), + seed=int(split_registry.get("seed", SEED)), + split_policy=split_policy, + subset_variant=variant, + ) + subset_key = str(selected_split["train_subset_key"]) + updated_split = dict(selected_split) + updated_split["train_records"] = variant_subsets[subset_key] + updated_split["train_subset_variant"] = variant + updated_split["train_subset_source"] = "variant_override" + return updated_split + +def export_selected_split_manifest( + pct_root: Path, + *, + percent: float, + split_source: str, + selected_split: dict[str, Any], +) -> Path: + variant_suffix = train_subset_variant_suffix(int(selected_split.get("train_subset_variant", 0))) + manifest_path = pct_root / ( + f"selected_split_{selected_split['split_type']}_{percent_label(percent)}pct{variant_suffix}.json" + ) + payload = { + "dataset_name": current_dataset_name(), + "dataset_root": str(Path(selected_split["dataset_root"]).resolve()), + "dataset_percent": float(percent), + "dataset_percent_label": percent_label(percent), + "split_source": split_source, + "split_type": str(selected_split["split_type"]), + "train_fraction": float(selected_split["train_fraction"]), + "train_subset_key": str(selected_split["train_subset_key"]), + "train_subset_variant": int(selected_split.get("train_subset_variant", 0)), + "train_subset_source": str(selected_split.get("train_subset_source", "persisted")), + "selected_split_manifest_path": str(manifest_path.resolve()), + "base_train_records": [dict(record) for record in selected_split["base_train_records"]], + "train_records": [dict(record) for record in selected_split["train_records"]], + "val_records": [dict(record) for record in selected_split["val_records"]], + "test_records": [dict(record) for record in selected_split["test_records"]], + } + save_json(manifest_path, payload) + return manifest_path + +def compute_busi_statistics( + dataset_root: Path, + sample_records: list[dict[str, str]], + cache_path: Path, +) -> tuple[float, float, str]: + filenames = [record["filename"] for record in sample_records] + if cache_path.exists(): + stats = load_json(cache_path) + if stats.get("filenames") == filenames: + print(f"[Normalization] Loaded cached normalization stats from {cache_path}") + return float(stats["global_mean"]), float(stats["global_std"]), "loaded_from_cache" + + total_sum = np.float64(0.0) + total_sq_sum = np.float64(0.0) + total_pixels = 0 + + for record in tqdm(sample_records, desc="Computing BUSI train mean/std", leave=False): + image_path = dataset_root / record["image_rel_path"] + img = np.array(PILImage.open(image_path)).astype(np.float64) + total_sum += img.sum() + total_sq_sum += (img ** 2).sum() + total_pixels += img.size + + global_mean = float(total_sum / total_pixels) + global_std = float(np.sqrt(total_sq_sum / total_pixels - global_mean ** 2)) + if global_std < 1e-6: + global_std = 1.0 + + save_json( + cache_path, + { + "global_mean": global_mean, + "global_std": global_std, + "total_pixels": int(total_pixels), + "num_images": len(sample_records), + "filenames": filenames, + }, + ) + print(f"[Normalization] Computed and saved normalization stats to {cache_path}") + return global_mean, global_std, "computed_fresh" + +def compute_class_distribution(sample_records: list[dict[str, str]]) -> dict[str, int] | None: + if not sample_records or not any("class_label" in record for record in sample_records): + return None + return { + "benign": sum(1 for record in sample_records if record.get("class_label") == "benign"), + "malignant": sum(1 for record in sample_records if record.get("class_label") == "malignant"), + } + +def format_class_distribution(class_distribution: dict[str, int] | None) -> str: + if class_distribution is None: + return "unavailable" + benign = int(class_distribution.get("benign", 0)) + malignant = int(class_distribution.get("malignant", 0)) + total = benign + malignant + return f"benign={benign}, malignant={malignant}, total={total}" + +def print_loaded_class_distribution( + *, + split_type: str, + train_subset_key: str, + base_train_records: list[dict[str, str]], + train_records: list[dict[str, str]], + val_records: list[dict[str, str]], + test_records: list[dict[str, str]], +) -> None: + if not any("class_label" in record for record in train_records): + return + section(f"Loaded Class Distribution | {split_type} | {train_subset_key}%") + print(f"Base train classes : {format_class_distribution(compute_class_distribution(base_train_records))}") + print(f"Train subset classes : {format_class_distribution(compute_class_distribution(train_records))}") + print(f"Validation classes : {format_class_distribution(compute_class_distribution(val_records))}") + print(f"Test classes : {format_class_distribution(compute_class_distribution(test_records))}") + +def print_split_summary(payload: dict[str, Any]) -> None: + unit_name = "Phase" if payload.get("phase_index") is not None else "Split" + section(f"{unit_name} Summary | {payload['split_type']} | {payload['train_subset_key']}%") + print(f"Dataset name : {payload['dataset_name']}") + if payload.get("dataset_split_policy") is not None: + print(f"Dataset split policy : {payload['dataset_split_policy']}") + print(f"Dataset splits JSON : {payload['dataset_splits_path']}") + print(f"Split source : {payload['split_source']}") + print(f"Split type used : {payload['split_type']}") + if payload.get("split_generation_mode") is not None: + print(f"Split generation mode : {payload['split_generation_mode']}") + if payload.get("phase_index") is not None: + print(f"Phase index : {payload['phase_index']}") + print(f"Phase val/test folds : val={payload['phase_val_fold_index']}, test={payload['phase_test_fold_index']}") + if payload.get("percent_sampling_mode") is not None: + print(f"Percent sampling mode : {payload['percent_sampling_mode']}") + print(f"Train fraction : {payload['train_subset_key']}% of frozen base train") + print(f"Train subset variant : {payload.get('train_subset_variant', 0)}") + print(f"Train subset source : {payload.get('train_subset_source', 'persisted')}") + if payload.get("sampling_chain_dataset_percents") is not None: + print(f"Sampling chain percents: {payload['sampling_chain_dataset_percents']}") + print(f"Base train samples : {payload['base_train_count']}") + print(f"Train subset samples : {payload['train_count']}") + print(f"Validation samples : {payload['val_count']}") + print(f"Test samples : {payload['test_count']}") + if payload.get("base_train_class_distribution") is not None: + print(f"Base train classes : {format_class_distribution(payload['base_train_class_distribution'])}") + print(f"Train subset classes : {format_class_distribution(payload['train_class_distribution'])}") + print(f"Validation classes : {format_class_distribution(payload['val_class_distribution'])}") + print(f"Test classes : {format_class_distribution(payload['test_class_distribution'])}") + print(f"Validation/Test frozen : {payload['val_test_frozen']}") + print(f"Leakage check : {payload['leakage_check']}") + +def print_normalization_summary(payload: dict[str, Any]) -> None: + mode = "ImageNet mean/std" if USE_IMAGENET_NORM else "Dataset train mean/std" + print(f"Dataset name : {payload['dataset_name']}") + print(f"Normalization mode : {mode}") + print(f"Stats cache path : {payload['normalization_cache_path']}") + print(f"Stats source : {payload['normalization_source']}") + print(f"Split type used : {payload['split_type']}") + variant_suffix = train_subset_variant_suffix(int(payload.get("train_subset_variant", 0))) + print( + f"Stats computed from : {payload['train_count']} train samples " + f"({payload['train_subset_key']}%{variant_suffix})" + ) +# ============================================================================= +# IMAGE PREPARATION + DATASETS +# ============================================================================= + +def _to_three_channels(image: np.ndarray) -> np.ndarray: + if image.ndim == 2: + image = image[..., None] + if image.shape[2] == 1: + image = np.repeat(image, 3, axis=2) + elif image.shape[2] > 3: + image = image[..., :3] + return image + +def _prepare_image(raw: np.ndarray, global_mean: float, global_std: float) -> np.ndarray: + img = raw.astype(np.float32) + img = _to_three_channels(img) + if IMG_SIZE > 0 and (img.shape[0] != IMG_SIZE or img.shape[1] != IMG_SIZE): + img = np.array( + PILImage.fromarray(img.astype(np.uint8)).resize((IMG_SIZE, IMG_SIZE), PILImage.BILINEAR) + ).astype(np.float32) + if USE_IMAGENET_NORM: + if img.max() > 1.0: + img = img / 255.0 + img = (img - IMAGENET_MEAN) / IMAGENET_STD + else: + img = (img - global_mean) / global_std + return np.transpose(img, (2, 0, 1)).copy() + +def _prepare_mask(raw: np.ndarray) -> np.ndarray: + mask = raw.astype(np.uint8) + if mask.ndim == 3: + mask = mask[..., 0] + if IMG_SIZE > 0 and (mask.shape[0] != IMG_SIZE or mask.shape[1] != IMG_SIZE): + pil_mask = PILImage.fromarray(mask) + if pil_mask.mode != "L": + pil_mask = pil_mask.convert("L") + mask = np.array(pil_mask.resize((IMG_SIZE, IMG_SIZE), PILImage.NEAREST)) + return ((mask > 0).astype(np.float32))[None, ...].copy() + +def print_imagenet_normalization_status() -> bool: + uses_imagenet_norm = bool(USE_IMAGENET_NORM) + if uses_imagenet_norm: + print("✅🖼️ ImageNet normalization is ACTIVE in `_prepare_image`.") + else: + print("⚠️🧪 ImageNet normalization is NOT active in `_prepare_image`.") + print("⚠️📊 Using dataset global mean/std normalization instead.") + if SMP_ENCODER_WEIGHTS == "imagenet" and not uses_imagenet_norm: + print("⚠️🚨 Encoder weights are set to ImageNet, but ImageNet normalization is disabled.") + return uses_imagenet_norm + +def _gaussian_kernel1d( + sigma: float, + *, + device: torch.device, + dtype: torch.dtype, +) -> torch.Tensor: + if sigma <= 0: + return torch.ones(1, device=device, dtype=dtype) + radius = max(int(math.ceil(3.0 * sigma)), 1) + coords = torch.arange(-radius, radius + 1, device=device, dtype=dtype) + kernel = torch.exp(-(coords.square()) / max(2.0 * sigma * sigma, 1e-6)) + return kernel / kernel.sum().clamp_min(1e-12) + +def _smooth_displacement_field(field: torch.Tensor, sigma: float) -> torch.Tensor: + kernel = _gaussian_kernel1d(sigma, device=field.device, dtype=field.dtype) + if kernel.numel() == 1: + return field + radius = kernel.numel() // 2 + kernel_y = kernel.view(1, 1, -1, 1) + kernel_x = kernel.view(1, 1, 1, -1) + field = F.conv2d(field, kernel_y, padding=(radius, 0)) + field = F.conv2d(field, kernel_x, padding=(0, radius)) + return field + +def _apply_elastic_deformation( + image: torch.Tensor, + mask: torch.Tensor, + *, + alpha: float = 8.0, + sigma: float = 4.0, +) -> tuple[torch.Tensor, torch.Tensor]: + _, h, w = image.shape + if h < 2 or w < 2: + return image.contiguous(), mask.contiguous() + + device = image.device + dtype = image.dtype + dx = _smooth_displacement_field(torch.randn(1, 1, h, w, device=device, dtype=dtype), sigma) * alpha + dy = _smooth_displacement_field(torch.randn(1, 1, h, w, device=device, dtype=dtype), sigma) * alpha + + yy, xx = torch.meshgrid( + torch.linspace(-1.0, 1.0, h, device=device, dtype=dtype), + torch.linspace(-1.0, 1.0, w, device=device, dtype=dtype), + indexing="ij", + ) + grid = torch.stack((xx, yy), dim=-1).unsqueeze(0) + grid[..., 0] = grid[..., 0] + dx.squeeze(0).squeeze(0) * (2.0 / max(w - 1, 1)) + grid[..., 1] = grid[..., 1] + dy.squeeze(0).squeeze(0) * (2.0 / max(h - 1, 1)) + grid = grid.clamp(-1.25, 1.25) + + image_out = F.grid_sample( + image.unsqueeze(0), + grid, + mode="bilinear", + padding_mode="reflection", + align_corners=True, + ).squeeze(0) + mask_out = F.grid_sample( + mask.unsqueeze(0), + grid, + mode="nearest", + padding_mode="reflection", + align_corners=True, + ).squeeze(0) + return image_out.contiguous(), mask_out.clamp(0.0, 1.0).contiguous() + +def _apply_minimal_train_aug(image: torch.Tensor, mask: torch.Tensor) -> tuple[torch.Tensor, torch.Tensor]: + if torch.rand(1).item() < 0.5: + image = torch.flip(image, dims=(2,)) + mask = torch.flip(mask, dims=(2,)) + if torch.rand(1).item() < 0.5: + image = torch.flip(image, dims=(1,)) + mask = torch.flip(mask, dims=(1,)) + if torch.rand(1).item() < 0.5: + k = 1 if torch.rand(1).item() < 0.5 else 3 + image = torch.rot90(image, k=k, dims=(1, 2)) + mask = torch.rot90(mask, k=k, dims=(1, 2)) + elastic_aug_prob = float(_job_param("elastic_aug_prob", 0.0)) + if elastic_aug_prob > 0 and torch.rand(1).item() < elastic_aug_prob: + image, mask = _apply_elastic_deformation(image, mask) + return image.contiguous(), mask.contiguous() + +class BUSIDataset(Dataset): + def __init__( + self, + sample_records: list[dict[str, str]], + dataset_root: Path, + global_mean: float, + global_std: float, + *, + preload: bool, + augment: bool, + split_name: str, + ) -> None: + super().__init__() + self.sample_records = [dict(record) for record in sample_records] + self.dataset_root = Path(dataset_root) + self.global_mean = float(global_mean) + self.global_std = float(global_std) + self.preload = preload + self.augment = augment + self.split_name = split_name + self._images: list[torch.Tensor] = [] + self._masks: list[torch.Tensor] = [] + self._raw_cache_bytes = 0 + + if not self.preload: + raise ValueError("PRELOAD_TO_RAM is mandatory in this RunPod runner.") + self._preload_to_ram() + + def _preload_to_ram(self) -> None: + desc = f"Preloading {self.split_name} ({len(self.sample_records)} samples) to RAM" + for record in tqdm(self.sample_records, desc=desc, leave=False): + raw_img = np.array(PILImage.open(self.dataset_root / record["image_rel_path"])) + raw_mask = np.array(PILImage.open(self.dataset_root / record["mask_rel_path"])) + if raw_img.shape[:2] != raw_mask.shape[:2]: + raise RuntimeError( + f"Image/mask spatial size mismatch for {record['filename']}: " + f"image={raw_img.shape[:2]}, mask={raw_mask.shape[:2]}" + ) + image = torch.from_numpy(_prepare_image(raw_img, self.global_mean, self.global_std)) + mask = torch.from_numpy(_prepare_mask(raw_mask)) + self._raw_cache_bytes += tensor_bytes(image) + tensor_bytes(mask) + self._images.append(image) + self._masks.append(mask) + + def __len__(self) -> int: + return len(self.sample_records) + + def __getitem__(self, index: int) -> dict[str, Any]: + image = self._images[index].clone() + mask = self._masks[index].clone() + if self.augment: + image, mask = _apply_minimal_train_aug(image, mask) + return { + "image": image, + "mask": mask, + "sample_id": Path(self.sample_records[index]["filename"]).stem, + "dataset": current_dataset_name(), + } + + @property + def cache_bytes(self) -> int: + return self._raw_cache_bytes + +class CUDAPrefetcher: + def __init__(self, loader: DataLoader, device: torch.device) -> None: + self.loader = loader + self.device = device + self._use_cuda = device.type == "cuda" + self._iter = None + self._stream = None + self._next_batch = None + + def __len__(self) -> int: + return len(self.loader) + + def __iter__(self): + self._iter = iter(self.loader) + self._stream = torch.cuda.Stream(device=self.device) if self._use_cuda else None + self._next_batch = None + self._preload() + return self + + def close(self) -> None: + self._next_batch = None + self._iter = None + self._stream = None + + def _preload(self) -> None: + if self._iter is None: + self._next_batch = None + return + try: + self._next_batch = next(self._iter) + except StopIteration: + self._next_batch = None + return + if self._use_cuda: + assert self._stream is not None + with torch.cuda.stream(self._stream): + self._next_batch = to_device(self._next_batch, self.device) + else: + self._next_batch = to_device(self._next_batch, self.device) + + def __next__(self): + if self._next_batch is None: + self.close() + raise StopIteration + if self._use_cuda: + assert self._stream is not None + torch.cuda.current_stream(self.device).wait_stream(self._stream) + batch = self._next_batch + self._preload() + if self._next_batch is None: + self._iter = None + self._stream = None + return batch + +class DataBundle: + def __init__( + self, + *, + percent: float, + split_payload: dict[str, Any], + train_ds: BUSIDataset, + val_ds: BUSIDataset, + test_ds: BUSIDataset, + train_loader: DataLoader, + val_loader: DataLoader, + test_loader: DataLoader, + ) -> None: + self.percent = percent + self.split_payload = split_payload + self.train_ds = train_ds + self.val_ds = val_ds + self.test_ds = test_ds + self.train_loader = train_loader + self.val_loader = val_loader + self.test_loader = test_loader + + @property + def global_mean(self) -> float: + return float(self.split_payload["global_mean"]) + + @property + def global_std(self) -> float: + return float(self.split_payload["global_std"]) + + @property + def total_cache_bytes(self) -> int: + return self.train_ds.cache_bytes + self.val_ds.cache_bytes + self.test_ds.cache_bytes + +def make_loader(dataset: Dataset, shuffle: bool, *, loader_tag: str) -> DataLoader: + num_workers = NUM_WORKERS + persistent_workers = USE_PERSISTENT_WORKERS and num_workers > 0 + pin_memory = USE_PIN_MEMORY and DEVICE.type == "cuda" + generator = make_seeded_generator(SEED, loader_tag) + return DataLoader( + dataset, + batch_size=BATCH_SIZE, + shuffle=shuffle, + num_workers=num_workers, + pin_memory=pin_memory, + drop_last=False, + persistent_workers=persistent_workers, + worker_init_fn=seed_worker, + generator=generator, + ) + +def build_data_bundle(percent: float, split_registry: dict[str, Any], split_source: str) -> DataBundle: + pct_label = percent_label(percent) + pct_text = percent_text(percent) + selected_split = select_persisted_split(split_registry, SPLIT_TYPE, percent) + selected_split = apply_train_subset_variant( + selected_split, + split_registry, + subset_variant=TRAIN_SUBSET_VARIANT, + ) + pct_root = ensure_dir(RUNS_ROOT / MODEL_NAME / f"pct_{pct_label}") + split_manifest_path = export_selected_split_manifest( + pct_root, + percent=percent, + split_source=split_source, + selected_split=selected_split, + ) + stats_cache_path = pct_root / ( + f"norm_stats_{normalization_cache_tag()}_{SPLIT_TYPE}_{pct_label}pct" + f"{train_subset_variant_suffix(int(selected_split.get('train_subset_variant', 0)))}.json" + ) + base_train_class_distribution = compute_class_distribution(selected_split["base_train_records"]) + train_class_distribution = compute_class_distribution(selected_split["train_records"]) + val_class_distribution = compute_class_distribution(selected_split["val_records"]) + test_class_distribution = compute_class_distribution(selected_split["test_records"]) + print_loaded_class_distribution( + split_type=selected_split["split_type"], + train_subset_key=selected_split["train_subset_key"], + base_train_records=selected_split["base_train_records"], + train_records=selected_split["train_records"], + val_records=selected_split["val_records"], + test_records=selected_split["test_records"], + ) + dataset_root = Path(selected_split["dataset_root"]).resolve() + global_mean, global_std, normalization_source = compute_busi_statistics( + dataset_root=dataset_root, + sample_records=selected_split["train_records"], + cache_path=stats_cache_path, + ) + + split_payload = { + "dataset_name": current_dataset_name(), + "dataset_split_policy": split_registry.get("split_policy"), + "dataset_splits_path": str(current_dataset_splits_json_path().resolve()), + "dataset_root": str(dataset_root), + "split_source": split_source, + "split_type": SPLIT_TYPE, + "dataset_percent": percent, + "train_subset_key": selected_split["train_subset_key"], + "train_subset_variant": int(selected_split.get("train_subset_variant", 0)), + "train_subset_source": str(selected_split.get("train_subset_source", "persisted")), + "selected_split_manifest_path": str(split_manifest_path.resolve()), + "base_train_count": len(selected_split["base_train_records"]), + "train_count": len(selected_split["train_records"]), + "val_count": len(selected_split["val_records"]), + "test_count": len(selected_split["test_records"]), + "base_train_class_distribution": base_train_class_distribution, + "train_class_distribution": train_class_distribution, + "val_class_distribution": val_class_distribution, + "test_class_distribution": test_class_distribution, + "val_test_frozen": True, + "leakage_check": "passed", + "global_mean": global_mean, + "global_std": global_std, + "normalization_cache_path": str(stats_cache_path.resolve()), + "normalization_source": normalization_source, + } + + print_split_summary(split_payload) + print_normalization_summary(split_payload) + + train_ds = BUSIDataset( + selected_split["train_records"], + dataset_root, + global_mean, + global_std, + preload=PRELOAD_TO_RAM, + augment=True, + split_name=f"train {SPLIT_TYPE} {pct_text}", + ) + val_ds = BUSIDataset( + selected_split["val_records"], + dataset_root, + global_mean, + global_std, + preload=PRELOAD_TO_RAM, + augment=False, + split_name=f"val {SPLIT_TYPE}", + ) + test_ds = BUSIDataset( + selected_split["test_records"], + dataset_root, + global_mean, + global_std, + preload=PRELOAD_TO_RAM, + augment=False, + split_name=f"test {SPLIT_TYPE}", + ) + + bundle = DataBundle( + percent=percent, + split_payload=split_payload, + train_ds=train_ds, + val_ds=val_ds, + test_ds=test_ds, + train_loader=make_loader(train_ds, shuffle=True, loader_tag=f"{SPLIT_TYPE}:{pct_label}:train"), + val_loader=make_loader(val_ds, shuffle=False, loader_tag=f"{SPLIT_TYPE}:{pct_label}:val"), + test_loader=make_loader(test_ds, shuffle=False, loader_tag=f"{SPLIT_TYPE}:{pct_label}:test"), + ) + print_preload_summary(bundle) + return bundle + +def print_preload_summary(bundle: DataBundle) -> None: + section( + f"RAM Preload Summary | {bundle.split_payload['split_type']} | {int(bundle.percent * 100)}%" + ) + print(f"Train samples : {len(bundle.train_ds)}") + print(f"Val samples : {len(bundle.val_ds)}") + print(f"Test samples : {len(bundle.test_ds)}") + print(f"Train batches : {len(bundle.train_loader)}") + print(f"Val batches : {len(bundle.val_loader)}") + print(f"Test batches : {len(bundle.test_loader)}") + print(f"Global mean : {bundle.global_mean:.6f}") + print(f"Global std : {bundle.global_std:.6f}") + first = bundle.train_ds[0] + print(f"Sample image shape : {tuple(first['image'].shape)}") + print(f"Sample mask shape : {tuple(first['mask'].shape)}") + print(f"Sample image dtype : {first['image'].dtype}") + print(f"Sample mask dtype : {first['mask'].dtype}") + print(f"Estimated RAM preload : {bytes_to_gb(bundle.total_cache_bytes):.3f} GB") + +"""============================================================================= +MODEL DEFINITIONS +============================================================================= +""" + +def strategy_name(strategy: int, model_config: RuntimeModelConfig | None = None) -> str: + strategy = _require_supported_strategy(strategy) + model_config = (model_config or current_model_config()).validate() + if model_config.backbone_family == "custom_vgg": + if strategy == 2: + return "Strategy 2: Custom VGG + Segmentation Head (Supervised)" + if strategy == 3: + return "Strategy 3 Lite: Custom VGG + Segmentation Head + RL" + raise ValueError(f"Unsupported strategy: {strategy}") + + if strategy == 2: + return f"Strategy 2: SMP {model_config.smp_decoder_type} ({model_config.smp_encoder_name}) supervised" + if strategy == 3: + return f"Strategy 3 Lite: SMP {model_config.smp_decoder_type} ({model_config.smp_encoder_name}) + RL" + raise ValueError(f"Unsupported strategy: {strategy}") + +def _apply_omega_conv(omega_conv: nn.Conv2d, value_next: torch.Tensor) -> torch.Tensor: + weight = omega_conv.weight + value_next = value_next.to(device=weight.device, dtype=weight.dtype) + return omega_conv(value_next) + +def _conv3x3(in_ch: int, out_ch: int, dilation: int = 1) -> nn.Conv2d: + return nn.Conv2d( + in_ch, + out_ch, + kernel_size=3, + stride=1, + padding=dilation, + dilation=dilation, + bias=True, + ) + +class _ConvBlock(nn.Module): + def __init__( + self, + in_ch: int, + out_ch: int, + dilation: int = 1, + *, + num_groups: int = 0, + dropout: float = 0.0, + ) -> None: + super().__init__() + self.conv = _conv3x3(in_ch, out_ch, dilation=dilation) + self.norm = _group_norm(out_ch, num_groups=num_groups) if num_groups > 0 else nn.Identity() + self.act = nn.ReLU(inplace=True) + self.drop = nn.Dropout2d(p=dropout) if dropout > 0 else nn.Identity() + + def forward(self, x: torch.Tensor) -> torch.Tensor: + return self.drop(self.act(self.norm(self.conv(x)))) + +def _group_norm(num_channels: int, *, num_groups: int = GN_NUM_GROUPS) -> nn.GroupNorm: + groups = min(num_groups, num_channels) + while groups > 1 and num_channels % groups != 0: + groups -= 1 + return nn.GroupNorm(groups, num_channels) + + +class _MultiScaleRefineBranch(nn.Module): + """Processes raw encoder features at each scale independently, then fuses + them into a single feature map. This gives the refinement head access to + multi-resolution spatial cues (edges at low levels, semantics at high + levels) that the 1x1 projection squashes away.""" + + def __init__( + self, + encoder_channels: list[int] | tuple[int, ...], + out_channels: int, + per_scale_channels: int = 32, + ) -> None: + super().__init__() + self._valid_indices: list[int] = [i for i, c in enumerate(encoder_channels) if c > 0] + self.scale_convs = nn.ModuleList() + for i in self._valid_indices: + self.scale_convs.append(nn.Sequential( + nn.Conv2d(encoder_channels[i], per_scale_channels, kernel_size=1, bias=False), + _group_norm(per_scale_channels), + nn.ReLU(inplace=True), + )) + total_ch = per_scale_channels * len(self._valid_indices) + self.fuse = nn.Sequential( + nn.Conv2d(total_ch, out_channels, kernel_size=3, padding=1, bias=False), + _group_norm(out_channels), + nn.ReLU(inplace=True), + nn.Conv2d(out_channels, out_channels, kernel_size=3, padding=2, dilation=2, bias=False), + _group_norm(out_channels), + nn.ReLU(inplace=True), + ) + self._init_small() + + def _init_small(self) -> None: + """Small-magnitude init so the branch starts as a near-zero residual.""" + for m in self.modules(): + if isinstance(m, nn.Conv2d): + nn.init.kaiming_normal_(m.weight, mode="fan_out", nonlinearity="relu") + m.weight.data.mul_(0.1) + if m.bias is not None: + nn.init.zeros_(m.bias) + + def forward( + self, + encoder_features: list[torch.Tensor] | tuple[torch.Tensor, ...], + output_size: tuple[int, int], + ) -> torch.Tensor: + h, w = output_size + parts: list[torch.Tensor] = [] + for idx, conv in zip(self._valid_indices, self.scale_convs): + out = conv(encoder_features[idx]) + if out.shape[-2] != h or out.shape[-1] != w: + out = F.interpolate(out, size=(h, w), mode="bilinear", align_corners=False) + parts.append(out) + return self.fuse(torch.cat(parts, dim=1)) + + +class SelfAttentionModule(nn.Module): + def __init__(self, channels: int) -> None: + super().__init__() + mid = max(channels // 8, 1) + self.query = nn.Conv2d(channels, mid, 1) + self.key = nn.Conv2d(channels, mid, 1) + self.value = nn.Conv2d(channels, channels, 1) + self.gamma = nn.Parameter(torch.tensor([0.1], dtype=torch.float32)) + + def forward(self, f: torch.Tensor) -> tuple[torch.Tensor, torch.Tensor]: + b, c, h, w = f.shape + pooled = f + target_grid = max(int(_job_param("strategy3_sam_attention_grid", DEFAULT_STRATEGY3_SAM_ATTENTION_GRID)), 1) + if target_grid < max(h, w): + stride_h = max(1, math.ceil(h / target_grid)) + stride_w = max(1, math.ceil(w / target_grid)) + pooled = F.avg_pool2d(f, kernel_size=(stride_h, stride_w), stride=(stride_h, stride_w)) + if target_grid >= 64 and target_grid not in _STRATEGY3_SAM_GRID_WARNED: + print( + "[Strategy3] Self-attention grid " + f"{target_grid}x{target_grid} requested; this implies a much heavier attention matrix " + "(for example 64x64 -> 4096 tokens). Lower strategy3_sam_attention_grid if this is too slow." + ) + _STRATEGY3_SAM_GRID_WARNED.add(target_grid) + + ph, pw = pooled.shape[-2:] + q = self.query(pooled).view(b, -1, ph * pw).permute(0, 2, 1) + k = self.key(pooled).view(b, -1, ph * pw) + v = self.value(pooled).view(b, -1, ph * pw).permute(0, 2, 1) + attn = torch.softmax(q @ k / (q.shape[-1] ** 0.5), dim=-1) + out = (attn @ v).permute(0, 2, 1).view(b, c, ph, pw) + if ph != h or pw != w: + out = F.interpolate(out, size=(h, w), mode="bilinear", align_corners=False) + return f + self.gamma * out, attn + + def forward_features(self, f: torch.Tensor) -> torch.Tensor: + out, _ = self.forward(f) + return out + +class DilatedPolicyHead(nn.Module): + def __init__(self, in_channels: int) -> None: + super().__init__() + self.body = nn.Sequential( + _ConvBlock(in_channels, 512, dilation=1), + _ConvBlock(512, 256, dilation=2), + _ConvBlock(256, 128, dilation=3), + _ConvBlock(128, 64, dilation=4), + ) + self.classifier = nn.Conv2d(64, NUM_ACTIONS, kernel_size=1) + nn.init.zeros_(self.classifier.weight) + bias = torch.full((NUM_ACTIONS,), -2.0, dtype=torch.float32) + keep_index = NUM_ACTIONS // 2 if NUM_ACTIONS >= 3 else NUM_ACTIONS - 1 + bias[keep_index] = 2.0 + with torch.no_grad(): + self.classifier.bias.copy_(bias) + + def forward(self, x: torch.Tensor) -> torch.Tensor: + return self.classifier(self.body(x)) + +class DilatedValueHead(nn.Module): + def __init__(self, in_channels: int) -> None: + super().__init__() + self.body = nn.Sequential( + _ConvBlock(in_channels, 512, dilation=1), + _ConvBlock(512, 256, dilation=2), + _ConvBlock(256, 128, dilation=3), + _ConvBlock(128, 64, dilation=4), + ) + self.readout = nn.Conv2d(64, 1, kernel_size=1) + + def forward(self, x: torch.Tensor) -> torch.Tensor: + features = self.body(x) + return self.readout(features) + +def replace_bn_with_gn(model: nn.Module, num_groups: int = 8) -> nn.Module: + for name, module in model.named_children(): + if isinstance(module, (nn.BatchNorm2d, nn.BatchNorm1d)): + num_channels = module.num_features + groups = min(num_groups, num_channels) + while groups > 1 and num_channels % groups != 0: + groups -= 1 + setattr(model, name, nn.GroupNorm(groups, num_channels, eps=module.eps, affine=module.affine)) + else: + replace_bn_with_gn(module, num_groups=num_groups) + return model + +def _ensure_transunet_repo_on_path() -> None: + repo_dir = TRANSUNET_REPO_DIR.resolve() + if not repo_dir.is_dir(): + raise FileNotFoundError( + f"TransUNet repo not found at {repo_dir}. Expected the official repo in " + f"{TRANSUNET_REPO_DIR}." + ) + repo_str = str(repo_dir) + if repo_str not in sys.path: + sys.path.insert(0, repo_str) + + +def _load_transunet_components() -> tuple[Any, dict[str, Any]]: + global _TRANSUNET_VISION_TRANSFORMER, _TRANSUNET_CONFIGS + if _TRANSUNET_VISION_TRANSFORMER is None or _TRANSUNET_CONFIGS is None: + _ensure_transunet_repo_on_path() + try: + vit_module = importlib.import_module("networks.vit_seg_modeling") + except Exception as exc: + raise RuntimeError( + "Unable to import the official TransUNet modules. Ensure the TransUNet repo is present " + "and dependencies such as ml_collections, scipy, and torch are installed." + ) from exc + _TRANSUNET_VISION_TRANSFORMER = getattr(vit_module, "VisionTransformer") + _TRANSUNET_CONFIGS = getattr(vit_module, "CONFIGS") + return _TRANSUNET_VISION_TRANSFORMER, _TRANSUNET_CONFIGS + + +def _transunet_tensor_changed(before: torch.Tensor, after: torch.Tensor) -> bool: + return not torch.equal(before, after) + + +def _load_and_verify_transunet_checkpoint( + vit_model: nn.Module, + *, + pretrained_path: Path, + img_size: int, + n_skip: int, +) -> dict[str, Any]: + checkpoint_path = Path(pretrained_path).expanduser().resolve() + if not checkpoint_path.is_file(): + raise FileNotFoundError( + f"TransUNet checkpoint not found at {checkpoint_path}. " + f"Expected ImageNet weights at {TRANSUNET_PRETRAINED_PATH.resolve()}." + ) + + weights = np.load(checkpoint_path, allow_pickle=False) + try: + missing_keys = [key for key in _TRANSUNET_REQUIRED_NPZ_KEYS if key not in weights] + if missing_keys: + raise RuntimeError( + f"TransUNet checkpoint {checkpoint_path} is missing required arrays: {missing_keys}" + ) + + position_embeddings = vit_model.transformer.embeddings.position_embeddings + root_conv = vit_model.transformer.embeddings.hybrid_model.root.conv.weight + block0_query = vit_model.transformer.encoder.layer[0].attn.query.weight + + pos_before = position_embeddings.detach().cpu().clone() + root_before = root_conv.detach().cpu().clone() + query_before = block0_query.detach().cpu().clone() + + posemb_source_shape = tuple(weights["Transformer/posembed_input/pos_embedding"].shape) + posemb_target_shape = tuple(position_embeddings.shape) + array_count = len(getattr(weights, "files", [])) + file_size_mb = checkpoint_path.stat().st_size / (1024 * 1024) + + vit_model.load_from(weights=weights) + + pos_after = position_embeddings.detach().cpu() + root_after = root_conv.detach().cpu() + query_after = block0_query.detach().cpu() + + updated = { + "PosEmbed updated": _transunet_tensor_changed(pos_before, pos_after), + "ResNet root conv updated": _transunet_tensor_changed(root_before, root_after), + "ViT block-0 query updated": _transunet_tensor_changed(query_before, query_after), + } + + section("TransUNet Checkpoint Verification") + print("[TransUNet] OK Loaded R50+ViT-B/16 ImageNet checkpoint") + print(f"[TransUNet] File : {checkpoint_path} ({file_size_mb:.1f} MB)") + print(f"[TransUNet] NPZ arrays : {array_count}") + print( + "[TransUNet] PosEmbed shape : " + f"src {posemb_source_shape} -> tgt {posemb_target_shape}" + f"{' (interpolated)' if posemb_source_shape != posemb_target_shape else ''}" + ) + for label, status in updated.items(): + print(f"[TransUNet] {label:<22}: {status}") + print( + "[TransUNet] " + f"img_size={img_size}, patches.grid=({img_size // 16}, {img_size // 16}), " + f"n_skip={n_skip}, n_classes=1" + ) + + failed = [label for label, status in updated.items() if not status] + if failed: + raise RuntimeError( + "TransUNet checkpoint load verification failed. The following tensors were unchanged after " + f"load_from(...): {failed}. Training was stopped to avoid using a randomly initialized model." + ) + + return { + "checkpoint_path": str(checkpoint_path), + "array_count": array_count, + "file_size_mb": file_size_mb, + "posemb_source_shape": posemb_source_shape, + "posemb_target_shape": posemb_target_shape, + "updated": updated, + } + finally: + close_fn = getattr(weights, "close", None) + if callable(close_fn): + close_fn() + + +class _TransUNetEncoder(nn.Module): + def __init__(self, transformer: nn.Module) -> None: + super().__init__() + self.transformer = transformer + self.out_channels = (3, 64, 256, 512, 768) + self._vit_token_cache: torch.Tensor | None = None + self._decoder_skip_cache: list[torch.Tensor] | None = None + + def _clear_cache(self) -> None: + self._vit_token_cache = None + self._decoder_skip_cache = None + + def decoder_inputs(self) -> tuple[torch.Tensor, list[torch.Tensor]]: + if self._vit_token_cache is None or self._decoder_skip_cache is None: + raise RuntimeError( + "TransUNet decoder was called before the encoder cache was populated. " + "Call the encoder first in the current forward pass." + ) + return self._vit_token_cache, self._decoder_skip_cache + + def forward(self, x: torch.Tensor) -> list[torch.Tensor]: + self._clear_cache() + if x.shape[1] == 1: + model_input = x.repeat(1, 3, 1, 1) + elif x.shape[1] == 3: + model_input = x + else: + raise ValueError(f"TransUNet expects 1 or 3 input channels, got {x.shape[1]}.") + + embedding_output, hybrid_features = self.transformer.embeddings(model_input) + hidden_states, _ = self.transformer.encoder(embedding_output) + if hybrid_features is None or len(hybrid_features) < 3: + raise RuntimeError( + "TransUNet hybrid ResNet features were not produced as expected." + ) + + deepest_skip, mid_skip, shallow_skip = hybrid_features[:3] + batch_size, n_patch, hidden_dim = hidden_states.shape + side = math.isqrt(n_patch) + if side * side != n_patch: + raise RuntimeError( + f"TransUNet token grid is not square: n_patch={n_patch}." + ) + vit_out = hidden_states.permute(0, 2, 1).contiguous().view(batch_size, hidden_dim, side, side) + + self._vit_token_cache = hidden_states + self._decoder_skip_cache = [deepest_skip, mid_skip, shallow_skip] + return [model_input, shallow_skip, mid_skip, deepest_skip, vit_out] + + +class _TransUNetDecoder(nn.Module): + def __init__(self, decoder_core: nn.Module, encoder: _TransUNetEncoder) -> None: + super().__init__() + self.decoder_core = decoder_core + self._encoder_ref = weakref.ref(encoder) + + def _encoder(self) -> _TransUNetEncoder: + encoder = self._encoder_ref() + if encoder is None: + raise RuntimeError("TransUNet encoder reference is no longer available.") + return encoder + + def forward(self, *features: torch.Tensor) -> torch.Tensor: + del features + hidden_states, skip_features = self._encoder().decoder_inputs() + return self.decoder_core(hidden_states, features=skip_features) + + +class TransUNetSMPAdapter(nn.Module): + def __init__(self, *, img_size: int, pretrained_path: Path) -> None: + super().__init__() + if img_size % 16 != 0: + raise ValueError(f"TransUNet requires img_size divisible by 16, got {img_size}.") + + vision_transformer_cls, configs = _load_transunet_components() + if TRANSUNET_VIT_NAME not in configs: + raise KeyError( + f"TransUNet config {TRANSUNET_VIT_NAME!r} not found in the official repo." + ) + + config_vit = copy.deepcopy(configs[TRANSUNET_VIT_NAME]) + config_vit.n_classes = 1 + config_vit.n_skip = TRANSUNET_N_SKIP + config_vit.classifier = "seg" + config_vit.patches.grid = (img_size // 16, img_size // 16) + + vit_model = vision_transformer_cls(config_vit, img_size=img_size, num_classes=1) + self.checkpoint_summary = _load_and_verify_transunet_checkpoint( + vit_model, + pretrained_path=pretrained_path, + img_size=img_size, + n_skip=TRANSUNET_N_SKIP, + ) + self.encoder = _TransUNetEncoder(vit_model.transformer) + self.decoder = _TransUNetDecoder(vit_model.decoder, self.encoder) + self.segmentation_head = vit_model.segmentation_head + self.classification_head = None + self.transunet_config = config_vit + + def forward(self, x: torch.Tensor) -> torch.Tensor: + encoder_features = self.encoder(x) + decoder_output = run_smp_decoder(self.decoder, encoder_features) + logits = self.segmentation_head(decoder_output) + return logits + + + +class SMPEncoderWrapper(nn.Module): + def __init__( + self, + *, + encoder_name: str, + encoder_weights: str | None, + depth: int, + in_channels: int, + proj_dim: int, + ) -> None: + super().__init__() + self.encoder = smp.encoders.get_encoder( + encoder_name, + in_channels=in_channels, + depth=depth, + weights=encoder_weights, + ) + if REPLACE_BN_WITH_GN: + replace_bn_with_gn(self.encoder, num_groups=GN_NUM_GROUPS) + + raw_channels = sum(c for c in self.encoder.out_channels if c > 0) + if proj_dim > 0: + groups = min(GN_NUM_GROUPS, proj_dim) + while groups > 1 and proj_dim % groups != 0: + groups -= 1 + self.projection = nn.Sequential( + nn.Conv2d(raw_channels, proj_dim, kernel_size=1, bias=False), + nn.GroupNorm(groups, proj_dim) if REPLACE_BN_WITH_GN else nn.BatchNorm2d(proj_dim), + nn.ReLU(inplace=True), + ) + self._out_channels = proj_dim + else: + self.projection = None + self._out_channels = raw_channels + + @property + def out_channels(self) -> int: + return self._out_channels + + def forward(self, x: torch.Tensor) -> torch.Tensor: + h, w = x.shape[-2:] + features = self.encoder(x) + upsampled = [] + for feat in features: + if feat.shape[1] == 0: + continue + if feat.shape[-2] != h or feat.shape[-1] != w: + feat = F.interpolate(feat, size=(h, w), mode="bilinear", align_corners=False) + upsampled.append(feat) + out = torch.cat(upsampled, dim=1) + if self.projection is not None: + out = self.projection(out) + return out + + + +class PixelDRLMG_SMP(nn.Module): + def __init__( + self, + *, + encoder_name: str, + encoder_weights: str | None, + encoder_depth: int, + proj_dim: int, + dropout_p: float, + ) -> None: + super().__init__() + self.extractor = SMPEncoderWrapper( + encoder_name=encoder_name, + encoder_weights=encoder_weights, + depth=encoder_depth, + in_channels=3, + proj_dim=proj_dim, + ) + ch = self.extractor.out_channels + self.sam = SelfAttentionModule(channels=ch) + self.policy_head = DilatedPolicyHead(in_channels=ch) + self.value_head = DilatedValueHead(in_channels=ch) + self.head_dropout = nn.Dropout2d(p=dropout_p) + self.omega_conv = nn.Conv2d(1, 1, kernel_size=3, stride=1, padding=1, bias=False) + nn.init.constant_(self.omega_conv.weight, 1.0 / 9.0) + + def forward_state(self, x: torch.Tensor) -> tuple[torch.Tensor, torch.Tensor]: + features = self.extractor(x) + return self.sam(features) + + def forward_from_state(self, state: torch.Tensor) -> tuple[torch.Tensor, torch.Tensor]: + state = self.head_dropout(state) + return self.policy_head(state), self.value_head(state) + + def value_from_state(self, state: torch.Tensor) -> torch.Tensor: + state = self.head_dropout(state) + return self.value_head(state) + + def forward(self, x: torch.Tensor) -> tuple[torch.Tensor, torch.Tensor, torch.Tensor]: + state, attention = self.forward_state(x) + state = self.head_dropout(state) + return self.policy_head(state), self.value_head(state), attention + + def forward_policy_only(self, x: torch.Tensor) -> torch.Tensor: + state, _ = self.forward_state(x) + state = self.head_dropout(state) + return self.policy_head(state) + + def neighborhood_value(self, value_next: torch.Tensor) -> torch.Tensor: + return _apply_omega_conv(self.omega_conv, value_next) + + +class SupervisedSMPModel(nn.Module): + def __init__( + self, + *, + arch: str, + encoder_name: str, + encoder_weights: str | None, + encoder_depth: int = 5, + dropout_p: float, + ) -> None: + super().__init__() + if _is_transunet_selection(encoder_name=encoder_name, decoder_type=arch): + self.smp_model = TransUNetSMPAdapter( + img_size=IMG_SIZE, + pretrained_path=TRANSUNET_PRETRAINED_PATH, + ) + else: + self.smp_model = smp.create_model( + arch=arch, + encoder_name=encoder_name, + encoder_weights=encoder_weights, + encoder_depth=encoder_depth, + in_channels=3, + classes=1, + ) + self.smp_encoder = self.smp_model.encoder + if REPLACE_BN_WITH_GN and not _is_transunet_selection(encoder_name=encoder_name, decoder_type=arch): + replace_bn_with_gn(self.smp_encoder, num_groups=GN_NUM_GROUPS) + self.dropout = nn.Dropout2d(p=dropout_p) + + def forward(self, x: torch.Tensor) -> torch.Tensor: + encoder_features = self.smp_encoder(x) + decoder_output = run_smp_decoder(self.smp_model.decoder, encoder_features) + decoder_output = self.dropout(decoder_output) + logits = self.smp_model.segmentation_head(decoder_output) + if getattr(self.smp_model, "classification_head", None) is not None: + _ = self.smp_model.classification_head(encoder_features[-1]) + return logits + + +class RefinementPolicyHead(nn.Module): + A3C_NUM_ACTIONS = 1 + + def __init__(self, in_channels: int) -> None: + super().__init__() + self.body = nn.Sequential( + _ConvBlock(in_channels, 256, dilation=1, num_groups=GN_NUM_GROUPS), + _ConvBlock(256, 128, dilation=2, num_groups=GN_NUM_GROUPS), + _ConvBlock(128, 64, dilation=3, num_groups=GN_NUM_GROUPS), + ) + self.classifier = nn.Conv2d(64, self.A3C_NUM_ACTIONS, kernel_size=1) + nn.init.zeros_(self.classifier.weight) + if self.classifier.bias is not None: + nn.init.zeros_(self.classifier.bias) + + def forward(self, x: torch.Tensor) -> torch.Tensor: + return self.classifier(self.body(x)) + +class PixelDRLMG_WithDecoder(nn.Module): + def __init__( + self, + *, + arch: str, + encoder_name: str, + encoder_weights: str | None, + encoder_depth: int, + proj_dim: int, + dropout_p: float, + ) -> None: + super().__init__() + if _is_transunet_selection(encoder_name=encoder_name, decoder_type=arch): + self.smp_model = TransUNetSMPAdapter( + img_size=IMG_SIZE, + pretrained_path=TRANSUNET_PRETRAINED_PATH, + ) + else: + self.smp_model = smp.create_model( + arch=arch, + encoder_name=encoder_name, + encoder_weights=encoder_weights, + encoder_depth=encoder_depth, + in_channels=3, + classes=1, + ) + self.smp_encoder = self.smp_model.encoder + if REPLACE_BN_WITH_GN and not _is_transunet_selection(encoder_name=encoder_name, decoder_type=arch): + replace_bn_with_gn(self.smp_encoder, num_groups=GN_NUM_GROUPS) + + raw_channels = sum(c for c in self.smp_encoder.out_channels if c > 0) + if proj_dim > 0: + groups = min(GN_NUM_GROUPS, proj_dim) + while groups > 1 and proj_dim % groups != 0: + groups -= 1 + self.projection = nn.Sequential( + nn.Conv2d(raw_channels, proj_dim, kernel_size=1, bias=False), + nn.GroupNorm(groups, proj_dim) if REPLACE_BN_WITH_GN else nn.BatchNorm2d(proj_dim), + nn.ReLU(inplace=True), + ) + ch = proj_dim + else: + self.projection = None + ch = raw_channels + + self.refinement_adapter = nn.Sequential( + nn.Conv2d(ch + 3, ch, kernel_size=3, stride=1, padding=1, bias=False), + _group_norm(ch), + nn.ReLU(inplace=True), + _ConvBlock(ch, ch, num_groups=GN_NUM_GROUPS), + ) + self.policy_head = RefinementPolicyHead(in_channels=ch) + self.head_dropout = nn.Dropout2d(p=dropout_p) + self.use_refinement = True + self._strategy3_mc_cache: dict[tuple[Any, ...], tuple[torch.Tensor, torch.Tensor]] = {} + self._strategy3_mc_cache_fingerprint = "" + self._strategy3_mc_cache_fingerprint_sources: dict[str, Any] = {} + self._strategy3_strategy2_checkpoint_path: str | None = None + self._strategy3_eval_checkpoint_path: str | None = None + self._strategy3_mc_cache_stats = {"ram_hits": 0, "disk_hits": 0, "misses": 0, "writes": 0} + + def set_refinement_mode(self, enabled: bool) -> None: + self.use_refinement = bool(enabled) + self.refinement_adapter.requires_grad_(self.use_refinement) + + def clear_strategy3_mc_cache(self) -> None: + self._strategy3_mc_cache.clear() + self._strategy3_mc_cache_stats = {"ram_hits": 0, "disk_hits": 0, "misses": 0, "writes": 0} + + def _keep_bootstrapped_segmentation_in_eval(self) -> None: + if not (bool(getattr(self, "strategy2_bootstrap_loaded", False)) and bool(getattr(self, "freeze_bootstrapped_segmentation", False))): + return + for module_name in ("encoder", "decoder", "segmentation_head"): + module = getattr(self.smp_model, module_name, None) + if isinstance(module, nn.Module): + module.eval() + + def train(self, mode: bool = True): + super().train(mode) + if mode: + self._keep_bootstrapped_segmentation_in_eval() + return self + + def _concat_from_features( + self, + features: list[torch.Tensor] | tuple[torch.Tensor, ...], + *, + output_size: tuple[int, int], + ) -> torch.Tensor: + h, w = output_size + upsampled = [] + for feat in features: + if feat.shape[1] == 0: + continue + if feat.shape[-2] != h or feat.shape[-1] != w: + feat = F.interpolate(feat, size=(h, w), mode="bilinear", align_corners=False) + upsampled.append(feat) + out = torch.cat(upsampled, dim=1) + if self.projection is not None: + out = self.projection(out) + return out + + def _encoder_concat(self, x: torch.Tensor) -> torch.Tensor: + return self._concat_from_features(self.smp_encoder(x), output_size=x.shape[-2:]) + + def forward_decoder_from_features( + self, + encoder_features: list[torch.Tensor] | tuple[torch.Tensor, ...], + ) -> torch.Tensor: + decoder_output = run_smp_decoder(self.smp_model.decoder, encoder_features) + logits = self.smp_model.segmentation_head(decoder_output) + if getattr(self.smp_model, "classification_head", None) is not None: + _ = self.smp_model.classification_head(encoder_features[-1]) + return logits + + def forward_decoder(self, x: torch.Tensor) -> torch.Tensor: + return self.smp_model(x) + + def prepare_refinement_context( + self, + x: torch.Tensor, + *, + sample_ids: list[str] | None = None, + mc_mode: Literal["train", "eval"] = "train", + mc_cache_split: Literal["train", "val", "test"] | None = None, + mc_cache_run_dir: Path | None = None, + ) -> dict[str, Any]: + if mc_mode not in ("train", "eval"): + raise ValueError(f"Unsupported Strategy 3 mc_mode {mc_mode!r}.") + encoder_features = self.smp_encoder(x) + decoder_logits = self.forward_decoder_from_features(encoder_features) + decoder_prob = torch.sigmoid(decoder_logits) + zeros = torch.zeros_like(decoder_prob) + return { + "base_features": self._concat_from_features(encoder_features, output_size=x.shape[-2:]), + "encoder_features": list(encoder_features), + "decoder_logits": decoder_logits, + "decoder_prob": decoder_prob, + "mc_variance": zeros, + "pred_entropy": zeros, + } + + def forward_refinement_state( + self, + base_features: torch.Tensor, + current_mask: torch.Tensor, + decoder_prob: torch.Tensor, + mc_variance: torch.Tensor, + pred_entropy: torch.Tensor, + encoder_features: list[torch.Tensor] | None = None, + ) -> torch.Tensor: + boundary = _differentiable_boundary(current_mask, kernel_size=3) + conditioning = torch.cat( + [ + decoder_prob.to(dtype=base_features.dtype), + current_mask.to(dtype=base_features.dtype), + boundary.to(dtype=base_features.dtype), + ], + dim=1, + ) + return self.refinement_adapter(torch.cat([base_features, conditioning], dim=1)) + + def forward_state(self, x: torch.Tensor) -> tuple[torch.Tensor, torch.Tensor]: + concat_feat = self._encoder_concat(x) + return concat_feat, torch.empty(0, device=concat_feat.device, dtype=concat_feat.dtype) + + def forward_from_state(self, state: torch.Tensor) -> tuple[torch.Tensor, torch.Tensor]: + state = self.head_dropout(state) + policy = self.policy_head(state) + return policy, policy * 0.0 + + def value_from_state(self, state: torch.Tensor) -> torch.Tensor: + return self.forward_from_state(state)[1] + + def forward(self, x: torch.Tensor) -> tuple[torch.Tensor, torch.Tensor, torch.Tensor]: + if not self.use_refinement: + state, attention = self.forward_state(x) + policy = self.policy_head(state) + return policy, policy * 0.0, attention + context = self.prepare_refinement_context(x) + state = self.forward_refinement_state( + context["base_features"], + context["decoder_prob"].detach(), + context["decoder_prob"], + context["mc_variance"], + context["pred_entropy"], + encoder_features=context.get("encoder_features"), + ) + policy_logits, value = self.forward_from_state(state) + attention = torch.empty(0, device=state.device, dtype=state.dtype) + return policy_logits, value, attention + + def forward_policy_only(self, x: torch.Tensor) -> torch.Tensor: + if not self.use_refinement: + state, _ = self.forward_state(x) + state = self.head_dropout(state) + return self.policy_head(state) + context = self.prepare_refinement_context(x) + state = self.forward_refinement_state( + context["base_features"], + context["decoder_prob"].detach(), + context["decoder_prob"], + context["mc_variance"], + context["pred_entropy"], + encoder_features=context.get("encoder_features"), + ) + state = self.head_dropout(state) + return self.policy_head(state) + + +def run_smp_decoder(decoder: nn.Module, encoder_features: list[torch.Tensor] | tuple[torch.Tensor, ...]) -> torch.Tensor: + signature = inspect.signature(decoder.forward) + parameters = list(signature.parameters.values()) + if any(param.kind == inspect.Parameter.VAR_POSITIONAL for param in parameters): + return decoder(*encoder_features) + if len(parameters) == 1: + return decoder(encoder_features) + return decoder(*encoder_features) + +def checkpoint_run_config_payload(payload: dict[str, Any]) -> dict[str, Any]: + return payload.get("run_config") or payload.get("config") or {} + +def _raw_decoder_rl_model( + model: nn.Module, +) -> PixelDRLMG_WithDecoder | None: + raw = _unwrap_compiled(model) + if isinstance(raw, PixelDRLMG_WithDecoder): + return raw + return None + +def _uses_refinement_runtime(model: nn.Module, *, strategy: int | None = None) -> bool: + raw = _raw_decoder_rl_model(model) + if raw is None: + return False + if strategy is not None and strategy != 3: + return False + return bool(getattr(raw, "use_refinement", False)) + +def _policy_action_count_from_state_dict(state_dict: dict[str, Any]) -> int | None: + for key in ( + "policy_head.classifier.weight", + "policy_head.classifier.bias", + "policy_head.net.4.weight", + "policy_head.net.4.bias", + ): + tensor = state_dict.get(key) + if torch.is_tensor(tensor): + return int(tensor.shape[0]) + return None + +def _model_policy_action_count(model: nn.Module) -> int | None: + raw = _unwrap_compiled(model) + classifier = getattr(getattr(raw, "policy_head", None), "classifier", None) + if isinstance(classifier, nn.Conv2d): + return int(classifier.out_channels) + return None + +def _set_model_policy_action_count(model: nn.Module, action_count: int) -> bool: + raw = _unwrap_compiled(model) + if isinstance(raw, PixelDRLMG_WithDecoder): + classifier = getattr(getattr(raw, "policy_head", None), "classifier", None) + if isinstance(classifier, nn.Conv2d) and int(classifier.out_channels) == 1: + return False + policy_head = getattr(raw, "policy_head", None) + classifier = getattr(policy_head, "classifier", None) + if not isinstance(classifier, nn.Conv2d): + return False + if int(classifier.out_channels) == int(action_count): + return False + + new_classifier = nn.Conv2d( + classifier.in_channels, + int(action_count), + kernel_size=classifier.kernel_size, + stride=classifier.stride, + padding=classifier.padding, + dilation=classifier.dilation, + groups=classifier.groups, + bias=classifier.bias is not None, + padding_mode=classifier.padding_mode, + ).to(device=classifier.weight.device, dtype=classifier.weight.dtype) + nn.init.xavier_uniform_(new_classifier.weight) + if new_classifier.bias is not None: + nn.init.zeros_(new_classifier.bias) + policy_head.classifier = new_classifier + return True + +def _configure_policy_head_compatibility( + model: nn.Module, + state_dict: dict[str, Any], + *, + source: str, +) -> int | None: + action_count = _policy_action_count_from_state_dict(state_dict) + if action_count is None: + return None + if _set_model_policy_action_count(model, action_count): + print(f"[Policy Compatibility] source={source} num_actions={action_count}") + return action_count + +def _strategy3_checkpoint_layout_info( + state_dict: dict[str, Any], + run_config: dict[str, Any] | None = None, +) -> dict[str, Any]: + run_config = run_config or {} + strategy = run_config.get("strategy") + has_legacy_policy_head = any(key.startswith("policy_head.net.") for key in state_dict) + has_new_policy_body = any(key.startswith("policy_head.body.") for key in state_dict) + has_new_policy_classifier = any(key.startswith("policy_head.classifier.") for key in state_dict) + has_refinement_adapter = any(key.startswith("refinement_adapter.") for key in state_dict) + is_strategy3_decoder_checkpoint = bool( + strategy == 3 + or has_legacy_policy_head + or has_new_policy_body + or has_new_policy_classifier + or has_refinement_adapter + ) + use_refinement = bool( + has_refinement_adapter or ((has_new_policy_body or has_new_policy_classifier) and not has_legacy_policy_head) + ) + return { + "strategy": strategy, + "is_strategy3_decoder_checkpoint": is_strategy3_decoder_checkpoint, + "has_legacy_policy_head": has_legacy_policy_head, + "has_new_policy_head": bool(has_new_policy_body or has_new_policy_classifier), + "has_refinement_adapter": has_refinement_adapter, + "requires_policy_remap": has_legacy_policy_head, + "policy_action_count": _policy_action_count_from_state_dict(state_dict), + "use_refinement": use_refinement, + "compatibility_mode": "refinement" if use_refinement else "legacy", + } + +def inspect_strategy3_checkpoint_compatibility(path: str | Path) -> dict[str, Any]: + checkpoint_path = Path(path).expanduser().resolve() + payload = torch.load(checkpoint_path, map_location="cpu", weights_only=False) + layout = _strategy3_checkpoint_layout_info(payload.get("model_state_dict", {}), checkpoint_run_config_payload(payload)) + layout["path"] = str(checkpoint_path) + return layout + +def _configure_strategy3_model_compatibility( + model: nn.Module, + layout: dict[str, Any], + *, + source: str, +) -> None: + raw = _raw_decoder_rl_model(model) + if raw is None or not layout.get("is_strategy3_decoder_checkpoint"): + return + raw.set_refinement_mode(bool(layout["use_refinement"])) + if not bool(layout["use_refinement"]): + raw.refinement_adapter.eval() + if hasattr(raw, "multi_scale_refine"): + raw.multi_scale_refine.eval() + print( + "[Strategy3 Compatibility] " + f"source={source} mode={layout['compatibility_mode']} " + f"legacy_policy_head={layout['has_legacy_policy_head']} " + f"refinement_adapter={layout['has_refinement_adapter']}" + ) + +def _ensure_strategy3_refinement_adapter_compatible( + model: nn.Module, + state_dict: dict[str, Any], + *, + checkpoint_path: str | Path, +) -> None: + raw_model = _unwrap_compiled(model) + if not isinstance(raw_model, PixelDRLMG_WithDecoder): + return + target_state = raw_model.state_dict() + mismatched: list[str] = [] + for key, value in state_dict.items(): + if not key.startswith(("refinement_adapter.", "policy_head.classifier.")): + continue + target_value = target_state.get(key) + if target_value is None: + continue + if tuple(target_value.shape) != tuple(value.shape): + mismatched.append( + f"{key}: checkpoint={tuple(value.shape)} model={tuple(target_value.shape)}" + ) + if mismatched: + raise RuntimeError( + "Incompatible legacy Strategy 3 checkpoint detected after the continuous Strategy 3 redesign. " + f"Checkpoint={Path(checkpoint_path).resolve()} mismatches={mismatched[:4]}. " + "Resume/eval from legacy S3 checkpoints is not supported; retrain Strategy 3 from the Strategy 2 bootstrap checkpoint." + ) + +def _configure_model_from_checkpoint_path( + model: nn.Module, + checkpoint_path: str | Path, +) -> dict[str, Any]: + checkpoint_path = Path(checkpoint_path).expanduser().resolve() + payload = torch.load(checkpoint_path, map_location="cpu", weights_only=False) + state_dict = payload.get("model_state_dict", {}) + _configure_policy_head_compatibility(model, state_dict, source=str(checkpoint_path)) + layout = _strategy3_checkpoint_layout_info(state_dict, checkpoint_run_config_payload(payload)) + if layout.get("is_strategy3_decoder_checkpoint") and layout.get("policy_action_count") not in (None, 1): + raise RuntimeError( + "Incompatible legacy Strategy 3 checkpoint detected: the checkpoint uses a discrete multi-action " + f"policy head with out_channels={layout.get('policy_action_count')}. " + "The current Strategy 3 implementation requires a continuous 1-channel delta head." + ) + _configure_strategy3_model_compatibility(model, layout, source=str(checkpoint_path)) + layout["path"] = str(checkpoint_path) + return layout + +def _remap_legacy_policy_head_state_dict(state_dict: dict[str, Any]) -> dict[str, Any]: + remapped: dict[str, Any] = {} + for key, value in state_dict.items(): + if key.startswith("policy_head.net."): + suffix = key[len("policy_head.net."):] + layer_idx, dot, rest = suffix.partition(".") + if dot: + if layer_idx in {"0", "1", "2", "3"}: + remapped[f"policy_head.body.{layer_idx}.{rest}"] = value + continue + if layer_idx == "4": + remapped[f"policy_head.classifier.{rest}"] = value + continue + remapped[key] = value + return remapped + +def _load_strategy2_checkpoint_payload( + path: str | Path, + *, + model_config: RuntimeModelConfig, +) -> dict[str, Any]: + checkpoint_path = Path(path).expanduser().resolve() + ckpt = torch.load(checkpoint_path, map_location=DEVICE, weights_only=False) + saved_config = checkpoint_run_config_payload(ckpt) + if saved_config: + saved_model_config = RuntimeModelConfig.from_payload(saved_config).validate() + if saved_model_config.backbone_family != model_config.backbone_family: + raise ValueError( + f"Strategy 2 checkpoint backbone family mismatch: requested {model_config.backbone_family!r}, " + f"checkpoint has {saved_model_config.backbone_family!r} at {checkpoint_path}." + ) + return ckpt + +def _preview_state_keys(keys: list[str], *, limit: int = 8) -> str: + if not keys: + return "none" + preview = ", ".join(keys[:limit]) + if len(keys) > limit: + preview += ", ..." + return preview + +def _strict_load_strategy2_submodule( + target_module: nn.Module, + *, + checkpoint_state_dict: dict[str, Any], + checkpoint_prefix: str, + checkpoint_path: str | Path, + target_name: str, +) -> None: + extracted = { + key[len(checkpoint_prefix):]: value + for key, value in checkpoint_state_dict.items() + if key.startswith(checkpoint_prefix) + } + if not extracted: + raise RuntimeError( + f"Strategy 2 bootstrap failed for {target_name}: no checkpoint keys found with prefix " + f"{checkpoint_prefix!r} in {Path(checkpoint_path).resolve()}." + ) + + target_state = target_module.state_dict() + missing = sorted(set(target_state.keys()) - set(extracted.keys())) + unexpected = sorted(set(extracted.keys()) - set(target_state.keys())) + if missing or unexpected: + section(f"Strategy 2 Bootstrap Mismatch | {target_name}") + print(f"Checkpoint : {Path(checkpoint_path).resolve()}") + print(f"Checkpoint prefix : {checkpoint_prefix}") + print(f"Target tensors : {len(target_state)}") + print(f"Checkpoint tensors : {len(extracted)}") + print(f"Missing keys ({len(missing)}) : {_preview_state_keys(missing)}") + print(f"Unexpected keys ({len(unexpected)}): {_preview_state_keys(unexpected)}") + raise RuntimeError( + f"Strict Strategy 2 bootstrap failed for {target_name} from {Path(checkpoint_path).resolve()}. " + f"Missing keys={len(missing)}, unexpected keys={len(unexpected)}." + ) + + try: + load_result = target_module.load_state_dict(extracted, strict=True) + except Exception as exc: + section(f"Strategy 2 Bootstrap Strict Load Failure | {target_name}") + print(f"Checkpoint : {Path(checkpoint_path).resolve()}") + print(f"Checkpoint prefix : {checkpoint_prefix}") + print(f"Target tensors : {len(target_state)}") + print(f"Checkpoint tensors : {len(extracted)}") + raise RuntimeError( + f"Strict Strategy 2 bootstrap load failed for {target_name} from " + f"{Path(checkpoint_path).resolve()}: {exc}" + ) from exc + + post_missing = list(getattr(load_result, "missing_keys", [])) + post_unexpected = list(getattr(load_result, "unexpected_keys", [])) + if post_missing or post_unexpected: + raise RuntimeError( + f"Strict Strategy 2 bootstrap reported residual mismatches for {target_name}: " + f"missing={post_missing}, unexpected={post_unexpected}" + ) + + section(f"Strategy 2 Bootstrap OK | {target_name}") + print(f"Checkpoint : {Path(checkpoint_path).resolve()}") + print(f"Checkpoint prefix : {checkpoint_prefix}") + print(f"Loaded tensors : {len(extracted)}") + print("Strict load : passed") + +def _use_channels_last_for_run(model_config: RuntimeModelConfig | None = None) -> bool: + model_config = (model_config or current_model_config()).validate() + if not USE_CHANNELS_LAST: + return False + if DEVICE.type != "cuda": + return False + amp_dtype = resolve_amp_dtype(AMP_DTYPE) + if ( + model_config.backbone_family == "smp" + and "efficientnet" in model_config.smp_encoder_name.lower() + and USE_AMP + and amp_dtype in {torch.float16, torch.bfloat16} + ): + print("[MemoryFormat] Disabling channels_last for EfficientNet + AMP stability.") + return False + return True + +def build_model( + strategy: int, + dropout_p: float, + *, + model_config: RuntimeModelConfig, + strategy2_checkpoint_path: str | Path | None = None, +) -> tuple[nn.Module, str, bool]: + strategy = _require_supported_strategy(strategy) + model_config = model_config.validate() + if model_config.backbone_family == "custom_vgg": + raise RuntimeError( + "The custom VGG backbone has been removed. Use backbone_family='smp'." + ) + if True: + if strategy == 2: + model = SupervisedSMPModel( + arch=model_config.smp_decoder_type, + encoder_name=model_config.smp_encoder_name, + encoder_weights=model_config.smp_encoder_weights, + encoder_depth=model_config.smp_encoder_depth, + dropout_p=dropout_p, + ) + elif strategy == 3: + model = PixelDRLMG_WithDecoder( + arch=model_config.smp_decoder_type, + encoder_name=model_config.smp_encoder_name, + encoder_weights=model_config.smp_encoder_weights, + encoder_depth=model_config.smp_encoder_depth, + proj_dim=model_config.smp_encoder_proj_dim, + dropout_p=dropout_p, + ) + model.strategy2_bootstrap_loaded = bool(strategy2_checkpoint_path is not None) + model.freeze_bootstrapped_segmentation = False + if strategy2_checkpoint_path is not None: + freeze_bootstrapped_segmentation = _strategy3_requested_bootstrap_freeze() + ckpt = _load_strategy2_checkpoint_payload(strategy2_checkpoint_path, model_config=model_config) + s2_state = ckpt["model_state_dict"] + _strict_load_strategy2_submodule( + model.smp_model, + checkpoint_state_dict=s2_state, + checkpoint_prefix="smp_model.", + checkpoint_path=strategy2_checkpoint_path, + target_name="strategy3.smp_model", + ) + if freeze_bootstrapped_segmentation: + model.smp_model.encoder.requires_grad_(False) + model.smp_model.decoder.requires_grad_(False) + if hasattr(model.smp_model, "segmentation_head"): + model.smp_model.segmentation_head.requires_grad_(False) + if hasattr(model, "projection") and model.projection is not None: + model.projection.requires_grad_(True) + model.freeze_bootstrapped_segmentation = bool(freeze_bootstrapped_segmentation) + model._keep_bootstrapped_segmentation_in_eval() + else: + raise ValueError(f"Unsupported strategy: {strategy}") + + use_channels_last_now = _use_channels_last_for_run(model_config) + if strategy == 3: + classifier = getattr(getattr(_unwrap_compiled(model), "policy_head", None), "classifier", None) + if isinstance(classifier, nn.Conv2d) and int(classifier.out_channels) != 1: + raise RuntimeError("Strategy 3 expects a continuous 1-channel policy head.") + _strategy3_bump_mc_cache_fingerprint( + model, + strategy2_checkpoint_path=strategy2_checkpoint_path, + ) + model = model.to(DEVICE) + if use_channels_last_now: + model = model.to(memory_format=torch.channels_last) + + compiled = False + if USE_TORCH_COMPILE and hasattr(torch, "compile"): + try: + model = torch.compile(model) + compiled = True + except Exception as exc: + print(f"[Compile] torch.compile skipped: {exc}") + return model, strategy_name(strategy, model_config), compiled + +def _unwrap_compiled(model: nn.Module) -> nn.Module: + return getattr(model, "_orig_mod", model) + +def count_parameters(module: nn.Module | None, *, only_trainable: bool = False) -> int: + if module is None: + return 0 + if only_trainable: + return sum(p.numel() for p in module.parameters() if p.requires_grad) + return sum(p.numel() for p in module.parameters()) + +def print_model_parameter_summary( + *, + model: nn.Module, + description: str, + strategy: int, + model_config: RuntimeModelConfig, + dropout_p: float, + amp_dtype: torch.dtype, + compiled: bool, +) -> None: + raw = _unwrap_compiled(model) + total_params = count_parameters(raw) + trainable_params = count_parameters(raw, only_trainable=True) + frozen_params = total_params - trainable_params + bn_count = sum(1 for m in raw.modules() if isinstance(m, (nn.BatchNorm2d, nn.BatchNorm1d))) + gn_count = sum(1 for m in raw.modules() if isinstance(m, nn.GroupNorm)) + + section(f"Model Parameter Summary | {description}") + print(f"Strategy : {strategy}") + print(f"Model : {description}") + print(f"Dropout p : {dropout_p:.4f}") + print(f"Total params : {total_params:,}") + print(f"Trainable params : {trainable_params:,}") + print(f"Frozen params : {frozen_params:,}") + print(f"BN layers : {bn_count}") + print(f"GN layers : {gn_count}") + print(f"channels_last : {_use_channels_last_for_run(model_config)}") + print(f"AMP dtype : {amp_dtype}") + print(f"torch.compile : {compiled}") + print(f"Backbone family : {model_config.backbone_family}") + if strategy == 3: + print(f"S3 variant : {_strategy3_variant()}") + freeze_status = _strategy3_bootstrap_freeze_status(model) + print(f"S3 bootstrap loaded : {freeze_status['bootstrap_loaded']}") + print(f"S3 freeze requested : {freeze_status['freeze_requested']}") + print(f"S3 frozen now : {freeze_status['freeze_active']}") + print(f"S3 encoder state : {freeze_status['encoder_state']}") + if freeze_status["decoder_state"] != "n/a": + print(f"S3 decoder state : {freeze_status['decoder_state']}") + if freeze_status["segmentation_head_state"] != "n/a": + print(f"S3 seg head state : {freeze_status['segmentation_head_state']}") + + block_counts: dict[str, int] = {} + if strategy == 2: + if hasattr(raw, "smp_model"): + smp_model = raw.smp_model + block_counts["encoder"] = count_parameters(getattr(smp_model, "encoder", None)) + block_counts["decoder"] = count_parameters(getattr(smp_model, "decoder", None)) + block_counts["segmentation_head"] = count_parameters(getattr(smp_model, "segmentation_head", None)) + block_counts["dropout"] = count_parameters(getattr(raw, "dropout", None)) + else: + block_counts["encoder"] = count_parameters(getattr(raw, "encoder", None)) + block_counts["segmentation_head"] = count_parameters(getattr(raw, "segmentation_head", None)) + elif strategy == 3: + if hasattr(raw, "smp_model"): + smp_model = raw.smp_model + block_counts["encoder"] = count_parameters(getattr(smp_model, "encoder", None)) + block_counts["decoder"] = count_parameters(getattr(smp_model, "decoder", None)) + block_counts["segmentation_head"] = count_parameters(getattr(smp_model, "segmentation_head", None)) + else: + block_counts["encoder"] = count_parameters(getattr(raw, "encoder", None)) + block_counts["segmentation_head"] = count_parameters(getattr(raw, "segmentation_head", None)) + block_counts["sam"] = count_parameters(getattr(raw, "sam", None)) + block_counts["policy_head"] = count_parameters(getattr(raw, "policy_head", None)) + block_counts["value_head"] = count_parameters(getattr(raw, "value_head", None)) + + for name, value in block_counts.items(): + print(f"{name:22s}: {value:,}") + +"""============================================================================= +METRICS + CHECKPOINTS +============================================================================= +""" + +_EPS = 1e-4 + +def _as_bool(mask: np.ndarray) -> np.ndarray: + return (mask[0] if mask.ndim == 3 else mask).astype(bool) + +def _tp_fp_fn(pred: np.ndarray, target: np.ndarray): + p, t = _as_bool(pred), _as_bool(target) + tp = float((p & t).sum()) + fp = float((p & ~t).sum()) + fn = float((~p & t).sum()) + return tp, fp, fn, float(t.sum()), float(p.sum()) + +def dice_score(pred: np.ndarray, target: np.ndarray) -> float: + tp, _, _, t, p = _tp_fp_fn(pred, target) + return (2 * tp + _EPS) / (t + p + _EPS) + +def ppv_score(pred: np.ndarray, target: np.ndarray) -> float: + tp, fp, *_ = _tp_fp_fn(pred, target) + return (tp + _EPS) / (tp + fp + _EPS) + +def sensitivity_score(pred: np.ndarray, target: np.ndarray) -> float: + tp, _, fn, *_ = _tp_fp_fn(pred, target) + return (tp + _EPS) / (tp + fn + _EPS) + +def iou_score(pred: np.ndarray, target: np.ndarray) -> float: + tp, _, _, t, p = _tp_fp_fn(pred, target) + return (tp + _EPS) / (t + p - tp + _EPS) + +def _boundary_1px(mask: np.ndarray) -> np.ndarray: + m = _as_bool(mask) + if not m.any(): + return m + return m ^ ndimage.binary_erosion(m, iterations=1, border_value=0) + +def boundary_iou_contour_score(pred: np.ndarray, target: np.ndarray) -> float: + pb, tb = _boundary_1px(pred), _boundary_1px(target) + inter = float((pb & tb).sum()) + union = float((pb | tb).sum()) + return (inter + _EPS) / (union + _EPS) + +def _biou_d(img_hw: tuple[int, int]) -> int: + """Resolve the Boundary IoU dilation width d for a given image size.""" + d = int(BOUNDARY_IOU_D) + if d > 0: + return d + height, width = img_hw + return max(1, int(round(0.02 * math.hypot(height, width)))) + +def _boundary_band(mask: np.ndarray, d: int) -> np.ndarray: + """Return the d-pixel inner boundary band used by paper-standard BIoU.""" + m = _as_bool(mask) + if not m.any(): + return m + eroded = ndimage.binary_erosion(m, iterations=max(int(d), 1), border_value=0) + return m & ~eroded + +def boundary_iou_score(pred: np.ndarray, target: np.ndarray) -> float: + """Boundary IoU from Cheng et al. CVPR 2021 using a d-pixel inner band.""" + height, width = _as_bool(target).shape + d = _biou_d((height, width)) + pb = _boundary_band(pred, d) + tb = _boundary_band(target, d) + inter = float((pb & tb).sum()) + union = float((pb | tb).sum()) + return (inter + _EPS) / (union + _EPS) + +def _surf_dist(a: np.ndarray, b: np.ndarray) -> np.ndarray: + a, b = _as_bool(a), _as_bool(b) + if not a.any() and not b.any(): + return np.array([0.0], dtype=np.float32) + if not a.any() or not b.any(): + return np.array([np.inf], dtype=np.float32) + ba, bb = _boundary_1px(a), _boundary_1px(b) + return ndimage.distance_transform_edt(~bb)[ba].astype(np.float32) + +def hd95_score(pred: np.ndarray, target: np.ndarray) -> float: + distances = np.concatenate([_surf_dist(pred, target), _surf_dist(target, pred)]) + if np.isinf(distances).any(): + height, width = _as_bool(target).shape + return float(math.hypot(height, width)) + return float(np.percentile(distances, 95)) + +def compute_all_metrics(pred: np.ndarray, target: np.ndarray) -> dict[str, float]: + return { + "dice": dice_score(pred, target), + "ppv": ppv_score(pred, target), + "sen": sensitivity_score(pred, target), + "iou": iou_score(pred, target), + "biou": boundary_iou_score(pred, target), + "biou_contour": boundary_iou_contour_score(pred, target), + "hd95": hd95_score(pred, target), + } + +def checkpoint_manifest_path(path: Path) -> Path: + path = Path(path) + return path.with_name(f"{path.name}.meta.json") + +def checkpoint_history_path(run_dir: Path, run_type: str) -> Path: + if run_type == "overfit": + return Path(run_dir) / "overfit_history.json" + return Path(run_dir) / "history.json" + +def checkpoint_state_presence(payload: dict[str, Any]) -> dict[str, bool]: + tracked = [ + "model_state_dict", + "optimizer_state_dict", + "scheduler_state_dict", + "scaler_state_dict", + "log_alpha", + "alpha_optimizer_state_dict", + "best_metric_name", + "best_metric_value", + "patience_counter", + "elapsed_seconds", + "run_config", + "epoch_metrics", + "history", + "resume_source", + ] + return {name: name in payload for name in tracked} + +def write_checkpoint_manifest( + path: Path, + payload: dict[str, Any], + *, + extra: dict[str, Any] | None = None, +) -> dict[str, Any]: + run_config = checkpoint_run_config_payload(payload) + manifest = { + "checkpoint_path": str(Path(path).resolve()), + "run_type": payload.get("run_type", "unknown"), + "epoch": int(payload.get("epoch", 0)), + "strategy": run_config.get("strategy"), + "dataset_percent": run_config.get("dataset_percent"), + "backbone_family": run_config.get("backbone_family", "smp"), + "saved_keys": sorted(payload.keys()), + "state_presence": checkpoint_state_presence(payload), + } + if "resume_source" in payload: + manifest["resume_source"] = payload["resume_source"] + if extra: + manifest.update(extra) + save_json(checkpoint_manifest_path(path), manifest) + return manifest + +def checkpoint_required_keys( + *, + optimizer: torch.optim.Optimizer | None, + scheduler: CosineAnnealingLR | None, + scaler: Any | None, + log_alpha: torch.Tensor | None, + alpha_optimizer: torch.optim.Optimizer | None, + require_run_metadata: bool, +) -> list[str]: + keys = ["epoch", "model_state_dict"] + if require_run_metadata: + keys.extend( + [ + "run_type", + "best_metric_name", + "best_metric_value", + "patience_counter", + "elapsed_seconds", + "run_config", + "epoch_metrics", + ] + ) + if optimizer is not None: + keys.append("optimizer_state_dict") + if scheduler is not None: + keys.append("scheduler_state_dict") + if scaler is not None: + keys.append("scaler_state_dict") + if log_alpha is not None: + keys.append("log_alpha") + if alpha_optimizer is not None: + keys.append("alpha_optimizer_state_dict") + return keys + +def validate_checkpoint_payload( + path: Path, + payload: dict[str, Any], + *, + required_keys: list[str], + expected_run_type: str | None = None, +) -> None: + missing = [name for name in required_keys if name not in payload] + if missing: + raise KeyError(f"Checkpoint {path} is missing required keys: {missing}") + if expected_run_type is not None and payload.get("run_type") != expected_run_type: + raise ValueError( + f"Checkpoint {path} run_type mismatch: expected {expected_run_type!r}, " + f"got {payload.get('run_type')!r}." + ) + +def save_checkpoint( + path: Path, + *, + run_type: str, + model: nn.Module, + optimizer: torch.optim.Optimizer, + scheduler: ReduceLROnPlateau | None, + scaler: Any | None, + epoch: int, + best_metric_value: float, + best_metric_name: str, + run_config: dict[str, Any], + epoch_metrics: dict[str, Any], + patience_counter: int, + elapsed_seconds: float, + history: list[dict[str, Any]] | None = None, + log_alpha: torch.Tensor | None = None, + alpha_optimizer: torch.optim.Optimizer | None = None, + resume_source: dict[str, Any] | None = None, +) -> None: + payload = { + "run_type": run_type, + "epoch": epoch, + "model_state_dict": _unwrap_compiled(model).state_dict(), + "optimizer_state_dict": optimizer.state_dict(), + "best_metric_name": best_metric_name, + "best_metric_value": best_metric_value, + "patience_counter": int(patience_counter), + "elapsed_seconds": float(elapsed_seconds), + "run_config": run_config, + "config": run_config, + "epoch_metrics": epoch_metrics, + } + if history is not None: + payload["history"] = [dict(row) for row in history] + if scheduler is not None: + payload["scheduler_state_dict"] = scheduler.state_dict() + if scaler is not None: + payload["scaler_state_dict"] = scaler.state_dict() + if log_alpha is not None: + payload["log_alpha"] = float(log_alpha.detach().item()) + if alpha_optimizer is not None: + payload["alpha_optimizer_state_dict"] = alpha_optimizer.state_dict() + if resume_source is not None: + payload["resume_source"] = resume_source + validate_checkpoint_payload( + path, + payload, + required_keys=checkpoint_required_keys( + optimizer=optimizer, + scheduler=scheduler, + scaler=scaler, + log_alpha=log_alpha, + alpha_optimizer=alpha_optimizer, + require_run_metadata=True, + ), + expected_run_type=run_type, + ) + torch.save(payload, path) + write_checkpoint_manifest(path, payload) + +def load_checkpoint( + path: Path, + *, + model: nn.Module, + optimizer: torch.optim.Optimizer | None = None, + scheduler: ReduceLROnPlateau | None = None, + scaler: Any | None = None, + device: torch.device, + log_alpha: torch.Tensor | None = None, + alpha_optimizer: torch.optim.Optimizer | None = None, + expected_run_type: str | None = None, + require_run_metadata: bool = False, +) -> dict[str, Any]: + ckpt = torch.load(path, map_location=device, weights_only=False) + validate_checkpoint_payload( + path, + ckpt, + required_keys=checkpoint_required_keys( + optimizer=optimizer, + scheduler=scheduler, + scaler=scaler, + log_alpha=log_alpha, + alpha_optimizer=alpha_optimizer, + require_run_metadata=require_run_metadata, + ), + expected_run_type=expected_run_type, + ) + + raw_model = _unwrap_compiled(model) + state_dict = ckpt["model_state_dict"] + load_strict = True + compat_layout: dict[str, Any] | None = None + _configure_policy_head_compatibility(model, state_dict, source=str(path)) + if any(key.startswith("policy_head.net.") for key in state_dict): + state_dict = _remap_legacy_policy_head_state_dict(state_dict) + if isinstance(raw_model, PixelDRLMG_WithDecoder): + compat_layout = _strategy3_checkpoint_layout_info(ckpt["model_state_dict"], checkpoint_run_config_payload(ckpt)) + if compat_layout["is_strategy3_decoder_checkpoint"]: + if compat_layout.get("policy_action_count") not in (None, 1): + raise RuntimeError( + "Incompatible legacy Strategy 3 checkpoint detected during restore. " + f"Checkpoint={path} policy_head_out_channels={compat_layout.get('policy_action_count')}. " + "Resume/eval from pre-redesign Strategy 3 checkpoints is not supported." + ) + _configure_strategy3_model_compatibility(model, compat_layout, source=str(path)) + _ensure_strategy3_refinement_adapter_compatible(model, state_dict, checkpoint_path=path) + load_strict = bool(compat_layout["use_refinement"]) + + incompatible = raw_model.load_state_dict(state_dict, strict=load_strict) + if hasattr(raw_model, "clear_strategy3_mc_cache"): + _strategy3_bump_mc_cache_fingerprint(raw_model, eval_checkpoint_path=path) + if not load_strict: + missing_keys = [key for key in incompatible.missing_keys if not key.startswith(("refinement_adapter.", "multi_scale_refine."))] + unexpected_keys = list(incompatible.unexpected_keys) + if missing_keys or unexpected_keys: + print( + "[Checkpoint Restore] Non-strict legacy Strategy 3 load " + f"missing={missing_keys} unexpected={unexpected_keys}" + ) + + if optimizer is not None and "optimizer_state_dict" in ckpt: + try: + optimizer.load_state_dict(ckpt["optimizer_state_dict"]) + except ValueError: + if compat_layout is None or compat_layout.get("compatibility_mode") != "legacy": + raise + print( + f"[Checkpoint Restore] Skipping optimizer state for legacy Strategy 3 checkpoint at {path} " + "because the parameter layout differs from the refinement-capable model." + ) + if scheduler is not None and "scheduler_state_dict" in ckpt: + scheduler.load_state_dict(ckpt["scheduler_state_dict"]) + if scaler is not None and "scaler_state_dict" in ckpt: + scaler.load_state_dict(ckpt["scaler_state_dict"]) + if log_alpha is not None and "log_alpha" in ckpt: + with torch.no_grad(): + log_alpha.fill_(float(ckpt["log_alpha"])) + if alpha_optimizer is not None and "alpha_optimizer_state_dict" in ckpt: + alpha_optimizer.load_state_dict(ckpt["alpha_optimizer_state_dict"]) + restored = checkpoint_state_presence(ckpt) + restore_info = { + "restored_keys": restored, + "restored_at_epoch": int(ckpt.get("epoch", 0)), + "expected_run_type": expected_run_type, + } + write_checkpoint_manifest(path, ckpt, extra={"last_restore": restore_info}) + print( + f"[Checkpoint Restore] path={path} epoch={ckpt.get('epoch')} " + f"run_type={ckpt.get('run_type', 'unknown')} " + f"backbone={checkpoint_run_config_payload(ckpt).get('backbone_family', 'unknown')}" + ) + return ckpt + +"""============================================================================= +TRAINING + VALIDATION +============================================================================= +""" + +def _policy_log_probs_and_entropy(policy_logits: torch.Tensor) -> tuple[torch.Tensor, torch.Tensor]: + logits = policy_logits.float() + log_probs = F.log_softmax(logits, dim=1) + probs = log_probs.exp() + entropy = -(probs * log_probs).sum(dim=1).mean() + return log_probs, entropy + +def _log_prob_for_actions(log_probs: torch.Tensor, actions: torch.Tensor) -> torch.Tensor: + return log_probs.gather(1, actions.unsqueeze(1)) + +def sample_actions( + policy_logits: torch.Tensor, + stochastic: bool, + exploration_eps: float = 0.0, + keep_action_index: int | None = None, +) -> tuple[torch.Tensor, torch.Tensor, torch.Tensor]: + logits = policy_logits.float() + log_probs, entropy = _policy_log_probs_and_entropy(policy_logits) + if stochastic: + uniform = torch.rand_like(logits) + gumbel = -torch.log(-torch.log(uniform + 1e-8) + 1e-8) + actions = (logits + gumbel).argmax(dim=1) + if exploration_eps > 0: + keep_index = _keep_action_index(logits.shape[1]) if keep_action_index is None else int(keep_action_index) + keep_actions = torch.full_like(actions, keep_index) + random_mask = torch.rand(actions.shape, device=actions.device) < exploration_eps + actions = torch.where(random_mask, keep_actions, actions) + else: + actions = logits.argmax(dim=1) + log_prob = _log_prob_for_actions(log_probs, actions) + return actions, log_prob, entropy + +def apply_actions( + seg: torch.Tensor, + actions: torch.Tensor, + *, + num_actions: int | None = None, +) -> torch.Tensor: + num_actions = int(num_actions if num_actions is not None else _job_param("num_actions", DEFAULT_STRATEGY3_NUM_ACTIONS)) + if num_actions >= 3: + deltas = _refinement_deltas(action_count=num_actions, device=seg.device, dtype=seg.dtype) + delta = deltas[actions.long()].unsqueeze(1) + return (seg + delta).clamp_(0.0, 1.0) + action_map = actions.unsqueeze(1) + return seg * (action_map == 1).to(dtype=seg.dtype) + +def _soft_dice_tensor(pred: torch.Tensor, target: torch.Tensor) -> torch.Tensor: + inter = (pred * target).sum(dim=(1, 2, 3)) + denom = pred.sum(dim=(1, 2, 3)) + target.sum(dim=(1, 2, 3)) + return (2.0 * inter + 1e-6) / (denom + 1e-6) + +def _soft_iou_tensor(pred: torch.Tensor, target: torch.Tensor) -> torch.Tensor: + inter = (pred * target).sum(dim=(1, 2, 3)) + union = pred.sum(dim=(1, 2, 3)) + target.sum(dim=(1, 2, 3)) - inter + return (inter + 1e-6) / (union + 1e-6) + +def _soft_recall_tensor(pred: torch.Tensor, target: torch.Tensor) -> torch.Tensor: + true_positive = (pred * target).sum(dim=(1, 2, 3)) + positives = target.sum(dim=(1, 2, 3)) + return (true_positive + 1e-6) / (positives + 1e-6) + +def _soft_boundary(mask: torch.Tensor) -> torch.Tensor: + return (mask - F.avg_pool2d(mask, kernel_size=3, stride=1, padding=1)).abs() + +def _differentiable_boundary(mask: torch.Tensor, kernel_size: int = 3) -> torch.Tensor: + padding = kernel_size // 2 + mask_f = mask.float().clamp(0.0, 1.0) + eroded = 1.0 - F.max_pool2d(1.0 - mask_f, kernel_size, stride=1, padding=padding) + return (mask_f - eroded).clamp(0.0, 1.0) + +def _soft_iou_per_sample(pred: torch.Tensor, target: torch.Tensor) -> torch.Tensor: + pred_f = pred.float().clamp(0.0, 1.0) + target_f = target.float().clamp(0.0, 1.0) + inter = (pred_f * target_f).sum(dim=(2, 3), keepdim=True) + union = (pred_f + target_f - pred_f * target_f).sum(dim=(2, 3), keepdim=True) + return inter / (union + 1e-6) + +def differentiable_biou_loss( + pred: torch.Tensor, + target: torch.Tensor, + kernel_size: int | None = None, + *, + reduction: str = "mean", +) -> torch.Tensor: + if kernel_size is None: + height, width = int(pred.shape[-2]), int(pred.shape[-1]) + d = _biou_d((height, width)) + kernel_size = 2 * d + 1 + kernel_size = max(int(kernel_size), 1) + if kernel_size % 2 == 0: + kernel_size += 1 + pred_boundary = _differentiable_boundary(pred, kernel_size=kernel_size) + target_boundary = _differentiable_boundary(target, kernel_size=kernel_size) + inter = (pred_boundary * target_boundary).sum(dim=(1, 2, 3), keepdim=True) + union = (pred_boundary + target_boundary - pred_boundary * target_boundary).sum(dim=(1, 2, 3), keepdim=True) + loss = 1.0 - (inter + 1e-6) / (union + 1e-6) + if reduction == "none": + return loss + if reduction == "mean": + return loss.mean() + raise ValueError(f"Unsupported differentiable_biou_loss reduction {reduction!r}.") + +def _strategy3_expected_next_mask( + policy_logits: torch.Tensor, + base_seg: torch.Tensor, + *, + action_count: int, +) -> tuple[torch.Tensor, torch.Tensor]: + logits_f = policy_logits.float() + base_seg_f = base_seg.float() + probs = F.softmax(logits_f, dim=1) + deltas = _refinement_deltas(action_count=action_count, device=logits_f.device, dtype=logits_f.dtype) + expected_delta = (probs * deltas.view(1, -1, 1, 1)).sum(dim=1, keepdim=True) + predicted_next = (base_seg_f + expected_delta).clamp(1e-4, 1.0 - 1e-4) + return predicted_next, deltas + +def _strategy3_action_targets( + seg_mask: torch.Tensor, + gt_mask: torch.Tensor, + deltas: torch.Tensor, +) -> torch.Tensor: + target_delta = gt_mask.float() - seg_mask.float() + return (target_delta - deltas.view(1, -1, 1, 1)).abs().argmin(dim=1) + +def compute_refinement_reward( + seg: torch.Tensor, + seg_next: torch.Tensor, + gt_mask: torch.Tensor, + *, + return_details: bool = False, +) -> torch.Tensor | tuple[torch.Tensor, dict[str, torch.Tensor]]: + seg_f = seg.float() + seg_next_f = seg_next.float() + gt_f = gt_mask.float().clamp(0.0, 1.0) + + # R1 (progress reward) DISABLED. The AB3_r3_only ablation (progress weight = 0, + # differentiable-BIoU reward kept) matched the full-reward model within noise + # (paired Wilcoxon n.s. vs base), so the progress term is dropped. Forced to 0.0 + # here at the point of use so R1 is off regardless of param JSON / Optuna search. + r1_weight = 0.0 # was: float(_job_param("strategy3_r1_progress_weight", DEFAULT_STRATEGY3_R1_PROGRESS_WEIGHT)) + biou_reward_weight = float(_job_param("biou_reward_weight", DEFAULT_BIOU_REWARD_WEIGHT)) + + target_dir = 2.0 * gt_f - 1.0 + progress = target_dir * (seg_next_f - seg_f) + room = gt_f * (1.0 - seg_f) + (1.0 - gt_f) * seg_f + r1 = r1_weight * progress * room + + biou_before = 1.0 - differentiable_biou_loss(seg_f, gt_f, reduction="none") + biou_next = 1.0 - differentiable_biou_loss(seg_next_f, gt_f, reduction="none") + biou_delta = biou_next - biou_before + r3 = biou_reward_weight * biou_delta.expand_as(seg_next_f) + + reward = (r1 + r3).clamp(-3.0, 3.0) + if not return_details: + return reward + return reward, { + "biou_before": biou_before, + "biou_next": biou_next, + "biou_delta": biou_delta, + } + +def compute_strategy1_aux_segmentation_loss( + policy_logits: torch.Tensor, + gt_mask: torch.Tensor, + *, + ce_weight: float, + dice_weight: float, + seg_mask: torch.Tensor | None = None, +) -> tuple[torch.Tensor, float, float]: + logits_f = policy_logits.float() + gt_mask_f = gt_mask.float() + num_actions = int(logits_f.shape[1]) + + if num_actions >= 3: + base_seg = seg_mask.float() if seg_mask is not None else torch.full_like(gt_mask_f, 0.5) + predicted_next, deltas = _strategy3_expected_next_mask( + policy_logits, + base_seg, + action_count=num_actions, + ) + action_targets = _strategy3_action_targets(base_seg, gt_mask_f, deltas) + + aux_loss = torch.zeros((), device=policy_logits.device, dtype=torch.float32) + ce_loss_value = 0.0 + dice_loss_value = 0.0 + boundary_dice_w = float(_job_param("strategy3_aux_boundary_dice_weight", 0.0)) + + threshold = float(_job_param("threshold", CONTROLLED_MASK_THRESHOLD)) + delta_large = float(_job_param("refine_delta_large", DEFAULT_REFINE_DELTA_LARGE)) + hard_margin = delta_large * 1.5 + with torch.no_grad(): + dist_to_thresh = (base_seg - threshold).abs() + hard_mask = (dist_to_thresh < hard_margin).squeeze(1) + + if ce_weight > 0: + action_ce_mix = float(_job_param("aux_action_ce_mix", 0.75)) + action_ce_mix = min(max(action_ce_mix, 0.0), 1.0) + + if hard_mask.any(): + logits_hw = policy_logits.float().permute(0, 2, 3, 1) + targets_hw = action_targets + action_ce = F.cross_entropy(logits_hw[hard_mask], targets_hw[hard_mask]) + else: + action_ce = F.cross_entropy(policy_logits.float(), action_targets) + + predicted_next_logits = torch.logit(predicted_next) + if hard_mask.any(): + gt_hard = gt_mask_f.squeeze(1)[hard_mask] + pred_hard = predicted_next_logits.squeeze(1)[hard_mask] + bce = F.binary_cross_entropy_with_logits(pred_hard, gt_hard) + else: + bce = F.binary_cross_entropy_with_logits(predicted_next_logits, gt_mask_f) + + ce_term = action_ce_mix * action_ce + (1.0 - action_ce_mix) * bce + aux_loss = aux_loss + ce_weight * ce_term + ce_loss_value = float(ce_term.detach().item()) + + if dice_weight > 0: + inter = (predicted_next * gt_mask_f).sum() + dice_loss = 1.0 - (2.0 * inter + 1e-6) / (predicted_next.sum() + gt_mask_f.sum() + 1e-6) + aux_loss = aux_loss + dice_weight * dice_loss + dice_loss_value = float(dice_loss.detach().item()) + + if boundary_dice_w > 0: + bd_loss = differentiable_biou_loss(predicted_next, gt_mask_f) + aux_loss = aux_loss + boundary_dice_w * bd_loss + + return aux_loss, ce_loss_value, dice_loss_value + + aux_loss = torch.zeros((), device=policy_logits.device, dtype=torch.float32) + ce_loss_value = 0.0 + dice_loss_value = 0.0 + + if ce_weight > 0: + if num_actions >= 3: + if seg_mask is None: + seg_mask = torch.ones_like(gt_mask) + seg_bin = threshold_binary_long(seg_mask).squeeze(1) + gt_bin = gt_mask[:, 0].long() + aux_target = torch.where( + gt_bin == 0, + torch.zeros_like(gt_bin), + torch.where(seg_bin == 1, torch.ones_like(gt_bin), torch.full_like(gt_bin, 2)), + ) + else: + aux_target = gt_mask[:, 0].long() * (num_actions - 1) + ce_loss = F.cross_entropy(logits_f, aux_target) + aux_loss = aux_loss + ce_weight * ce_loss + ce_loss_value = float(ce_loss.detach().item()) + + if dice_weight > 0: + probs_fg = F.softmax(logits_f, dim=1)[:, num_actions - 1 : num_actions] + inter = (probs_fg * gt_mask_f).sum() + dice_loss = 1.0 - (2.0 * inter + 1e-6) / (probs_fg.sum() + gt_mask_f.sum() + 1e-6) + aux_loss = aux_loss + dice_weight * dice_loss + dice_loss_value = float(dice_loss.detach().item()) + + return aux_loss, ce_loss_value, dice_loss_value + +def make_optimizer( + model: nn.Module, + strategy: int, + head_lr: float, + encoder_lr: float, + weight_decay: float, + rl_lr: float | None = None, +): + raw = _unwrap_compiled(model) + encoder_params = [] + decoder_params = [] + rl_params = [] + + for name, param in raw.named_parameters(): + if not param.requires_grad: + continue + if ( + name.startswith("extractor.encoder.") + or name.startswith("encoder.") + or name.startswith("smp_model.encoder.") + or name.startswith("smp_encoder.") + ): + encoder_params.append(param) + elif "decoder" in name or "segmentation_head" in name: + decoder_params.append(param) + else: + rl_params.append(param) + + decoder_lr = float(_job_param("decoder_lr", head_lr)) + rl_group_lr = float(_job_param("rl_lr", rl_lr if rl_lr is not None else head_lr)) + + param_groups: list[dict[str, Any]] = [] + + if encoder_params: + param_groups.append({"params": encoder_params, "lr": encoder_lr}) + + if decoder_params: + param_groups.append({"params": decoder_params, "lr": decoder_lr}) + + if rl_params: + param_groups.append({"params": rl_params, "lr": rl_group_lr}) + + try: + optimizer = AdamW(param_groups, weight_decay=weight_decay, fused=DEVICE.type == "cuda") + except Exception: + optimizer = AdamW(param_groups, weight_decay=weight_decay) + + return optimizer + +def infer_segmentation_mask( + model: nn.Module, + image: torch.Tensor, + tmax: int, + *, + strategy: int, + use_amp: bool, + amp_dtype: torch.dtype, + use_channels_last: bool, + sample_ids: list[str] | None = None, + mc_cache_split: Literal["train", "val", "test"] | None = None, + mc_cache_run_dir: Path | None = None, +) -> torch.Tensor: + model.eval() + if use_channels_last and image.ndim == 4 and image.device.type == "cuda": + image = image.contiguous(memory_format=torch.channels_last) + + if strategy == 2: + with autocast_ctx(enabled=use_amp, device=image.device, amp_dtype=amp_dtype): + logits = model(image) + return threshold_binary_mask(torch.sigmoid(logits)).float() + effective_tmax = _resolve_test_iteration_tmax(tmax, context="infer_segmentation_mask") + + refinement_runtime = _uses_refinement_runtime(model, strategy=strategy) + if strategy == 3 and refinement_runtime: + with autocast_ctx(enabled=use_amp, device=image.device, amp_dtype=amp_dtype): + refinement_context = model.prepare_refinement_context( + image, + sample_ids=sample_ids, + mc_mode="eval", + mc_cache_split=mc_cache_split, + mc_cache_run_dir=mc_cache_run_dir, + ) + seg = refinement_context["decoder_prob"].float() + for _step_idx in range(effective_tmax): + with autocast_ctx(enabled=use_amp, device=image.device, amp_dtype=amp_dtype): + state_t = model.forward_refinement_state( + refinement_context["base_features"], + seg, + refinement_context["decoder_prob"], + refinement_context["mc_variance"], + refinement_context["pred_entropy"], + encoder_features=refinement_context.get("encoder_features"), + ) + policy_raw, _value_t = model.forward_from_state(state_t) + delta = _strategy3_policy_delta(policy_raw).to(dtype=seg.dtype) + seg = _strategy3_apply_delta(seg, delta) + return threshold_binary_mask(seg.float()).float() + + if strategy == 3: + with autocast_ctx(enabled=use_amp, device=image.device, amp_dtype=amp_dtype): + seg = threshold_binary_mask(torch.sigmoid(model.forward_decoder(image))).float() + else: + seg = torch.ones(image.shape[0], 1, image.shape[2], image.shape[3], device=image.device, dtype=image.dtype) + + for _ in range(effective_tmax): + with autocast_ctx(enabled=use_amp, device=image.device, amp_dtype=amp_dtype): + x_t = image * seg + policy_logits = model.forward_policy_only(x_t) + actions, _, _ = sample_actions(policy_logits, stochastic=False) + seg = apply_actions(seg, actions, num_actions=policy_logits.shape[1]).to(dtype=seg.dtype) + return seg.float() + +def train_step( + model: nn.Module, + batch: dict[str, Any], + optimizer: torch.optim.Optimizer, + *, + gamma: float, + tmax: int, + critic_loss_weight: float, + log_alpha: torch.Tensor, + alpha_optimizer: torch.optim.Optimizer, + target_entropy: float, + ce_weight: float, + dice_weight: float, + grad_clip_norm: float, + scaler: Any | None, + use_amp: bool, + amp_dtype: torch.dtype, + stepwise_backward: bool, + use_channels_last: bool, + initial_mask: torch.Tensor | None = None, + decoder_loss_extra: torch.Tensor | None = None, +) -> dict[str, Any]: + model.train() + _strategy3_keep_frozen_modules_in_eval(model) + image = batch["image"] + gt_mask = batch["mask"] + + if use_channels_last and image.ndim == 4 and image.device.type == "cuda": + image = image.contiguous(memory_format=torch.channels_last) + if use_amp and image.device.type == "cuda": + image = image.to(dtype=amp_dtype) + gt_mask = gt_mask.to(dtype=amp_dtype) + else: + image = image.float() + gt_mask = gt_mask.float() + + if initial_mask is not None: + seg = initial_mask.to(device=image.device, dtype=image.dtype) + else: + seg = torch.ones(image.shape[0], 1, image.shape[2], image.shape[3], device=image.device, dtype=image.dtype) + alpha = log_alpha.exp() + + total_actor = 0.0 + total_critic = 0.0 + total_loss = 0.0 + total_reward = 0.0 + total_entropy = 0.0 + total_ce_loss = 0.0 + total_dice_loss = 0.0 + accum_tensor = None + alpha_loss_accum = torch.tensor(0.0, device=image.device, dtype=torch.float32) + aux_fused = False + + optimizer.zero_grad(set_to_none=True) + + for _ in range(tmax): + with autocast_ctx(enabled=use_amp, device=image.device, amp_dtype=amp_dtype): + x_t = image * seg + state_t, _ = model.forward_state(x_t) + policy_logits, value_t = model.forward_from_state(state_t) + actions, log_prob, entropy = sample_actions(policy_logits, stochastic=True) + log_prob = log_prob.clamp(min=-10.0) + seg_next = apply_actions(seg, actions, num_actions=policy_logits.shape[1]) + reward = (seg - gt_mask).pow(2) - (seg_next - gt_mask).pow(2) + + with torch.no_grad(): + with autocast_ctx(enabled=use_amp, device=image.device, amp_dtype=amp_dtype): + x_next = image * seg_next + state_next, _ = model.forward_state(x_next) + value_next = model.value_from_state(state_next).detach() + + neighborhood_next = _bootstrap_value_target(model, value_next) + target = reward + gamma * neighborhood_next + advantage = target - value_t + critic_loss = F.smooth_l1_loss(value_t, target) + actor_loss = -(log_prob * advantage.detach()).mean() + actor_loss = actor_loss - alpha.detach() * entropy + step_loss = (actor_loss + critic_loss_weight * critic_loss) / float(tmax) + alpha_loss_accum = alpha_loss_accum + (log_alpha * (entropy.detach() - target_entropy)) / float(tmax) + + if not aux_fused and initial_mask is None and (ce_weight > 0 or dice_weight > 0): + aux_loss, ce_loss_value, dice_loss_value = compute_strategy1_aux_segmentation_loss( + policy_logits, + gt_mask, + ce_weight=ce_weight, + dice_weight=dice_weight, + seg_mask=seg, + ) + if ce_weight > 0: + total_ce_loss = ce_loss_value + if dice_weight > 0: + total_dice_loss = dice_loss_value + step_loss = step_loss + aux_loss + aux_fused = True + + total_actor += float(actor_loss.detach().item()) + total_critic += float(critic_loss.detach().item()) + total_loss += float(step_loss.detach().item()) + total_reward += float(reward.detach().mean().item()) + total_entropy += float(entropy.detach().item()) + + if stepwise_backward: + if scaler is not None: + scaler.scale(step_loss).backward() + else: + step_loss.backward() + else: + accum_tensor = step_loss if accum_tensor is None else accum_tensor + step_loss + + seg = seg_next.detach() + + if not stepwise_backward and accum_tensor is not None: + if scaler is not None: + scaler.scale(accum_tensor).backward() + else: + accum_tensor.backward() + + if not aux_fused and (ce_weight > 0 or dice_weight > 0): + with autocast_ctx(enabled=use_amp, device=image.device, amp_dtype=amp_dtype): + policy_aux, _, _ = model(image) + logits_f = policy_aux.float() + aux_loss = torch.zeros(1, device=image.device, dtype=torch.float32) + if ce_weight > 0: + num_actions = int(logits_f.shape[1]) + if num_actions >= 3: + init_seg = initial_mask if initial_mask is not None else torch.ones_like(gt_mask) + seg_bin = threshold_binary_long(init_seg).squeeze(1) + gt_bin = gt_mask[:, 0].long() + aux_target = torch.where( + gt_bin == 0, + torch.zeros_like(gt_bin), + torch.where(seg_bin == 1, torch.ones_like(gt_bin), torch.full_like(gt_bin, 2)), + ) + else: + aux_target = gt_mask[:, 0].long() * (num_actions - 1) + ce_loss = F.cross_entropy(logits_f, aux_target) + aux_loss = aux_loss + ce_weight * ce_loss + total_ce_loss = float(ce_loss.detach().item()) + if dice_weight > 0: + probs_fg = F.softmax(logits_f, dim=1)[:, num_actions - 1 : num_actions] + gt_f = gt_mask.float() + inter = (probs_fg * gt_f).sum() + dice_loss = 1.0 - (2.0 * inter + 1e-6) / (probs_fg.sum() + gt_f.sum() + 1e-6) + aux_loss = aux_loss + dice_weight * dice_loss + total_dice_loss = float(dice_loss.detach().item()) + if decoder_loss_extra is not None: + aux_loss = aux_loss + decoder_loss_extra + if scaler is not None: + scaler.scale(aux_loss).backward() + else: + aux_loss.backward() + total_loss += float(aux_loss.detach().item()) + elif decoder_loss_extra is not None: + if scaler is not None: + scaler.scale(decoder_loss_extra).backward() + else: + decoder_loss_extra.backward() + total_loss += float(decoder_loss_extra.detach().item()) + + if scaler is not None: + scaler.unscale_(optimizer) + total_grad_norm = float(torch.nn.utils.clip_grad_norm_(model.parameters(), grad_clip_norm).item()) if grad_clip_norm > 0 else 0.0 + + if scaler is not None: + scaler.step(optimizer) + scaler.update() + else: + optimizer.step() + + alpha_optimizer.zero_grad(set_to_none=True) + alpha_loss_accum.backward() + alpha_optimizer.step() + with torch.no_grad(): + log_alpha.clamp_(min=_alpha_log_floor(), max=5.0) + + return { + "loss": total_loss, + "actor_loss": total_actor / tmax, + "critic_loss": total_critic / tmax, + "mean_reward": total_reward / tmax, + "entropy": total_entropy / tmax, + "ce_loss": total_ce_loss, + "dice_loss": total_dice_loss, + "grad_norm": total_grad_norm, + "grad_clip_used": grad_clip_norm, + "final_mask": seg.detach(), + } + +def train_step_strategy3( + model: nn.Module, + batch: dict[str, Any], + optimizer: torch.optim.Optimizer, + *, + gamma: float, + tmax: int, + critic_loss_weight: float, + log_alpha: torch.Tensor | None, + alpha_optimizer: torch.optim.Optimizer | None, + target_entropy: float, + ce_weight: float, + dice_weight: float, + grad_clip_norm: float, + scaler: Any | None, + use_amp: bool, + amp_dtype: torch.dtype, + stepwise_backward: bool, + use_channels_last: bool, + current_epoch: int, + max_epochs: int, +) -> dict[str, Any]: + if not _uses_refinement_runtime(model, strategy=3): + raise RuntimeError( + "Legacy non-refinement Strategy 3 training is not supported after the continuous Strategy 3 redesign." + ) + + model.train() + _strategy3_keep_frozen_modules_in_eval(model) + image = batch["image"] + gt_mask = batch["mask"] + if use_channels_last and image.ndim == 4 and image.device.type == "cuda": + image = image.contiguous(memory_format=torch.channels_last) + if use_amp and image.device.type == "cuda": + image = image.to(dtype=amp_dtype) + gt_mask = gt_mask.to(dtype=amp_dtype) + else: + image = image.float() + gt_mask = gt_mask.float() + + annealed_aux_ce_weight = _strategy3_annealed_aux_ce_weight(current_epoch) + del stepwise_backward, max_epochs, log_alpha, alpha_optimizer, target_entropy + + with autocast_ctx(enabled=use_amp, device=image.device, amp_dtype=amp_dtype): + refinement_context = model.prepare_refinement_context(image, mc_mode="train") + decoder_logits = refinement_context["decoder_logits"] + decoder_prob = refinement_context["decoder_prob"] + base_features = refinement_context["base_features"] + encoder_features = refinement_context.get("encoder_features") + mc_variance = refinement_context["mc_variance"] + pred_entropy = refinement_context["pred_entropy"] + seg = decoder_prob.detach().to(device=image.device, dtype=image.dtype) + loss_weights = _strategy3_loss_weights(model, ce_weight=ce_weight, dice_weight=dice_weight) + + decoder_loss = torch.zeros((), device=image.device, dtype=torch.float32) + decoder_ce_loss_value = 0.0 + decoder_dice_loss_value = 0.0 + with autocast_ctx(enabled=use_amp, device=image.device, amp_dtype=amp_dtype): + dl_f = decoder_logits.float() + gt_f = gt_mask.float() + if loss_weights["decoder_ce"] > 0: + decoder_ce = F.binary_cross_entropy_with_logits(dl_f, gt_f) + decoder_loss = decoder_loss + loss_weights["decoder_ce"] * decoder_ce + decoder_ce_loss_value = float(decoder_ce.detach().item()) + if loss_weights["decoder_dice"] > 0: + dm_prob = decoder_prob.float() + inter = (dm_prob * gt_f).sum() + decoder_dice = 1.0 - (2.0 * inter + 1e-6) / (dm_prob.sum() + gt_f.sum() + 1e-6) + decoder_loss = decoder_loss + loss_weights["decoder_dice"] * decoder_dice + decoder_dice_loss_value = float(decoder_dice.detach().item()) + + optimizer.zero_grad(set_to_none=True) + + a3c_grad_clip = float(_job_param("strategy3_rl_grad_clip_norm", DEFAULT_STRATEGY3_RL_GRAD_CLIP_NORM)) + + refinement_base_features = base_features + detached_decoder_prob = decoder_prob.detach() + detached_mc_variance = mc_variance.detach() + detached_pred_entropy = pred_entropy.detach() + detached_encoder_features = [f.detach() for f in encoder_features] if encoder_features is not None else None + + step_action_hists: list[dict[str, float]] = [] + step_mask_deltas: list[float] = [] + step_reward_means: list[float] = [] + step_reward_pos_pcts: list[float] = [] + step_reward_zero_pcts: list[float] = [] + step_biou_deltas: list[float] = [] + advantage_maps: list[torch.Tensor] = [] + critic_targets: list[torch.Tensor] = [] + value_maps: list[torch.Tensor] = [] + + actor_loss_tensor = torch.zeros((), device=image.device, dtype=torch.float32) + critic_loss_tensor = torch.zeros((), device=image.device, dtype=torch.float32) + total_actor = 0.0 + total_critic = 0.0 + total_reward = 0.0 + total_ce_loss = decoder_ce_loss_value + total_dice_loss = decoder_dice_loss_value + effective_steps = max(int(tmax), 1) + final_refined_seg_for_aux: torch.Tensor | None = None + + for _ in range(effective_steps): + seg_before = seg.detach() + with autocast_ctx(enabled=use_amp, device=image.device, amp_dtype=amp_dtype): + state_t = model.forward_refinement_state( + refinement_base_features, + seg_before, + detached_decoder_prob, + detached_mc_variance, + detached_pred_entropy, + encoder_features=detached_encoder_features, + ) + policy_raw, _value_t = model.forward_from_state(state_t) + delta = _strategy3_policy_delta(policy_raw).to(dtype=seg_before.dtype) + seg_next = _strategy3_apply_delta(seg_before, delta) + reward_map, reward_details = compute_refinement_reward( + seg_before, + seg_next, + gt_mask.float(), + return_details=True, + ) + + step_actor = -reward_map.mean() + + actor_loss_tensor = actor_loss_tensor + step_actor / float(effective_steps) + total_actor += float(step_actor.detach().item()) + total_reward += float(reward_map.detach().mean().item()) + + step_action_hists.append(_strategy3_delta_distribution(delta)) + step_mask_deltas.append(float(delta.detach().abs().mean().item())) + step_reward_means.append(float(reward_map.detach().mean().item())) + step_reward_pos_pcts.append(float((reward_map.detach() > 0).float().mean().item() * 100.0)) + step_reward_zero_pcts.append(float((reward_map.detach().abs() < 1e-8).float().mean().item() * 100.0)) + step_biou_deltas.append(float(reward_details["biou_delta"].detach().mean().item())) + final_refined_seg_for_aux = seg_next + seg = seg_next.detach() + + aux_loss_tensor = torch.zeros((), device=image.device, dtype=torch.float32) + aux_ce_loss_value = 0.0 + aux_dice_loss_value = 0.0 + if annealed_aux_ce_weight > 0.0 and final_refined_seg_for_aux is not None: + with autocast_ctx(enabled=use_amp, device=image.device, amp_dtype=amp_dtype): + refined_prob = final_refined_seg_for_aux.float().clamp(1e-6, 1.0 - 1e-6) + gt_f = gt_mask.float() + supervised_aux = torch.zeros((), device=image.device, dtype=torch.float32) + if ce_weight > 0: + refined_logits = torch.logit(refined_prob) + aux_ce = F.binary_cross_entropy_with_logits(refined_logits, gt_f) + supervised_aux = supervised_aux + float(ce_weight) * aux_ce + aux_ce_loss_value = float(aux_ce.detach().item()) + if dice_weight > 0: + inter = (refined_prob * gt_f).sum() + aux_dice = 1.0 - (2.0 * inter + 1e-6) / (refined_prob.sum() + gt_f.sum() + 1e-6) + supervised_aux = supervised_aux + float(dice_weight) * aux_dice + aux_dice_loss_value = float(aux_dice.detach().item()) + aux_loss_tensor = float(annealed_aux_ce_weight) * supervised_aux + total_ce_loss += aux_ce_loss_value + total_dice_loss += aux_dice_loss_value + + rl_loss_scale = float(_job_param("strategy3_rl_loss_scale", DEFAULT_STRATEGY3_RL_LOSS_SCALE)) + rl_loss = rl_loss_scale * (actor_loss_tensor + critic_loss_weight * critic_loss_tensor) + total_loss_tensor = decoder_loss + rl_loss + aux_loss_tensor + + if scaler is not None: + scaler.scale(total_loss_tensor).backward() + scaler.unscale_(optimizer) + else: + total_loss_tensor.backward() + + effective_grad_clip = a3c_grad_clip if a3c_grad_clip > 0 else grad_clip_norm + total_grad_norm = ( + float(torch.nn.utils.clip_grad_norm_(model.parameters(), effective_grad_clip).item()) + if effective_grad_clip > 0 + else 0.0 + ) + + if scaler is not None: + scaler.step(optimizer) + scaler.update() + else: + optimizer.step() + + adv_means: list[float] = [] + adv_stds: list[float] = [] + value_pred_errors: list[float] = [] + mean_value_pred = 0.0 + avg_action_dist: dict[str, float] = {} + if step_action_hists: + all_keys = set() + for h in step_action_hists: + all_keys.update(h.keys()) + for k in sorted(all_keys): + avg_action_dist[k] = float(np.mean([h.get(k, 0.0) for h in step_action_hists])) + + return { + "loss": float(total_loss_tensor.detach().item()), + "actor_loss": total_actor / float(effective_steps), + "critic_loss": total_critic / float(effective_steps), + "mean_reward": total_reward / float(effective_steps), + "entropy": 0.0, + "ce_loss": total_ce_loss, + "dice_loss": total_dice_loss, + "grad_norm": total_grad_norm, + "grad_clip_used": effective_grad_clip, + "final_mask": threshold_binary_mask(seg.detach().float()).float(), + "effective_steps": effective_steps, + "action_distribution": avg_action_dist, + "mask_delta_mean": float(np.mean(step_mask_deltas)) if step_mask_deltas else 0.0, + "reward_per_step": step_reward_means, + "reward_pos_pct_per_step": step_reward_pos_pcts, + "reward_zeros_pct": float(np.mean(step_reward_zero_pcts)) if step_reward_zero_pcts else 0.0, + "biou_delta_mean": float(np.mean(step_biou_deltas)) if step_biou_deltas else 0.0, + "advantage_mean": float(np.mean(adv_means)) if adv_means else 0.0, + "advantage_std": float(np.nanmean(adv_stds)) if adv_stds else 0.0, + "value_pred_error_mean": float(np.mean(value_pred_errors)) if value_pred_errors else 0.0, + "mean_value_pred": mean_value_pred, + "rl_loss_scale_used": float(rl_loss_scale), + "annealed_aux_ce_weight": float(annealed_aux_ce_weight), + "alpha": 0.0, + } + +def train_step_supervised( + model: nn.Module, + batch: dict[str, Any], + optimizer: torch.optim.Optimizer, + *, + scaler: Any | None, + use_amp: bool, + amp_dtype: torch.dtype, + use_channels_last: bool, + grad_clip_norm: float, + ce_weight: float = 0.5, + dice_weight: float = 0.5, +) -> dict[str, Any]: + model.train() + _strategy3_keep_frozen_modules_in_eval(model) + image = batch["image"] + gt_mask = batch["mask"] + + if use_channels_last and image.ndim == 4 and image.device.type == "cuda": + image = image.contiguous(memory_format=torch.channels_last) + if use_amp and image.device.type == "cuda": + image = image.to(dtype=amp_dtype) + gt_mask = gt_mask.to(dtype=amp_dtype) + else: + image = image.float() + gt_mask = gt_mask.float() + + optimizer.zero_grad(set_to_none=True) + with autocast_ctx(enabled=use_amp, device=image.device, amp_dtype=amp_dtype): + logits = model(image) + logits_f = logits.float() + gt_f = gt_mask.float() + loss = torch.zeros(1, device=image.device, dtype=torch.float32) + ce_loss_val = 0.0 + dice_loss_val = 0.0 + if ce_weight > 0: + bce = F.binary_cross_entropy_with_logits(logits_f, gt_f, reduction="mean") + loss = loss + ce_weight * bce + ce_loss_val = float(bce.detach().item()) + if dice_weight > 0: + pred_f = torch.sigmoid(logits_f) + inter = (pred_f * gt_f).sum() + dice_l = 1.0 - (2.0 * inter + 1e-6) / (pred_f.sum() + gt_f.sum() + 1e-6) + loss = loss + dice_weight * dice_l + dice_loss_val = float(dice_l.detach().item()) + + if scaler is not None: + scaler.scale(loss).backward() + scaler.unscale_(optimizer) + else: + loss.backward() + + total_grad_norm = float(torch.nn.utils.clip_grad_norm_(model.parameters(), grad_clip_norm).item()) if grad_clip_norm > 0 else 0.0 + if scaler is not None: + scaler.step(optimizer) + scaler.update() + else: + optimizer.step() + + final_mask = threshold_binary_mask(torch.sigmoid(logits_f)).float().detach() + return { + "loss": float(loss.detach().item()), + "actor_loss": 0.0, + "critic_loss": 0.0, + "mean_reward": 0.0, + "entropy": 0.0, + "ce_loss": ce_loss_val, + "dice_loss": dice_loss_val, + "grad_norm": total_grad_norm, + "grad_clip_used": grad_clip_norm, + "final_mask": final_mask, + } + +@torch.inference_mode() +def validate( + model: nn.Module, + loader: DataLoader, + *, + run_dir: Path | None, + strategy: int, + tmax: int, + use_amp: bool, + amp_dtype: torch.dtype, + use_channels_last: bool, + gamma: float, + critic_loss_weight: float, + ce_weight: float, + dice_weight: float, +) -> dict[str, float]: + strategy = _require_supported_strategy(strategy) + model.eval() + effective_tmax = _resolve_test_iteration_tmax(tmax, context="validate") if strategy != 2 else max(int(tmax), 1) + track_strategy3_mc_cache = bool(strategy == 3 and _uses_refinement_runtime(model, strategy=strategy)) + if track_strategy3_mc_cache: + _strategy3_bump_mc_cache_fingerprint(model) + _strategy3_reset_mc_cache_stats(model) + losses: list[float] = [] + dice_scores: list[float] = [] + iou_scores: list[float] = [] + biou_scores: list[float] = [] + entropies: list[float] = [] + rewards: list[float] = [] + actor_losses: list[float] = [] + critic_losses: list[float] = [] + ce_losses: list[float] = [] + dice_losses: list[float] = [] + decoder_dice_scores: list[float] = [] + decoder_iou_scores: list[float] = [] + decoder_biou_scores: list[float] = [] + val_binary_flips_total: list[float] = [] + val_binary_flips_correct: list[float] = [] + val_binary_flips_wrong: list[float] = [] + prefetcher = CUDAPrefetcher(loader, DEVICE) + try: + for batch in tqdm(prefetcher, total=len(loader), desc="Validating", leave=False): + image = batch["image"] + gt_mask = batch["mask"].float() + sample_ids = [str(item) for item in batch["sample_id"]] if "sample_id" in batch else None + if use_channels_last and image.ndim == 4 and image.device.type == "cuda": + image = image.contiguous(memory_format=torch.channels_last) + if use_amp and DEVICE.type == "cuda": + image = image.to(dtype=amp_dtype) + gt_mask = gt_mask.to(dtype=amp_dtype) + + if strategy == 2: + with autocast_ctx(enabled=use_amp, device=image.device, amp_dtype=amp_dtype): + logits = model(image) + pred_prob = torch.sigmoid(logits).float() + pred = threshold_binary_mask(pred_prob).float() + bce = F.binary_cross_entropy_with_logits(logits.float(), gt_mask.float(), reduction="mean") if ce_weight > 0 else torch.tensor(0.0, device=image.device) + inter_prob = (pred_prob * gt_mask.float()).sum() + dice_loss = 1.0 - (2.0 * inter_prob + 1e-6) / (pred_prob.sum() + gt_mask.sum() + 1e-6) if dice_weight > 0 else torch.tensor(0.0, device=image.device) + losses.append(float((ce_weight * bce + dice_weight * dice_loss).item())) + ce_losses.append(float(bce.item()) if ce_weight > 0 else 0.0) + dice_losses.append(float(dice_loss.item()) if dice_weight > 0 else 0.0) + else: + refinement_runtime = _uses_refinement_runtime(model, strategy=strategy) + if strategy == 3 and refinement_runtime: + with autocast_ctx(enabled=use_amp, device=image.device, amp_dtype=amp_dtype): + refinement_context = model.prepare_refinement_context( + image, + sample_ids=sample_ids, + mc_mode="eval", + mc_cache_split="val", + mc_cache_run_dir=run_dir, + ) + decoder_logits = refinement_context["decoder_logits"] + decoder_prob = refinement_context["decoder_prob"].float() + seg = decoder_prob.float() + loss_weights = _strategy3_loss_weights(model, ce_weight=ce_weight, dice_weight=dice_weight) + decoder_loss = 0.0 + batch_ce = 0.0 + batch_dice = 0.0 + with autocast_ctx(enabled=use_amp, device=image.device, amp_dtype=amp_dtype): + dl_f = decoder_logits.float() + gt_f = gt_mask.float() + if loss_weights["decoder_ce"] > 0: + batch_ce = float(F.binary_cross_entropy_with_logits(dl_f, gt_f).item()) + decoder_loss += loss_weights["decoder_ce"] * batch_ce + if loss_weights["decoder_dice"] > 0: + dm_prob = decoder_prob.float() + inter = (dm_prob * gt_f).sum() + batch_dice = float( + ( + 1.0 - (2.0 * inter + 1e-6) / (dm_prob.sum() + gt_f.sum() + 1e-6) + ).item() + ) + decoder_loss += loss_weights["decoder_dice"] * batch_dice + decoder_pred = threshold_binary_mask(decoder_prob.float()).float() + decoder_inter = (decoder_pred * gt_mask.float()).sum(dim=(1, 2, 3)) + decoder_pred_sum = decoder_pred.sum(dim=(1, 2, 3)) + decoder_gt_sum = gt_mask.float().sum(dim=(1, 2, 3)) + decoder_dice = (2.0 * decoder_inter + _EPS) / (decoder_pred_sum + decoder_gt_sum + _EPS) + decoder_iou = (decoder_inter + _EPS) / (decoder_pred_sum + decoder_gt_sum - decoder_inter + _EPS) + decoder_dice_scores.extend(decoder_dice.cpu().tolist()) + decoder_iou_scores.extend(decoder_iou.cpu().tolist()) + else: + fg_count = gt_mask.sum().clamp(min=1.0) + bg_count = (gt_mask == 0).sum().clamp(min=1.0) + pos_weight = bg_count / fg_count + _weight_map = torch.where(gt_mask == 1, pos_weight, torch.ones_like(gt_mask)) + if strategy == 3: + with autocast_ctx(enabled=use_amp, device=image.device, amp_dtype=amp_dtype): + decoder_logits = model.forward_decoder(image) + seg = threshold_binary_mask(torch.sigmoid(decoder_logits)).float() + decoder_loss = 0.0 + batch_ce = 0.0 + batch_dice = 0.0 + with autocast_ctx(enabled=use_amp, device=image.device, amp_dtype=amp_dtype): + dl_f = decoder_logits.float() + gt_f = gt_mask.float() + if ce_weight > 0: + batch_ce = float(F.binary_cross_entropy_with_logits(dl_f, gt_f).item()) + decoder_loss += ce_weight * batch_ce + if dice_weight > 0: + dm_prob = torch.sigmoid(dl_f) + inter = (dm_prob * gt_f).sum() + batch_dice = float( + ( + 1.0 - (2.0 * inter + 1e-6) / (dm_prob.sum() + gt_f.sum() + 1e-6) + ).item() + ) + decoder_loss += dice_weight * batch_dice + else: + seg = torch.ones( + image.shape[0], + 1, + image.shape[2], + image.shape[3], + device=image.device, + dtype=image.dtype, + ) + decoder_loss = 0.0 + batch_ce = 0.0 + batch_dice = 0.0 + + batch_actor = 0.0 + batch_critic = 0.0 + batch_reward = 0.0 + batch_entropy = 0.0 + batch_loss = decoder_loss + decoder_ce_base = batch_ce + decoder_dice_base = batch_dice + aux_ce_total = 0.0 + aux_dice_total = 0.0 + effective_steps = effective_tmax + + if strategy == 3 and refinement_runtime: + refinement_base_features = refinement_context["base_features"] + detached_decoder_prob = decoder_prob.detach() + detached_mc_variance = refinement_context["mc_variance"].detach() + detached_pred_entropy = refinement_context["pred_entropy"].detach() + _enc_feats = refinement_context.get("encoder_features") + detached_enc_feats = [f.detach() for f in _enc_feats] if _enc_feats is not None else None + effective_steps = effective_tmax + rl_loss_scale = float(_job_param("strategy3_rl_loss_scale", DEFAULT_STRATEGY3_RL_LOSS_SCALE)) + + for _step_idx in range(effective_tmax): + with autocast_ctx(enabled=use_amp, device=image.device, amp_dtype=amp_dtype): + state_t = model.forward_refinement_state( + refinement_base_features, + seg, + detached_decoder_prob, + detached_mc_variance, + detached_pred_entropy, + encoder_features=detached_enc_feats, + ) + policy_raw, _value_t = model.forward_from_state(state_t) + delta = _strategy3_policy_delta(policy_raw).to(dtype=seg.dtype) + seg_next = _strategy3_apply_delta(seg, delta) + reward_map = compute_refinement_reward(seg, seg_next, gt_mask.float()) + actor_loss = -reward_map.mean() + critic_loss = torch.zeros((), device=image.device, dtype=torch.float32) + + batch_actor += float(actor_loss.item()) + batch_critic += float(critic_loss.item()) + batch_reward += float(reward_map.mean().item()) + batch_loss += float((actor_loss + critic_loss_weight * critic_loss).item()) + seg = seg_next + + batch_ce = decoder_ce_base + batch_dice = decoder_dice_base + batch_loss = decoder_loss + rl_loss_scale * ((batch_loss - decoder_loss) / float(max(effective_steps, 1))) + pred = threshold_binary_mask(seg.float()).float() + # Track binary mask flips between decoder and RL-refined prediction + flipped = (decoder_pred != pred) + gt_binary = (gt_mask.float() > 0.5) + correct_flips = flipped & ((pred > 0.5) == gt_binary) + wrong_flips = flipped & ((pred > 0.5) != gt_binary) + total_px = max(pred.numel(), 1) + val_binary_flips_total.append(float(flipped.float().sum().item() / total_px * 100.0)) + val_binary_flips_correct.append(float(correct_flips.float().sum().item() / total_px * 100.0)) + val_binary_flips_wrong.append(float(wrong_flips.float().sum().item() / total_px * 100.0)) + else: + for _ in range(effective_tmax): + with autocast_ctx(enabled=use_amp, device=image.device, amp_dtype=amp_dtype): + x_t = image * seg + state_t, _ = model.forward_state(x_t) + policy_logits, value_t = model.forward_from_state(state_t) + actions, log_prob, entropy = sample_actions(policy_logits, stochastic=False) + log_prob = log_prob.clamp(min=-10.0) + seg_next = apply_actions(seg, actions, num_actions=policy_logits.shape[1]) + reward = ((seg - gt_mask).pow(2) - (seg_next - gt_mask).pow(2)) + x_next = image * seg_next + state_next, _ = model.forward_state(x_next) + value_next = model.value_from_state(state_next).detach() + target = reward + gamma * _bootstrap_value_target(model, value_next) + advantage = target - value_t + actor_loss = -(log_prob * advantage.detach()).mean() + critic_loss = F.smooth_l1_loss(value_t, target) + + batch_actor += float(actor_loss.item()) + batch_critic += float(critic_loss.item()) + batch_reward += float(reward.mean().item()) + batch_entropy += float(entropy.item()) + batch_loss += float(((actor_loss + critic_loss_weight * critic_loss) / float(max(effective_tmax, 1))).item()) + seg = seg_next + + with autocast_ctx(enabled=use_amp, device=image.device, amp_dtype=amp_dtype): + policy_aux, _, _ = model(image) + aux_loss, aux_ce, aux_dice = compute_strategy1_aux_segmentation_loss( + policy_aux, + gt_mask, + ce_weight=ce_weight, + dice_weight=dice_weight, + seg_mask=seg, + ) + batch_loss += float(aux_loss.item()) + batch_ce = aux_ce + batch_dice = aux_dice + pred = infer_segmentation_mask( + model, + image, + effective_tmax, + strategy=strategy, + use_amp=use_amp, + amp_dtype=amp_dtype, + use_channels_last=use_channels_last, + sample_ids=sample_ids, + mc_cache_split="val", + mc_cache_run_dir=run_dir, + ).float() + + ce_losses.append(batch_ce) + dice_losses.append(batch_dice) + actor_losses.append(batch_actor / float(max(effective_steps, 1))) + critic_losses.append(batch_critic / float(max(effective_steps, 1))) + rewards.append(batch_reward / float(max(effective_steps, 1))) + entropies.append(batch_entropy / float(max(effective_steps, 1))) + losses.append(batch_loss) + + inter = (pred * gt_mask.float()).sum(dim=(1, 2, 3)) + pred_sum = pred.sum(dim=(1, 2, 3)) + gt_sum = gt_mask.float().sum(dim=(1, 2, 3)) + dice = (2.0 * inter + _EPS) / (pred_sum + gt_sum + _EPS) + iou = (inter + _EPS) / (pred_sum + gt_sum - inter + _EPS) + dice_scores.extend(dice.cpu().tolist()) + iou_scores.extend(iou.cpu().tolist()) + pred_np = pred.detach().cpu().numpy() + gt_np = gt_mask.float().detach().cpu().numpy() + for idx in range(pred_np.shape[0]): + biou_scores.append(boundary_iou_score(pred_np[idx], gt_np[idx])) + if strategy == 3 and decoder_dice_scores: + decoder_pred_np = decoder_pred.detach().cpu().numpy() + for idx in range(decoder_pred_np.shape[0]): + decoder_biou_scores.append(boundary_iou_score(decoder_pred_np[idx], gt_np[idx])) + finally: + prefetcher.close() + del prefetcher + if track_strategy3_mc_cache: + mc_cache_stats = _strategy3_get_mc_cache_stats(model) + print( + "[Strategy3 MC Cache] " + f"ram_hits={mc_cache_stats['ram_hits']} " + f"disk_hits={mc_cache_stats['disk_hits']} " + f"misses={mc_cache_stats['misses']} " + f"writes={mc_cache_stats['writes']}" + ) + + val_decoder_dice = float(np.mean(decoder_dice_scores)) if decoder_dice_scores else None + val_decoder_iou = float(np.mean(decoder_iou_scores)) if decoder_iou_scores else None + val_decoder_biou = float(np.mean(decoder_biou_scores)) if decoder_biou_scores else None + val_dice = float(np.mean(dice_scores)) if dice_scores else 0.0 + val_iou = float(np.mean(iou_scores)) if iou_scores else 0.0 + val_biou = float(np.mean(biou_scores)) if biou_scores else 0.0 + val_refine_score = 0.5 * (val_iou + val_biou) + + return { + "val_loss": float(np.mean(losses)) if losses else 0.0, + "val_dice": val_dice, + "val_iou": val_iou, + "val_biou": val_biou, + "val_refine_score": val_refine_score, + "val_decoder_dice": val_decoder_dice, + "val_decoder_iou": val_decoder_iou, + "val_decoder_biou": val_decoder_biou, + "val_dice_gain": None if val_decoder_dice is None else val_dice - val_decoder_dice, + "val_iou_gain": None if val_decoder_iou is None else val_iou - val_decoder_iou, + "val_biou_gain": None if val_decoder_biou is None else val_biou - val_decoder_biou, + "val_actor_loss": float(np.mean(actor_losses)) if actor_losses else 0.0, + "val_critic_loss": float(np.mean(critic_losses)) if critic_losses else 0.0, + "val_ce_loss": float(np.mean(ce_losses)) if ce_losses else 0.0, + "val_dice_loss": float(np.mean(dice_losses)) if dice_losses else 0.0, + "val_reward": float(np.mean(rewards)) if rewards else 0.0, + "val_entropy": float(np.mean(entropies)) if entropies else 0.0, + "val_binary_flips_total_pct": float(np.mean(val_binary_flips_total)) if val_binary_flips_total else None, + "val_binary_flips_correct_pct": float(np.mean(val_binary_flips_correct)) if val_binary_flips_correct else None, + "val_binary_flips_wrong_pct": float(np.mean(val_binary_flips_wrong)) if val_binary_flips_wrong else None, + } + +def _save_training_plots(history: list[dict[str, Any]], plots_dir: Path) -> None: + if len(history) < 1: + return + ensure_dir(plots_dir) + epochs = [row["epoch"] for row in history] + plot_specs = [ + ("loss.png", "Loss", [("train_loss", "Train"), ("val_loss", "Val")]), + ("dice.png", "Dice", [("train_dice", "Train"), ("val_dice", "Val")]), + ("iou.png", "IoU", [("train_iou", "Train"), ("val_iou", "Val")]), + ("reward.png", "Reward", [("train_mean_reward", "Train"), ("val_reward", "Val")]), + ("ce_loss.png", "CE Loss", [("train_ce_loss", "Train")]), + ("dice_loss.png", "Dice Loss", [("train_dice_loss", "Train")]), + ("lr.png", "Learning Rate", [("lr", "Head LR"), ("encoder_lr", "Encoder LR")]), + ] + for file_name, title, curves in plot_specs: + fig, ax = plt.subplots(figsize=(8, 4)) + has_data = False + for key, label in curves: + values = [(row["epoch"], row[key]) for row in history if key in row] + if not values: + continue + xs, ys = zip(*values) + ax.plot(xs, ys, label=label, linewidth=1.2) + has_data = True + if has_data: + ax.set_title(title) + ax.set_xlabel("Epoch") + ax.set_ylabel(title) + ax.grid(True, alpha=0.3) + ax.legend() + fig.tight_layout() + fig.savefig(plots_dir / file_name, dpi=110) + plt.close(fig) + +RESUME_IDENTITY_KEYS = ( + "strategy", + "dataset_percent", + "dataset_name", + "dataset_split_policy", + "split_type", + "train_subset_key", + "train_subset_variant", + "best_checkpoint_metric_name", + "backbone_family", + "smp_encoder_name", + "smp_encoder_weights", + "smp_encoder_depth", + "smp_encoder_proj_dim", + "smp_decoder_type", + "vgg_feature_scales", + "vgg_feature_dilation", + "head_lr", + "encoder_lr", + "weight_decay", + "dropout_p", + "tmax", + "entropy_lr", +) + +PORTABLE_RESUME_PATH_KEYS = frozenset( + { + "base_split_manifest_path", + "subset_manifest_path", + } +) + +def _path_parts(value: Any) -> tuple[str, ...]: + if value is None: + return () + return tuple(part for part in Path(str(value)).parts if part not in {"", os.sep}) + +def _portable_path_token(value: Any) -> str: + if value in (None, ""): + return "" + path = Path(str(value)).expanduser() + roots: list[tuple[str, Path]] = [] + experiment_root = globals().get("EXPERIMENT_ROOT") + if experiment_root is not None: + roots.append(("EXPERIMENT_ROOT", Path(experiment_root))) + roots.append(("PROJECT_DIR", PROJECT_DIR)) + for label, root in roots: + try: + rel = path.resolve().relative_to(root.resolve()) + return f"{label}:{rel.as_posix()}" + except (OSError, ValueError): + continue + parts = _path_parts(value) + for marker in ("runs", "repeated_holdout", "manifests", "checkpoints"): + if marker in parts: + return "/".join(parts[parts.index(marker):]) + return "/".join(parts) + +def _resume_path_values_match(current: Any, saved: Any) -> tuple[bool, str]: + current_text = str(current or "") + saved_text = str(saved or "") + if current_text == saved_text: + return True, "exact" + + current_token = _portable_path_token(current_text) + saved_token = _portable_path_token(saved_text) + if current_token and current_token == saved_token: + return True, "portable-token" + + current_parts = _path_parts(current_text) + saved_parts = _path_parts(saved_text) + max_suffix = min(len(current_parts), len(saved_parts)) + for length in range(max_suffix, 2, -1): + if current_parts[-length:] == saved_parts[-length:]: + return True, f"suffix:{length}" + return False, f"current_token={current_token!r}, checkpoint_token={saved_token!r}" + +def _resume_value_matches(current: Any, saved: Any) -> bool: + if isinstance(current, (int, float)) and isinstance(saved, (int, float)) and not isinstance(current, bool): + return math.isclose(float(current), float(saved), rel_tol=1e-9, abs_tol=1e-12) + return current == saved + +def validate_resume_checkpoint_identity( + current_run_config: dict[str, Any], + saved_run_config: dict[str, Any], + *, + checkpoint_path: Path, +) -> None: + mismatches: list[str] = [] + for key in RESUME_IDENTITY_KEYS: + if key not in current_run_config or key not in saved_run_config: + mismatches.append(f"{key}: current={current_run_config.get(key)!r}, checkpoint={saved_run_config.get(key)!r}") + continue + if key in PORTABLE_RESUME_PATH_KEYS: + matches, reason = _resume_path_values_match(current_run_config[key], saved_run_config[key]) + if matches: + if str(current_run_config[key]) != str(saved_run_config[key]): + print( + f"[Resume] Accepted portable path match for {key}: " + f"current={current_run_config[key]!r}, checkpoint={saved_run_config[key]!r}, reason={reason}." + ) + continue + mismatches.append( + f"{key}: current={current_run_config[key]!r}, checkpoint={saved_run_config[key]!r} ({reason})" + ) + continue + if not _resume_value_matches(current_run_config[key], saved_run_config[key]): + mismatches.append(f"{key}: current={current_run_config[key]!r}, checkpoint={saved_run_config[key]!r}") + + current_s2 = current_run_config.get("strategy2_checkpoint_path") + saved_s2 = saved_run_config.get("strategy2_checkpoint_path") + if current_s2 or saved_s2: + if str(current_s2 or "") != str(saved_s2 or ""): + # Warn but do not abort: when resuming, the model weights are fully restored + # from the resume checkpoint (not re-loaded from the strategy2 checkpoint), + # so a path change (e.g. file moved/renamed) does not affect correctness. + print( + f"[WARN] strategy2_checkpoint_path changed since checkpoint was saved " + f"(current={current_s2!r}, checkpoint={saved_s2!r}). " + f"Resuming anyway — model state comes from the resume checkpoint." + ) + + if mismatches: + raise ValueError( + f"Resume checkpoint identity mismatch for {checkpoint_path}:\n" + "\n".join(f" - {line}" for line in mismatches) + ) + +def load_history_for_resume(history_path: Path, checkpoint_payload: dict[str, Any]) -> list[dict[str, Any]]: + checkpoint_epoch = int(checkpoint_payload.get("epoch", 0)) + epoch_metrics = checkpoint_payload.get("epoch_metrics") + history: list[dict[str, Any]] = [] + checkpoint_history = checkpoint_payload.get("history") + if isinstance(checkpoint_history, list): + history = [dict(row) for row in checkpoint_history if isinstance(row, dict)] + history = [row for row in history if int(row.get("epoch", 0)) <= checkpoint_epoch] + if history_path.exists(): + payload = load_json(history_path) + if not isinstance(payload, list): + raise RuntimeError(f"Expected list history at {history_path}, found {type(payload).__name__}.") + file_history = [dict(row) for row in payload if isinstance(row, dict)] + file_history = [row for row in file_history if int(row.get("epoch", 0)) <= checkpoint_epoch] + if len(file_history) >= len(history): + history = file_history + if not history and isinstance(epoch_metrics, dict): + history = [dict(epoch_metrics)] + elif history and isinstance(epoch_metrics, dict): + if int(history[-1].get("epoch", 0)) < checkpoint_epoch: + history.append(dict(epoch_metrics)) + return history + +def train_model( + *, + run_type: str, + model_config: RuntimeModelConfig, + run_config: dict[str, Any], + model: nn.Module, + description: str, + strategy: int, + run_dir: Path, + bundle: DataBundle, + max_epochs: int, + head_lr: float, + encoder_lr: float, + weight_decay: float, + tmax: int, + entropy_lr: float, + entropy_alpha_init: float, + entropy_target_ratio: float, + critic_loss_weight: float, + ce_weight: float, + dice_weight: float, + dropout_p: float, + resume_checkpoint_path: Path | None = None, + trial: optuna.trial.Trial | None = None, +) -> tuple[dict[str, Any], list[dict[str, Any]]]: + strategy = _require_supported_strategy(strategy) + amp_dtype = resolve_amp_dtype(AMP_DTYPE) + use_amp = amp_autocast_enabled(DEVICE) + use_channels_last = _use_channels_last_for_run(model_config) + if resume_checkpoint_path is not None and strategy == 3: + _configure_model_from_checkpoint_path(model, resume_checkpoint_path) + print_model_parameter_summary( + model=model, + description=description, + strategy=strategy, + model_config=model_config, + dropout_p=dropout_p, + amp_dtype=amp_dtype, + compiled=hasattr(model, "_orig_mod"), + ) + + strategy3_freeze_status = _strategy3_bootstrap_freeze_status(model) if strategy == 3 else None + strategy3_frozen_decoder = strategy == 3 and _strategy3_decoder_is_frozen(model) + decoder_head_lr = float(_job_param("decoder_lr", 0.0 if strategy3_frozen_decoder else head_lr * 0.1)) + encoder_group_lr = 0.0 if strategy3_frozen_decoder else encoder_lr + rl_group_lr = float(_job_param("rl_lr", head_lr)) + optimizer = make_optimizer( + model, + strategy, + head_lr=decoder_head_lr, + encoder_lr=encoder_group_lr, + weight_decay=weight_decay, + rl_lr=rl_group_lr, + ) + scheduler = CosineAnnealingLR( + optimizer, + T_max=max_epochs, + eta_min=1e-6, # floor + ) + scaler = make_grad_scaler(enabled=use_amp, amp_dtype=amp_dtype, device=DEVICE) + + del entropy_alpha_init, entropy_lr, entropy_target_ratio + target_entropy = 0.0 + log_alpha = None + alpha_optimizer = None + + save_artifacts = run_type == "final" + save_history_incrementally = bool(run_config.get("save_history_incrementally", SAVE_HISTORY_INCREMENTALLY)) + write_epoch_diagnostic = bool(run_config.get("write_epoch_diagnostic", WRITE_EPOCH_DIAGNOSTIC)) + ckpt_dir = ensure_dir(run_dir / "checkpoints") if save_artifacts else None + plots_dir = ensure_dir(run_dir / "plots") if save_artifacts else None + history_path = checkpoint_history_path(run_dir, run_type) + diagnostic_path = diagnostic_path_for_run(run_dir) if run_type == "final" and write_epoch_diagnostic else None + history: list[dict[str, Any]] = [] + selection_metric_name = _strategy_selection_metric_name(strategy) + early_stopping_monitor_name = _early_stopping_monitor_name(strategy) + early_stopping_mode = _early_stopping_mode(strategy, early_stopping_monitor_name) + early_stopping_min_delta = _early_stopping_min_delta() + early_stopping_start_epoch = _early_stopping_start_epoch() + early_stopping_patience = _early_stopping_patience() + epoch_probe_mode = str(run_config.get("epoch_probe_mode", "fixed")).strip().lower() + best_model_metric = -float("inf") + best_epoch: int | None = None # epoch that produced the selected (best) checkpoint + patience_counter = 0 + best_early_stopping_metric: float | None = None + elapsed_before_resume = 0.0 + start_epoch = 1 + resume_source: dict[str, Any] | None = None + diagnostic_payload: dict[str, Any] | None = None + train_probe_batches: list[dict[str, Any]] = [] + val_probe_batches: list[dict[str, Any]] = [] + run_label = run_identity_label( + strategy=strategy, + percent=bundle.percent, + trial_number=trial.number if trial is not None else None, + split_payload=bundle.split_payload, + ) + if diagnostic_path is not None: + if epoch_probe_mode == "rolling_random": + train_probe_batches = _rolling_probe_batches_from_dataset( + bundle.train_ds, + num_batches=EPOCH_DIAGNOSTIC_TRAIN_BATCHES, + device=DEVICE, + epoch=0, + split_tag="train", + ) + val_probe_batches = _rolling_probe_batches_from_dataset( + bundle.val_ds, + num_batches=EPOCH_DIAGNOSTIC_VAL_BATCHES, + device=DEVICE, + epoch=0, + split_tag="val", + ) + else: + train_probe_batches = _fixed_probe_batches_from_dataset( + bundle.train_ds, + num_batches=EPOCH_DIAGNOSTIC_TRAIN_BATCHES, + device=DEVICE, + ) + val_probe_batches = _fixed_probe_batches_from_dataset( + bundle.val_ds, + num_batches=EPOCH_DIAGNOSTIC_VAL_BATCHES, + device=DEVICE, + ) + diagnostic_payload = empty_epoch_diagnostic_payload( + run_type=run_type, + run_config=run_config, + bundle=bundle, + train_probe_batches=train_probe_batches, + val_probe_batches=val_probe_batches, + ) + if resume_checkpoint_path is not None: + checkpoint_payload = load_checkpoint( + resume_checkpoint_path, + model=model, + optimizer=optimizer, + scheduler=scheduler, + scaler=scaler, + device=DEVICE, + log_alpha=log_alpha if strategy == 3 else None, + alpha_optimizer=alpha_optimizer if strategy == 3 else None, + expected_run_type=run_type, + require_run_metadata=True, + ) + validate_resume_checkpoint_identity( + run_config, + checkpoint_run_config_payload(checkpoint_payload), + checkpoint_path=resume_checkpoint_path, + ) + start_epoch = int(checkpoint_payload["epoch"]) + 1 + selection_metric_name = str(checkpoint_payload.get("best_metric_name", selection_metric_name)) + best_model_metric = float(checkpoint_payload["best_metric_value"]) + patience_counter = int(checkpoint_payload.get("patience_counter", 0)) + elapsed_before_resume = float(checkpoint_payload.get("elapsed_seconds", 0.0)) + history = load_history_for_resume(history_path, checkpoint_payload) + resume_source = { + "checkpoint_path": str(Path(resume_checkpoint_path).resolve()), + "checkpoint_epoch": int(checkpoint_payload["epoch"]), + "checkpoint_run_type": checkpoint_payload.get("run_type", run_type), + } + epoch_metrics = checkpoint_payload.get("epoch_metrics") + if isinstance(epoch_metrics, dict) and epoch_metrics.get("early_stopping_best_value") is not None: + best_early_stopping_metric = float(epoch_metrics["early_stopping_best_value"]) + if diagnostic_path is not None and diagnostic_payload is not None: + diagnostic_payload = load_epoch_diagnostic_for_resume( + diagnostic_path, + checkpoint_payload, + diagnostic_payload, + ) + print( + f"[Resume] {run_label} | {run_type} continuing from {resume_checkpoint_path} " + f"at epoch {start_epoch}/{max_epochs}." + ) + prev_params = _snapshot_params(model) if diagnostic_path is not None else None + start_time = time.time() + validate_interval = max(int(VALIDATE_EVERY_N_EPOCHS), 1) + low_advantage_std_streak = 0 + low_mean_value_pred_streak = 0 + + for epoch in range(start_epoch, max_epochs + 1): + _epoch_start_time = time.perf_counter() # wall-clock per-epoch timer (train+val compute) + epoch_losses: list[float] = [] + epoch_actor: list[float] = [] + epoch_critic: list[float] = [] + epoch_reward: list[float] = [] + epoch_entropy: list[float] = [] + epoch_ce: list[float] = [] + epoch_dice_loss: list[float] = [] + epoch_grad: list[float] = [] + epoch_dices: list[float] = [] + epoch_ious: list[float] = [] + epoch_effective_steps: list[float] = [] + epoch_mask_deltas: list[float] = [] + epoch_advantage_means: list[float] = [] + epoch_advantage_stds: list[float] = [] + epoch_value_pred_errors: list[float] = [] + epoch_reward_zero_pcts: list[float] = [] + epoch_biou_deltas: list[float] = [] + epoch_mean_value_preds: list[float] = [] + epoch_annealed_aux_ce_weights: list[float] = [] + epoch_rl_loss_scales: list[float] = [] + epoch_reinforce_losses: list[float] = [] + epoch_entropy_losses: list[float] = [] + epoch_entropy_bonuses_used: list[float] = [] + epoch_alphas: list[float] = [] + epoch_action_dists: list[dict[str, float]] = [] + + prefetcher = CUDAPrefetcher(bundle.train_loader, DEVICE) + progress = tqdm(prefetcher, total=len(bundle.train_loader), desc=f"Epoch {epoch}/{max_epochs}", leave=False) + for batch in progress: + if strategy == 2: + metrics = train_step_supervised( + model, + batch, + optimizer, + scaler=scaler, + use_amp=use_amp, + amp_dtype=amp_dtype, + use_channels_last=use_channels_last, + grad_clip_norm=DEFAULT_GRAD_CLIP_NORM, + ce_weight=ce_weight, + dice_weight=dice_weight, + ) + else: + metrics = train_step_strategy3( + model, + batch, + optimizer, + gamma=DEFAULT_GAMMA, + tmax=tmax, + critic_loss_weight=critic_loss_weight, + log_alpha=log_alpha, + alpha_optimizer=alpha_optimizer, + target_entropy=target_entropy, + ce_weight=ce_weight, + dice_weight=dice_weight, + grad_clip_norm=DEFAULT_GRAD_CLIP_NORM, + scaler=scaler, + use_amp=use_amp, + amp_dtype=amp_dtype, + stepwise_backward=STEPWISE_BACKWARD, + use_channels_last=use_channels_last, + current_epoch=epoch, + max_epochs=max_epochs, + ) + epoch_losses.append(metrics["loss"]) + epoch_actor.append(metrics["actor_loss"]) + epoch_critic.append(metrics["critic_loss"]) + epoch_reward.append(metrics["mean_reward"]) + epoch_entropy.append(metrics["entropy"]) + epoch_ce.append(metrics["ce_loss"]) + epoch_dice_loss.append(metrics["dice_loss"]) + epoch_grad.append(metrics["grad_norm"]) + if "effective_steps" in metrics: + epoch_effective_steps.append(float(metrics["effective_steps"])) + if "mask_delta_mean" in metrics: + epoch_mask_deltas.append(metrics["mask_delta_mean"]) + if "advantage_mean" in metrics: + epoch_advantage_means.append(metrics["advantage_mean"]) + if "advantage_std" in metrics: + epoch_advantage_stds.append(metrics["advantage_std"]) + if "value_pred_error_mean" in metrics: + epoch_value_pred_errors.append(metrics["value_pred_error_mean"]) + if "reward_zeros_pct" in metrics: + epoch_reward_zero_pcts.append(float(metrics["reward_zeros_pct"])) + if "biou_delta_mean" in metrics: + epoch_biou_deltas.append(float(metrics["biou_delta_mean"])) + if "mean_value_pred" in metrics: + epoch_mean_value_preds.append(float(metrics["mean_value_pred"])) + if "annealed_aux_ce_weight" in metrics: + epoch_annealed_aux_ce_weights.append(float(metrics["annealed_aux_ce_weight"])) + if "rl_loss_scale_used" in metrics: + epoch_rl_loss_scales.append(float(metrics["rl_loss_scale_used"])) + if "reinforce_loss" in metrics: + epoch_reinforce_losses.append(float(metrics["reinforce_loss"])) + if "entropy_loss" in metrics: + epoch_entropy_losses.append(float(metrics["entropy_loss"])) + if "entropy_bonus_used" in metrics: + epoch_entropy_bonuses_used.append(float(metrics["entropy_bonus_used"])) + if "alpha" in metrics: + epoch_alphas.append(metrics["alpha"]) + if "action_distribution" in metrics and metrics["action_distribution"]: + epoch_action_dists.append(metrics["action_distribution"]) + + pred_mask = metrics["final_mask"] + gt_mask = batch["mask"].float() + inter = (pred_mask * gt_mask).sum(dim=(1, 2, 3)) + pred_sum = pred_mask.sum(dim=(1, 2, 3)) + gt_sum = gt_mask.sum(dim=(1, 2, 3)) + dice = (2.0 * inter + _EPS) / (pred_sum + gt_sum + _EPS) + iou = (inter + _EPS) / (pred_sum + gt_sum - inter + _EPS) + epoch_dices.extend(dice.detach().cpu().tolist()) + epoch_ious.extend(iou.detach().cpu().tolist()) + + head_lr_now = float(optimizer.param_groups[-1]["lr"]) + enc_lr_now = float(optimizer.param_groups[0]["lr"]) if len(optimizer.param_groups) > 1 else head_lr_now + progress.set_postfix(loss=f"{metrics['loss']:.4f}", iou=f"{np.mean(epoch_ious):.4f}", lr=f"{head_lr_now:.2e}") + + should_validate = epoch % validate_interval == 0 or epoch == max_epochs + val_metrics: dict[str, float | None] = { + "val_loss": None, + "val_dice": None, + "val_iou": None, + "val_biou": None, + "val_decoder_dice": None, + "val_decoder_iou": None, + "val_decoder_biou": None, + "val_dice_gain": None, + "val_iou_gain": None, + "val_biou_gain": None, + "val_reward": None, + "val_entropy": None, + } + if should_validate: + tqdm.write( + f"[{run_label}] Epoch {epoch}/{max_epochs}: running validation on {len(bundle.val_loader)} batches..." + ) + validated_metrics = validate( + model, + bundle.val_loader, + run_dir=run_dir, + strategy=strategy, + tmax=tmax, + use_amp=use_amp, + amp_dtype=amp_dtype, + use_channels_last=use_channels_last, + gamma=DEFAULT_GAMMA, + critic_loss_weight=critic_loss_weight, + ce_weight=ce_weight, + dice_weight=dice_weight, + ) + val_metrics.update(validated_metrics) + scheduler.step() # always step up the scheduler + grad_stats: dict[str, Any] = {} + param_stats: dict[str, Any] = {} + if diagnostic_path is not None: + grad_stats = _grad_diagnostics(model) + param_stats = _param_diagnostics(model, prev_params) + prev_params = _snapshot_params(model) + + avg_epoch_action_dist: dict[str, float] = {} + if epoch_action_dists: + all_act_keys = set() + for d in epoch_action_dists: + all_act_keys.update(d.keys()) + for k in sorted(all_act_keys): + avg_epoch_action_dist[k] = float(np.mean([d.get(k, 0.0) for d in epoch_action_dists])) + + epoch_seconds = time.perf_counter() - _epoch_start_time + row = { + "epoch": epoch, + "epoch_seconds": float(epoch_seconds), + "train_loss": float(np.mean(epoch_losses)) if epoch_losses else 0.0, + "train_actor_loss": float(np.mean(epoch_actor)) if epoch_actor else 0.0, + "train_critic_loss": float(np.mean(epoch_critic)) if epoch_critic else 0.0, + "train_mean_reward": float(np.mean(epoch_reward)) if epoch_reward else 0.0, + "train_entropy": float(np.mean(epoch_entropy)) if epoch_entropy else 0.0, + "train_ce_loss": float(np.mean(epoch_ce)) if epoch_ce else 0.0, + "train_dice_loss": float(np.mean(epoch_dice_loss)) if epoch_dice_loss else 0.0, + "train_dice": float(np.mean(epoch_dices)) if epoch_dices else 0.0, + "train_iou": float(np.mean(epoch_ious)) if epoch_ious else 0.0, + "grad_norm": float(np.mean(epoch_grad)) if epoch_grad else 0.0, + "lr": float(optimizer.param_groups[-1]["lr"]), + "encoder_lr": float(optimizer.param_groups[0]["lr"]) if len(optimizer.param_groups) > 1 else float(optimizer.param_groups[-1]["lr"]), + "alpha": float(log_alpha.exp().detach().item()) if log_alpha is not None else None, + "train_effective_steps": float(np.mean(epoch_effective_steps)) if epoch_effective_steps else 0.0, + "train_mask_delta_mean": float(np.mean(epoch_mask_deltas)) if epoch_mask_deltas else 0.0, + "train_advantage_mean": float(np.mean(epoch_advantage_means)) if epoch_advantage_means else 0.0, + "train_advantage_std": _nanmean_or_default(epoch_advantage_stds, 0.0), + "train_value_pred_error": float(np.mean(epoch_value_pred_errors)) if epoch_value_pred_errors else 0.0, + "train_reward_zeros_pct": float(np.mean(epoch_reward_zero_pcts)) if epoch_reward_zero_pcts else 0.0, + "train_biou_delta_mean": float(np.mean(epoch_biou_deltas)) if epoch_biou_deltas else 0.0, + "train_mean_value_pred": float(np.mean(epoch_mean_value_preds)) if epoch_mean_value_preds else 0.0, + "train_annealed_aux_ce_weight": float(np.mean(epoch_annealed_aux_ce_weights)) if epoch_annealed_aux_ce_weights else 0.0, + "train_rl_loss_scale": float(np.mean(epoch_rl_loss_scales)) if epoch_rl_loss_scales else 0.0, + "train_reinforce_loss": float(np.mean(epoch_reinforce_losses)) if epoch_reinforce_losses else 0.0, + "train_entropy_loss": float(np.mean(epoch_entropy_losses)) if epoch_entropy_losses else 0.0, + "train_entropy_bonus_used": float(np.mean(epoch_entropy_bonuses_used)) if epoch_entropy_bonuses_used else 0.0, + "train_alpha": float(np.mean(epoch_alphas)) if epoch_alphas else 0.0, + "train_action_distribution": avg_epoch_action_dist if avg_epoch_action_dist else None, + "validated_this_epoch": should_validate, + **val_metrics, + } + if strategy == 3: + if row["train_advantage_std"] < 0.005: + low_advantage_std_streak += 1 + else: + low_advantage_std_streak = 0 + if abs(row["train_mean_value_pred"]) < 0.001: + low_mean_value_pred_streak += 1 + else: + low_mean_value_pred_streak = 0 + else: + low_advantage_std_streak = 0 + low_mean_value_pred_streak = 0 + if strategy3_freeze_status is not None: + row["strategy3_bootstrap_loaded"] = bool(strategy3_freeze_status["bootstrap_loaded"]) + row["strategy3_freeze_requested"] = bool(strategy3_freeze_status["freeze_requested"]) + row["strategy3_freeze_active"] = bool(strategy3_freeze_status["freeze_active"]) + row["strategy3_encoder_state"] = str(strategy3_freeze_status["encoder_state"]) + row["strategy3_decoder_state"] = str(strategy3_freeze_status["decoder_state"]) + row["strategy3_segmentation_head_state"] = str(strategy3_freeze_status["segmentation_head_state"]) + history.append(row) + + improved = False + early_stopping_improved_now = False + if should_validate: + selected_metric_value = _strategy_selection_metric_value(strategy, val_metrics) + row["selection_metric_name"] = selection_metric_name + row["selection_metric_value"] = selected_metric_value + improved = selected_metric_value > best_model_metric + if improved: + best_model_metric = selected_metric_value + best_epoch = epoch + if trial is not None: + trial.set_user_attr(OPTUNA_BEST_OBSERVED_OBJECTIVE_ATTR, float(best_model_metric)) + trial.set_user_attr(OPTUNA_BEST_OBSERVED_OBJECTIVE_NAME_ATTR, selection_metric_name) + early_stopping_monitor_value = _early_stopping_monitor_value( + row, + strategy=strategy, + monitor_name=early_stopping_monitor_name, + ) + early_stopping_active = epoch >= early_stopping_start_epoch + if early_stopping_active and early_stopping_monitor_value is not None: + early_stopping_improved_now = _early_stopping_improved( + early_stopping_monitor_value, + best_early_stopping_metric, + mode=early_stopping_mode, + min_delta=early_stopping_min_delta, + ) + if early_stopping_improved_now: + best_early_stopping_metric = early_stopping_monitor_value + patience_counter = 0 + else: + patience_counter += 1 + row["early_stopping_monitor_name"] = early_stopping_monitor_name + row["early_stopping_monitor_mode"] = early_stopping_mode + row["early_stopping_monitor_value"] = early_stopping_monitor_value + row["early_stopping_best_value"] = best_early_stopping_metric + row["early_stopping_min_delta"] = early_stopping_min_delta + row["early_stopping_start_epoch"] = early_stopping_start_epoch + row["early_stopping_patience"] = early_stopping_patience + row["early_stopping_active"] = early_stopping_active + row["early_stopping_improved"] = early_stopping_improved_now + row["early_stopping_wait"] = int(patience_counter) + if improved and save_artifacts and ckpt_dir is not None: + save_checkpoint( + ckpt_dir / "best.pt", + run_type=run_type, + model=model, + optimizer=optimizer, + scheduler=scheduler, + scaler=scaler, + epoch=epoch, + best_metric_value=best_model_metric, + best_metric_name=selection_metric_name, + run_config=run_config, + epoch_metrics=row, + patience_counter=patience_counter, + elapsed_seconds=elapsed_before_resume + (time.time() - start_time), + history=history, + log_alpha=log_alpha if strategy == 3 else None, + alpha_optimizer=alpha_optimizer if strategy == 3 else None, + resume_source=resume_source, + ) + else: + row["early_stopping_monitor_name"] = early_stopping_monitor_name + row["early_stopping_monitor_mode"] = early_stopping_mode + row["early_stopping_monitor_value"] = None + row["early_stopping_best_value"] = best_early_stopping_metric + row["early_stopping_min_delta"] = early_stopping_min_delta + row["early_stopping_start_epoch"] = early_stopping_start_epoch + row["early_stopping_patience"] = early_stopping_patience + row["early_stopping_active"] = False + row["early_stopping_improved"] = False + row["early_stopping_wait"] = int(patience_counter) + + if save_artifacts and save_history_incrementally: + if plots_dir is not None and run_type != "trial": + _save_training_plots(history, plots_dir) + save_json(history_path, history) + + if diagnostic_path is not None and diagnostic_payload is not None: + epoch_alerts = _numerical_health_check(row, prefix=f"epoch[{epoch}]:") + if low_advantage_std_streak >= 5: + epoch_alerts.append(f"epoch[{epoch}]: [WARN] advantage_std collapsed - RL gradient near zero") + if low_mean_value_pred_streak >= 5: + epoch_alerts.append(f"epoch[{epoch}]: [WARN] critic degenerate - mean value prediction stuck near zero") + if int(grad_stats.get("n_nan", 0)) > 0: + epoch_alerts.append(f"epoch[{epoch}]: grad diagnostics detected NaN gradients") + if int(grad_stats.get("n_inf", 0)) > 0: + epoch_alerts.append(f"epoch[{epoch}]: grad diagnostics detected Inf gradients") + + if epoch_probe_mode == "rolling_random": + train_probe_batches = _rolling_probe_batches_from_dataset( + bundle.train_ds, + num_batches=EPOCH_DIAGNOSTIC_TRAIN_BATCHES, + device=DEVICE, + epoch=epoch, + split_tag="train", + ) + val_probe_batches = _rolling_probe_batches_from_dataset( + bundle.val_ds, + num_batches=EPOCH_DIAGNOSTIC_VAL_BATCHES, + device=DEVICE, + epoch=epoch, + split_tag="val", + ) + + train_probe = _evaluate_probe_batches( + model, + train_probe_batches, + strategy=strategy, + tmax=tmax, + use_amp=use_amp, + amp_dtype=amp_dtype, + use_channels_last=use_channels_last, + mc_cache_split="train", + mc_cache_run_dir=run_dir, + ) + val_probe = _evaluate_probe_batches( + model, + val_probe_batches, + strategy=strategy, + tmax=tmax, + use_amp=use_amp, + amp_dtype=amp_dtype, + use_channels_last=use_channels_last, + mc_cache_split="val", + mc_cache_run_dir=run_dir, + ) + epoch_alerts.extend(train_probe.get("alerts", [])) + epoch_alerts.extend(val_probe.get("alerts", [])) + + diagnostic_payload["epochs"].append( + { + "epoch": epoch, + "elapsed_seconds": elapsed_before_resume + (time.time() - start_time), + "is_new_best": bool(improved), + "best_metric_name": selection_metric_name, + "best_metric_value_so_far": float(best_model_metric), + "patience_counter": int(patience_counter), + "early_stopping_monitor_name": early_stopping_monitor_name, + "early_stopping_monitor_mode": early_stopping_mode, + "early_stopping_min_delta": float(early_stopping_min_delta), + "early_stopping_start_epoch": int(early_stopping_start_epoch), + "early_stopping_patience": int(early_stopping_patience), + "early_stopping_best_value_so_far": best_early_stopping_metric, + "history_row": dict(row), + "train_batch_summary": { + "loss": _summary_stats(epoch_losses), + "actor_loss": _summary_stats(epoch_actor), + "critic_loss": _summary_stats(epoch_critic), + "reward": _summary_stats(epoch_reward), + "entropy": _summary_stats(epoch_entropy), + "ce_loss": _summary_stats(epoch_ce), + "dice_loss": _summary_stats(epoch_dice_loss), + "grad_norm": _summary_stats(epoch_grad), + "dice": _summary_stats(epoch_dices), + "iou": _summary_stats(epoch_ious), + "effective_steps": _summary_stats(epoch_effective_steps), + "mask_delta": _summary_stats(epoch_mask_deltas), + "advantage_mean": _summary_stats(epoch_advantage_means), + "advantage_std": _summary_stats(epoch_advantage_stds), + "value_pred_error": _summary_stats(epoch_value_pred_errors), + "reward_zeros_pct": _summary_stats(epoch_reward_zero_pcts), + "biou_delta_mean": _summary_stats(epoch_biou_deltas), + "mean_value_pred": _summary_stats(epoch_mean_value_preds), + "annealed_aux_ce_weight": float(np.mean(epoch_annealed_aux_ce_weights)) if epoch_annealed_aux_ce_weights else 0.0, + "rl_loss_scale": float(np.mean(epoch_rl_loss_scales)) if epoch_rl_loss_scales else 0.0, + "reinforce_loss": _summary_stats(epoch_reinforce_losses), + "entropy_loss": _summary_stats(epoch_entropy_losses), + "entropy_bonus_used": _summary_stats(epoch_entropy_bonuses_used), + "alpha": _summary_stats(epoch_alphas), + "action_distribution": avg_epoch_action_dist if avg_epoch_action_dist else None, + }, + "optimizer": { + "param_groups": _optimizer_diagnostics(optimizer), + "scheduler_last_lr": [float(value) for value in scheduler.get_last_lr()], + "target_entropy": float(target_entropy) if log_alpha is not None else 0.0, + }, + "grad_diagnostics": grad_stats, + "param_diagnostics": param_stats, + "probe_batches": { + "mode": epoch_probe_mode, + "train": _probe_batch_id_lists(train_probe_batches), + "val": _probe_batch_id_lists(val_probe_batches), + }, + "probes": { + "train_fixed": train_probe, + "val_fixed": val_probe, + }, + "probe_epoch_summary": { + "train_fixed": _format_probe_deterioration("train", train_probe, tmax), + "val_fixed": _format_probe_deterioration("val", val_probe, tmax), + }, + "alerts": epoch_alerts, + } + ) + save_json(diagnostic_path, diagnostic_payload) + + _will_early_stop = bool(should_validate and early_stopping_patience > 0 and patience_counter >= early_stopping_patience) + _save_latest_now = (epoch % max(int(SAVE_LATEST_EVERY_N_EPOCHS), 1) == 0) or (epoch == max_epochs) or _will_early_stop + if save_artifacts and ckpt_dir is not None and SAVE_LATEST_EVERY_EPOCH and run_type != "trial" and _save_latest_now: + save_checkpoint( + ckpt_dir / "latest.pt", + run_type=run_type, + model=model, + optimizer=optimizer, + scheduler=scheduler, + scaler=scaler, + epoch=epoch, + best_metric_value=best_model_metric, + best_metric_name=selection_metric_name, + run_config=run_config, + epoch_metrics=row, + patience_counter=patience_counter, + elapsed_seconds=elapsed_before_resume + (time.time() - start_time), + history=history, + log_alpha=log_alpha if strategy == 3 else None, + alpha_optimizer=alpha_optimizer if strategy == 3 else None, + resume_source=resume_source, + ) + if save_artifacts and ckpt_dir is not None and CHECKPOINT_EVERY_N_EPOCHS > 0 and epoch % CHECKPOINT_EVERY_N_EPOCHS == 0 and run_type != "trial": + save_checkpoint( + ckpt_dir / f"epoch_{epoch:04d}.pt", + run_type=run_type, + model=model, + optimizer=optimizer, + scheduler=scheduler, + scaler=scaler, + epoch=epoch, + best_metric_value=best_model_metric, + best_metric_name=selection_metric_name, + run_config=run_config, + epoch_metrics=row, + patience_counter=patience_counter, + elapsed_seconds=elapsed_before_resume + (time.time() - start_time), + history=history, + log_alpha=log_alpha if strategy == 3 else None, + alpha_optimizer=alpha_optimizer if strategy == 3 else None, + resume_source=resume_source, + ) + + if trial is not None and should_validate: + reported_metric = row.get("selection_metric_value") + if reported_metric is None: + reported_metric = _strategy_selection_metric_value(strategy, val_metrics) + if reported_metric is None: + reported_metric = float(val_metrics["val_iou"]) + reported_metric = float(reported_metric) + trial.report(reported_metric, step=epoch) + study_best_value, study_best_trial_number = _current_optuna_study_best_snapshot( + trial, + current_best_value=best_model_metric, + ) + row["study_best_objective"] = study_best_value + row["study_best_trial"] = study_best_trial_number + if USE_TRIAL_PRUNING and epoch >= TRIAL_PRUNER_WARMUP_STEPS and trial.should_prune(): + raise optuna.TrialPruned( + f"Trial pruned at epoch {epoch} with " + f"{selection_metric_name}={reported_metric:.4f}" + ) + + if trial is not None and row.get("study_best_objective") is None: + study_best_value, study_best_trial_number = _current_optuna_study_best_snapshot(trial) + row["study_best_objective"] = study_best_value + row["study_best_trial"] = study_best_trial_number + + if VERBOSE_EPOCH_LOG: + tqdm.write(f"[{run_label}] Epoch {epoch}/{max_epochs}") + tqdm.write(json.dumps(row, indent=2)) + else: + tqdm.write( + f"[{run_label}] Epoch {epoch}/{max_epochs}: " + f"{format_concise_epoch_log(row, best_metric_name=selection_metric_name, best_metric_value=best_model_metric)}" + ) + + if should_validate and early_stopping_patience > 0 and patience_counter >= early_stopping_patience: + print( + f"Early stopping triggered at epoch {epoch}: " + f"monitor={early_stopping_monitor_name} mode={early_stopping_mode} " + f"best={best_early_stopping_metric} current={row.get('early_stopping_monitor_value')} " + f"min_delta={early_stopping_min_delta:.6g} wait={patience_counter}/{early_stopping_patience}." + ) + break + + elapsed = elapsed_before_resume + (time.time() - start_time) + if save_artifacts: + save_json(history_path, history) + if plots_dir is not None and run_type != "trial": + _save_training_plots(history, plots_dir) + # --- training-time accounting for reporting (hardware-normalized, early-stopping-aware) --- + _epoch_seconds_measured = [float(r["epoch_seconds"]) for r in history if r.get("epoch_seconds") is not None] + _resolved_best_epoch = best_epoch + if _resolved_best_epoch is None and history: + _validated = [(int(r["epoch"]), r.get("selection_metric_value")) for r in history if r.get("selection_metric_value") is not None] + if _validated: + _resolved_best_epoch = max(_validated, key=lambda kv: kv[1])[0] + _time_to_best_seconds = elapsed_before_resume + sum( + float(r.get("epoch_seconds") or 0.0) + for r in history + if _resolved_best_epoch is not None and int(r["epoch"]) <= _resolved_best_epoch + ) + try: + _gpu_name = torch.cuda.get_device_name(0) if torch.cuda.is_available() else str(DEVICE) + except Exception: + _gpu_name = str(DEVICE) + summary = { + "best_model_metric_name": selection_metric_name, + "best_model_metric": float(best_model_metric), + # --- training-time reporting fields --- + "best_epoch": (int(_resolved_best_epoch) if _resolved_best_epoch is not None else None), + "epochs_to_best_checkpoint": (int(_resolved_best_epoch) if _resolved_best_epoch is not None else None), + "time_to_best_seconds": float(_time_to_best_seconds), + "seconds_per_epoch_measured_mean": (float(np.mean(_epoch_seconds_measured)) if _epoch_seconds_measured else None), + "seconds_per_epoch_measured_std": (float(np.std(_epoch_seconds_measured, ddof=1)) if len(_epoch_seconds_measured) > 1 else 0.0), + "gpu_name": _gpu_name, + "early_stopping_monitor_name": early_stopping_monitor_name, + "early_stopping_monitor_mode": early_stopping_mode, + "early_stopping_min_delta": float(early_stopping_min_delta), + "early_stopping_start_epoch": int(early_stopping_start_epoch), + "early_stopping_patience": int(early_stopping_patience), + "early_stopping_best_value": best_early_stopping_metric, + "best_val_iou": max((float(r["val_iou"]) for r in history if r.get("val_iou") is not None), default=0.0), + "best_val_dice": max((float(r["val_dice"]) for r in history if r.get("val_dice") is not None), default=0.0), + "best_val_biou": max((float(r["val_biou"]) for r in history if r.get("val_biou") is not None), default=0.0), + "best_val_iou_gain": max((float(r["val_iou_gain"]) for r in history if r.get("val_iou_gain") is not None), default=0.0), + "best_val_biou_gain": max((float(r["val_biou_gain"]) for r in history if r.get("val_biou_gain") is not None), default=0.0), + "final_epoch": int(history[-1]["epoch"]) if history else int(start_epoch - 1), + "elapsed_seconds": elapsed, + "seconds_per_epoch": elapsed / max(len(history), 1), + "device_used": str(DEVICE), + "strategy": strategy, + "run_type": run_type, + "resumed": resume_source is not None, + } + if strategy3_freeze_status is not None: + summary.update( + { + "strategy3_bootstrap_loaded": bool(strategy3_freeze_status["bootstrap_loaded"]), + "strategy3_freeze_requested": bool(strategy3_freeze_status["freeze_requested"]), + "strategy3_freeze_active": bool(strategy3_freeze_status["freeze_active"]), + "strategy3_encoder_state": str(strategy3_freeze_status["encoder_state"]), + "strategy3_decoder_state": str(strategy3_freeze_status["decoder_state"]), + "strategy3_segmentation_head_state": str(strategy3_freeze_status["segmentation_head_state"]), + } + ) + if resume_source is not None: + summary["resume_source"] = resume_source + if save_artifacts: + save_json(run_dir / "summary.json", summary) + return summary, history + +"""============================================================================= +EVALUATION + SMOKE TEST +============================================================================= +""" + +def _save_rgb_panel(image_chw: np.ndarray, pred_hw: np.ndarray, gt_hw: np.ndarray, output_path: Path, title: str) -> None: + img = image_chw.transpose(1, 2, 0) + img = (img - img.min()) / (img.max() - img.min() + 1e-8) + fig, axes = plt.subplots(1, 3, figsize=(12, 4)) + axes[0].imshow(img) + axes[0].set_title("Input") + axes[1].imshow(pred_hw, cmap="gray", vmin=0, vmax=1) + axes[1].set_title("Prediction") + axes[2].imshow(gt_hw, cmap="gray", vmin=0, vmax=1) + axes[2].set_title("Ground Truth") + for ax in axes: + ax.axis("off") + fig.suptitle(title) + fig.tight_layout() + fig.savefig(output_path, dpi=120) + plt.close(fig) + + +def _synchronize_device_for_timing(device: torch.device) -> None: + if device.type == "cuda": + torch.cuda.synchronize(device) + + +def _write_evaluation_timing_csv( + path: Path, + *, + timing_summary: dict[str, Any], +) -> None: + with path.open("w", newline="", encoding="utf-8") as handle: + writer = csv.DictWriter( + handle, + fieldnames=[ + "scope", + "strategy", + "tmax", + "device", + "num_batches", + "num_samples", + "total_inference_ms", + "avg_batch_inference_ms", + "std_batch_inference_ms", + "avg_sample_inference_ms", + "std_sample_inference_ms", + "mean_per_image_inference_ms", + "std_per_image_inference_ms", + "mean_per_image_inference_seconds", + "std_per_image_inference_seconds", + ], + ) + writer.writeheader() + writer.writerow( + { + "scope": str(timing_summary["scope"]), + "strategy": int(timing_summary["strategy"]), + "tmax": int(timing_summary["tmax"]), + "device": str(timing_summary["device"]), + "num_batches": int(timing_summary["num_batches"]), + "num_samples": int(timing_summary["num_samples"]), + "total_inference_ms": f"{float(timing_summary['total_inference_ms']):.6f}", + "avg_batch_inference_ms": f"{float(timing_summary['avg_batch_inference_ms']):.6f}", + "std_batch_inference_ms": f"{float(timing_summary['std_batch_inference_ms']):.6f}", + "avg_sample_inference_ms": f"{float(timing_summary['avg_sample_inference_ms']):.6f}", + "std_sample_inference_ms": f"{float(timing_summary['std_sample_inference_ms']):.6f}", + "mean_per_image_inference_ms": f"{float(timing_summary['mean_per_image_inference_ms']):.6f}", + "std_per_image_inference_ms": f"{float(timing_summary['std_per_image_inference_ms']):.6f}", + "mean_per_image_inference_seconds": f"{float(timing_summary['mean_per_image_inference_seconds']):.9f}", + "std_per_image_inference_seconds": f"{float(timing_summary['std_per_image_inference_seconds']):.9f}", + } + ) + + +def evaluate_model( + *, + model: nn.Module, + model_config: RuntimeModelConfig, + bundle: DataBundle, + run_dir: Path, + strategy: int, + tmax: int, + best_metric_name: str, +) -> tuple[dict[str, dict[str, float]], list[dict[str, Any]]]: + amp_dtype = resolve_amp_dtype(AMP_DTYPE) + use_amp = amp_autocast_enabled(DEVICE) + use_channels_last = _use_channels_last_for_run(model_config) + pred_dir = ensure_dir(run_dir / "predictions") + pred_255_dir = ensure_dir(run_dir / "predictions_255") + + model.eval() + per_metric = {k: [] for k in ("dice", "ppv", "sen", "iou", "biou", "biou_contour", "hd95")} + per_sample: list[dict[str, Any]] = [] + inference_total_ms = 0.0 + inference_batch_count = 0 + inference_sample_count = 0 + inference_batch_times_ms: list[float] = [] + inference_sample_times_ms: list[float] = [] + track_strategy3_mc_cache = bool(strategy == 3 and _uses_refinement_runtime(model, strategy=strategy)) + if track_strategy3_mc_cache: + _strategy3_bump_mc_cache_fingerprint(model) + _strategy3_reset_mc_cache_stats(model) + + with torch.inference_mode(): + prefetcher = CUDAPrefetcher(bundle.test_loader, DEVICE) + try: + for batch in tqdm(prefetcher, total=len(bundle.test_loader), desc="Evaluating", leave=False): + image = batch["image"] + gt = batch["mask"] + sample_ids = [str(item) for item in batch["sample_id"]] + if use_amp and DEVICE.type == "cuda": + image = image.to(dtype=amp_dtype) + _synchronize_device_for_timing(DEVICE) + inference_start = time.perf_counter() + pred = infer_segmentation_mask( + model, + image, + tmax, + strategy=strategy, + use_amp=use_amp, + amp_dtype=amp_dtype, + use_channels_last=use_channels_last, + sample_ids=sample_ids, + mc_cache_split="test", + mc_cache_run_dir=run_dir, + ).float() + _synchronize_device_for_timing(DEVICE) + inference_elapsed_ms = (time.perf_counter() - inference_start) * 1000.0 + inference_total_ms += inference_elapsed_ms + inference_batch_count += 1 + batch_size = int(pred.shape[0]) + inference_sample_count += batch_size + inference_batch_times_ms.append(float(inference_elapsed_ms)) + per_image_inference_ms = float(inference_elapsed_ms) / float(max(batch_size, 1)) + inference_sample_times_ms.extend([per_image_inference_ms] * batch_size) + pred_np = pred.cpu().numpy().astype(np.uint8) + gt_np = gt.cpu().numpy().astype(np.uint8) + for idx in range(pred_np.shape[0]): + metrics = compute_all_metrics(pred_np[idx], gt_np[idx]) + for key, value in metrics.items(): + per_metric.setdefault(key, []).append(value) + per_sample.append( + { + "sample_id": sample_ids[idx], + **metrics, + "inference_time_ms": per_image_inference_ms, + "inference_time_seconds": per_image_inference_ms / 1000.0, + } + ) + mask_2d = pred_np[idx].squeeze() + PILImage.fromarray(mask_2d).save(pred_dir / f"{sample_ids[idx]}.png") + PILImage.fromarray((mask_2d * 255).astype(np.uint8)).save(pred_255_dir / f"{sample_ids[idx]}.png") + finally: + prefetcher.close() + del prefetcher + if track_strategy3_mc_cache: + mc_cache_stats = _strategy3_get_mc_cache_stats(model) + print( + "[Strategy3 MC Cache] " + f"ram_hits={mc_cache_stats['ram_hits']} " + f"disk_hits={mc_cache_stats['disk_hits']} " + f"misses={mc_cache_stats['misses']} " + f"writes={mc_cache_stats['writes']}" + ) + + aggregate: dict[str, dict[str, float]] = {} + for key, values in per_metric.items(): + values_np = np.array(values, dtype=np.float32) + aggregate[key] = {"mean": float(values_np.mean()), "std": float(values_np.std())} + batch_times_np = np.array(inference_batch_times_ms, dtype=np.float64) + sample_times_np = np.array(inference_sample_times_ms, dtype=np.float64) + timing_summary = { + "scope": "test_set_evaluation", + "strategy": int(strategy), + "tmax": int(tmax), + "device": str(DEVICE), + "num_batches": int(inference_batch_count), + "num_samples": int(inference_sample_count), + "total_inference_ms": float(inference_total_ms), + "avg_batch_inference_ms": float(batch_times_np.mean()) if batch_times_np.size > 0 else 0.0, + "std_batch_inference_ms": float(batch_times_np.std()) if batch_times_np.size > 0 else 0.0, + "avg_sample_inference_ms": float(sample_times_np.mean()) if sample_times_np.size > 0 else 0.0, + "std_sample_inference_ms": float(sample_times_np.std()) if sample_times_np.size > 0 else 0.0, + "mean_per_image_inference_ms": float(sample_times_np.mean()) if sample_times_np.size > 0 else 0.0, + "std_per_image_inference_ms": float(sample_times_np.std()) if sample_times_np.size > 0 else 0.0, + "mean_per_image_inference_seconds": float(sample_times_np.mean() / 1000.0) if sample_times_np.size > 0 else 0.0, + "std_per_image_inference_seconds": float(sample_times_np.std() / 1000.0) if sample_times_np.size > 0 else 0.0, + } + + save_json( + run_dir / "evaluation.json", + { + "strategy": strategy, + "best_metric_name": str(best_metric_name), + "metrics": aggregate, + "per_sample": per_sample, + "timing": timing_summary, + }, + ) + + df_all = pd.DataFrame(per_sample) + avg_row = {} + for column in df_all.columns: + avg_row[column] = df_all[column].mean() if pd.api.types.is_numeric_dtype(df_all[column]) else "AVERAGE" + df_samples = pd.concat([df_all, pd.DataFrame([avg_row])], ignore_index=True) + df_summary = pd.DataFrame(aggregate).T + df_summary.index.name = "metric" + df_low_iou = df_all[df_all["iou"] < 0.01] + history_path = run_dir / "history.json" + df_history = pd.DataFrame(load_json(history_path)) if history_path.exists() else None + + xlsx_path = run_dir / "evaluation_results.xlsx" + with pd.ExcelWriter(xlsx_path, engine="openpyxl") as writer: + df_samples.to_excel(writer, sheet_name="Per Sample", index=False) + df_summary.to_excel(writer, sheet_name="Summary") + if not df_low_iou.empty: + df_low_iou.to_excel(writer, sheet_name="Low IoU Samples", index=False) + if df_history is not None: + df_history.to_excel(writer, sheet_name="Training History", index=False) + + csv_rows = [{"sample_id": row["sample_id"]} for row in df_low_iou.to_dict(orient="records")] + save_json(run_dir / "evaluation_summary.json", {"mean_iou": aggregate["iou"]["mean"], "mean_dice": aggregate["dice"]["mean"]}) + pd.DataFrame(csv_rows).to_csv(run_dir / "low_iou_samples.csv", index=False) + _write_evaluation_timing_csv( + run_dir / "timing.csv", + timing_summary=timing_summary, + ) + return aggregate, per_sample + +def percent_root(percent: float) -> Path: + return ensure_dir(RUNS_ROOT / MODEL_NAME / f"pct_{percent_label(percent)}") + +def strategy_dir_name(strategy: int, model_config: RuntimeModelConfig | None = None) -> str: + model_config = (model_config or current_model_config()).validate() + if model_config.backbone_family == "custom_vgg": + return f"strategy_{strategy}_custom_vgg" + return f"strategy_{strategy}" + +def strategy_root_for_percent( + strategy: int, + percent: float, + model_config: RuntimeModelConfig | None = None, +) -> Path: + return ensure_dir(percent_root(percent) / strategy_dir_name(strategy, model_config)) + +def final_root_for_strategy( + strategy: int, + percent: float, + model_config: RuntimeModelConfig | None = None, +) -> Path: + return ensure_dir(strategy_root_for_percent(strategy, percent, model_config) / "final") + +def ensure_specific_checkpoint_scope(selector_name: str, selector_mode: str) -> None: + if selector_mode != "specific": + return + # Allow STRATEGY2 checkpoints with dict mapping for dynamic per-percent selection + if "strategy2" in selector_name.lower() and isinstance(STRATEGY2_SPECIFIC_CHECKPOINT, dict): + return + if len(STRATEGIES) != 1 or len(DATASET_PERCENTS) != 1: + raise ValueError( + f"{selector_name}=specific is only supported when exactly one strategy and one dataset percent are selected. " + f"Got STRATEGIES={STRATEGIES} and DATASET_PERCENTS={DATASET_PERCENTS}." + ) + +def resolve_checkpoint_path( + *, + run_dir: Path, + selector_mode: str, + specific_checkpoint: str | Path | dict, + purpose: str, +) -> Path: + run_dir = Path(run_dir) + if selector_mode == "latest": + checkpoint_path = run_dir / "checkpoints" / "latest.pt" + elif selector_mode == "best": + checkpoint_path = run_dir / "checkpoints" / "best.pt" + elif selector_mode == "specific": + ensure_specific_checkpoint_scope(purpose, selector_mode) + if not specific_checkpoint: + raise ValueError(f"{purpose}=specific requires a non-empty specific checkpoint path.") + checkpoint_path = Path(specific_checkpoint).expanduser().resolve() + else: + raise ValueError(f"Unsupported checkpoint selector mode '{selector_mode}' for {purpose}.") + + if not checkpoint_path.exists(): + raise FileNotFoundError(f"Checkpoint for {purpose} not found: {checkpoint_path}") + return checkpoint_path + +def resolve_train_resume_checkpoint_path(run_dir: Path) -> Path | None: + if TRAIN_RESUME_MODE == "off": + return None + return resolve_checkpoint_path( + run_dir=run_dir, + selector_mode=TRAIN_RESUME_MODE, + specific_checkpoint=TRAIN_RESUME_SPECIFIC_CHECKPOINT, + purpose="train_resume_checkpoint", + ) + +def resolve_strategy2_checkpoint_path( + strategy: int, + percent: float, + model_config: RuntimeModelConfig | None = None, +) -> Path: + if strategy != 3: + raise ValueError(f"Strategy 2 dependency checkpoint requested for unsupported strategy {strategy}.") + + specific_checkpoint = STRATEGY2_SPECIFIC_CHECKPOINT + if isinstance(specific_checkpoint, dict): + ctx = globals().get("CURRENT_FOLD_CONTEXT") + _phase_mode_fn = globals().get("using_fixed_phase_mode") + in_phase_mode = callable(_phase_mode_fn) and _phase_mode_fn() + if in_phase_mode and ctx is not None: + # Phase mode: key by phase index (split_repeat_index) + specific_checkpoint = specific_checkpoint.get(ctx.split_repeat_index, "") + else: + # Non-phase mode: key by dataset percent (float) + specific_checkpoint = specific_checkpoint.get(percent, "") + + checkpoint_path = resolve_checkpoint_path( + run_dir=final_root_for_strategy(2, percent, model_config), + selector_mode=STRATEGY2_CHECKPOINT_MODE, + specific_checkpoint=specific_checkpoint, + purpose="strategy2_checkpoint", + ) + + # Print which checkpoint is being used + checkpoint_label = run_identity_label(strategy=strategy, percent=percent) + ctx = globals().get("CURRENT_FOLD_CONTEXT") + if ctx is not None and abs(float(percent) - float(ctx.percent_fraction)) <= 1e-12: + checkpoint_label = run_identity_label( + strategy=strategy, + percent=percent, + split_payload={ + "split_repeat_index": ctx.split_repeat_index, + "subset_repeat_index": ctx.subset_repeat_index, + "dataset_percent": ctx.percent_fraction, + }, + ) + print(f"[Strategy 2 Checkpoint] {checkpoint_label} | Loading: {checkpoint_path}") + + return checkpoint_path + +def load_required_hparams(payload: dict[str, Any], *, source: str, strategy: int, percent: float) -> dict[str, Any]: + missing_keys = [name for name in REQUIRED_HPARAM_KEYS if name not in payload] + if missing_keys: + raise KeyError( + f"Incomplete hyperparameters for strategy={strategy}, percent={percent_text(percent)} from {source}. " + f"Missing keys: {missing_keys}. Required keys: {REQUIRED_HPARAM_KEYS}." + ) + return dict(payload) + +def load_saved_best_params_if_optuna_off( + strategy: int, + percent: float, + *, + model_config: RuntimeModelConfig, +) -> dict[str, Any]: + _, study_root, _ = study_paths_for(strategy, percent, model_config) + best_params_path = study_root / "best_params.json" + if not best_params_path.exists(): + raise FileNotFoundError( + f"RUN_OPTUNA=False and USE_EXISTING_BEST_PARAMS_WHEN_OPTUNA_OFF=True, but no saved best params were found " + f"for strategy={strategy}, percent={percent_text(percent)} at {best_params_path}." + ) + params = load_json(best_params_path) + params = load_required_hparams( + params, + source=str(best_params_path), + strategy=strategy, + percent=percent, + ) + print( + f"[Optuna Off] Using saved best parameters for strategy={strategy}, " + f"percent={percent_text(percent)} from {best_params_path}." + ) + for name in REQUIRED_HPARAM_KEYS: + print(f" {name:20s}: {_format_hparam_value(name, params[name])}") + return params + +def load_manual_hparams_if_optuna_off(strategy: int, percent: float) -> dict[str, Any]: + key = manual_hparams_key(strategy, percent) + if key not in MANUAL_HPARAMS_IF_OPTUNA_OFF: + raise KeyError( + f"RUN_OPTUNA=False and USE_EXISTING_BEST_PARAMS_WHEN_OPTUNA_OFF=False, but no manual hyperparameter " + f"JSON filename was found for strategy={strategy}, percent={percent_text(percent)} under key '{key}'. " + f"Required keys: {REQUIRED_HPARAM_KEYS}." + ) + manual_filename = MANUAL_HPARAMS_IF_OPTUNA_OFF[key] + manual_path = (HARD_CODED_PARAM_DIR / manual_filename).resolve() + if not manual_path.exists(): + raise FileNotFoundError( + f"RUN_OPTUNA=False and USE_EXISTING_BEST_PARAMS_WHEN_OPTUNA_OFF=False, but the manual hyperparameter " + f"JSON file for strategy={strategy}, percent={percent_text(percent)} was not found at {manual_path}. " + f"Configured key='{key}', filename='{manual_filename}'." + ) + params = load_json(manual_path) + params = load_required_hparams( + params, + source=str(manual_path), + strategy=strategy, + percent=percent, + ) + print( + f"[Optuna Off] Using manual hyperparameters for strategy={strategy}, " + f"percent={percent_text(percent)} from {manual_path}." + ) + for name in REQUIRED_HPARAM_KEYS: + print(f" {name:20s}: {_format_hparam_value(name, params[name])}") + return params + +def resolve_job_params( + strategy: int, + percent: float, + bundle: DataBundle, + *, + model_config: RuntimeModelConfig, + strategy2_checkpoint_path: str | Path | None = None, +) -> dict[str, Any]: + strategy = _require_supported_strategy(strategy) + if RUN_OPTUNA: + banner( + f"OPTUNA STUDY | {run_identity_label(strategy=strategy, percent=percent, split_payload=bundle.split_payload)}" + ) + return run_study( + strategy, + bundle, + model_config=model_config, + strategy2_checkpoint_path=strategy2_checkpoint_path, + ) + + if USE_EXISTING_BEST_PARAMS_WHEN_OPTUNA_OFF: + return load_saved_best_params_if_optuna_off(strategy, percent, model_config=model_config) + + return load_manual_hparams_if_optuna_off(strategy, percent) + +def read_run_config_for_eval(run_dir: Path, checkpoint_path: Path) -> dict[str, Any]: + run_config_path = Path(run_dir) / "run_config.json" + if run_config_path.exists(): + return load_json(run_config_path) + ckpt = torch.load(checkpoint_path, map_location="cpu", weights_only=False) + return checkpoint_run_config_payload(ckpt) + +def run_evaluation_for_run( + *, + strategy: int, + percent: float, + bundle: DataBundle, + run_dir: Path, + strategy2_checkpoint_path: str | Path | None = None, +) -> tuple[dict[str, dict[str, float]], list[dict[str, Any]]]: + strategy = _require_supported_strategy(strategy) + checkpoint_path = resolve_checkpoint_path( + run_dir=run_dir, + selector_mode=EVAL_CHECKPOINT_MODE, + specific_checkpoint=EVAL_SPECIFIC_CHECKPOINT, + purpose="evaluation_checkpoint", + ) + effective_run_dir = Path(run_dir) + if not (effective_run_dir / "run_config.json").exists() and checkpoint_path.parent.name == "checkpoints": + effective_run_dir = checkpoint_path.parent.parent + print( + f"[Evaluation] {run_identity_label(strategy=strategy, percent=percent, split_payload=bundle.split_payload)} " + f"| checkpoint={checkpoint_path}" + ) + runtime_config = read_run_config_for_eval(effective_run_dir, checkpoint_path) + set_current_job_params(runtime_config) + model_config = RuntimeModelConfig.from_payload(runtime_config).validate() + if strategy == 3 and runtime_config.get("strategy2_checkpoint_path"): + strategy2_checkpoint_path = runtime_config["strategy2_checkpoint_path"] + elif strategy == 3: + strategy2_checkpoint_path = resolve_strategy2_checkpoint_path(strategy, percent, model_config) + dropout_p = float(runtime_config.get("dropout_p", DEFAULT_DROPOUT_P)) + tmax = int(runtime_config.get("tmax", DEFAULT_TMAX)) + eval_model, _description, _compiled = build_model( + strategy, + dropout_p, + model_config=model_config, + strategy2_checkpoint_path=strategy2_checkpoint_path, + ) + checkpoint_payload = load_checkpoint( + checkpoint_path, + model=eval_model, + device=DEVICE, + ) + best_metric_name = str( + checkpoint_payload.get("best_metric_name") + or runtime_config.get("best_checkpoint_metric_name") + or _strategy_selection_metric_name(strategy) + ) + aggregate, per_sample = evaluate_model( + model=eval_model, + model_config=model_config, + bundle=bundle, + run_dir=effective_run_dir, + strategy=strategy, + tmax=tmax, + best_metric_name=best_metric_name, + ) + evaluation_json_path = effective_run_dir / "evaluation.json" + evaluation_payload = load_json(evaluation_json_path) + evaluation_payload["checkpoint_mode"] = EVAL_CHECKPOINT_MODE + evaluation_payload["checkpoint_path"] = str(checkpoint_path) + evaluation_payload["best_metric_name"] = best_metric_name + if checkpoint_payload.get("best_metric_value") is not None: + evaluation_payload["best_metric_value"] = float(checkpoint_payload["best_metric_value"]) + save_json(evaluation_json_path, evaluation_payload) + del eval_model + run_cuda_cleanup( + context=f"evaluation {run_identity_label(strategy=strategy, percent=percent, split_payload=bundle.split_payload)}" + ) + return aggregate, per_sample + +def run_smoke_test( + *, + strategy: int, + model_config: RuntimeModelConfig, + bundle: DataBundle, + smoke_root: Path, + strategy2_checkpoint_path: str | Path | None = None, +) -> None: + banner( + f"PRE-TRAINING SMOKE TEST | {run_identity_label(strategy=strategy, percent=bundle.percent, split_payload=bundle.split_payload)}" + ) + smoke_root = ensure_dir(smoke_root) + if RUN_OPTUNA: + set_current_job_params() + elif USE_EXISTING_BEST_PARAMS_WHEN_OPTUNA_OFF: + set_current_job_params( + load_saved_best_params_if_optuna_off(strategy, bundle.percent, model_config=model_config) + ) + else: + set_current_job_params(load_manual_hparams_if_optuna_off(strategy, bundle.percent)) + sample = bundle.test_ds[SMOKE_TEST_SAMPLE_INDEX] + image = sample["image"].unsqueeze(0).to(DEVICE) + raw_image = sample["image"].numpy() + raw_gt = sample["mask"].squeeze(0).numpy() + amp_dtype = resolve_amp_dtype(AMP_DTYPE) + use_amp = amp_autocast_enabled(DEVICE) + if use_amp and DEVICE.type == "cuda": + image = image.to(dtype=amp_dtype) + + model, description, compiled = build_model( + strategy, + DEFAULT_DROPOUT_P, + model_config=model_config, + strategy2_checkpoint_path=strategy2_checkpoint_path, + ) + print_model_parameter_summary( + model=model, + description=f"{description} | Smoke Test", + strategy=strategy, + model_config=model_config, + dropout_p=DEFAULT_DROPOUT_P, + amp_dtype=amp_dtype, + compiled=compiled, + ) + pred = infer_segmentation_mask( + model, + image, + DEFAULT_TMAX, + strategy=strategy, + use_amp=use_amp, + amp_dtype=amp_dtype, + use_channels_last=_use_channels_last_for_run(model_config), + sample_ids=[str(sample["sample_id"])], + mc_cache_split="test", + mc_cache_run_dir=smoke_root, + ).float() + pred_np = pred[0, 0].detach().cpu().numpy() + panel_path = smoke_root / "smoke_panel.png" + raw_mask_path = smoke_root / "smoke_prediction.png" + _save_rgb_panel( + raw_image, + pred_np, + raw_gt, + panel_path, + f"Smoke Test | {run_identity_label(strategy=strategy, percent=bundle.percent, split_payload=bundle.split_payload)}", + ) + PILImage.fromarray((pred_np * 255).astype(np.uint8)).save(raw_mask_path) + del model + run_cuda_cleanup( + context=f"smoke {run_identity_label(strategy=strategy, percent=bundle.percent, split_payload=bundle.split_payload)}" + ) + print( + f"[Smoke Test] {run_identity_label(strategy=strategy, percent=bundle.percent, split_payload=bundle.split_payload)} passed. " + f"Saved panel to {panel_path.name} and mask to {raw_mask_path.name}." + ) + +"""============================================================================= +OVERFIT TEST +============================================================================= +""" + +OVERFIT_HISTORY_KEYS = ( + "dice", + "iou", + "loss", + "reward", + "actor_loss", + "critic_loss", + "ce_loss", + "dice_loss", + "entropy", + "grad_norm", + "action_dist", + "reward_pos_pct", + "pred_fg_pct", + "gt_fg_pct", +) + +def empty_overfit_history() -> dict[str, list[Any]]: + return {key: [] for key in OVERFIT_HISTORY_KEYS} + +def load_overfit_history_for_resume(history_path: Path, checkpoint_payload: dict[str, Any]) -> dict[str, list[Any]]: + history = empty_overfit_history() + checkpoint_epoch = int(checkpoint_payload.get("epoch", 0)) + if history_path.exists(): + payload = load_json(history_path) + if not isinstance(payload, dict): + raise RuntimeError(f"Expected dict history at {history_path}, found {type(payload).__name__}.") + for key in OVERFIT_HISTORY_KEYS: + values = payload.get(key, []) + if isinstance(values, list): + history[key] = list(values[:checkpoint_epoch]) + return history + + epoch_metrics = checkpoint_payload.get("epoch_metrics", {}) + if isinstance(epoch_metrics, dict): + for key in OVERFIT_HISTORY_KEYS: + if key in epoch_metrics: + history[key].append(epoch_metrics[key]) + return history + +def _grad_diagnostics(model: nn.Module) -> dict[str, Any]: + raw = _unwrap_compiled(model) + groups: dict[str, list[float]] = {} + total_sq = 0.0 + n_nan = 0 + n_inf = 0 + n_zero = 0 + n_total_params = 0 + + for name, param in raw.named_parameters(): + if not param.requires_grad: + continue + n_total_params += 1 + if param.grad is None: + n_zero += 1 + continue + grad_norm = float(param.grad.data.norm(2).item()) + if math.isnan(grad_norm): + n_nan += 1 + continue + if math.isinf(grad_norm): + n_inf += 1 + continue + total_sq += grad_norm ** 2 + group_name = name.split(".", 1)[0] + groups.setdefault(group_name, []).append(grad_norm) + + group_stats: dict[str, dict[str, float | int]] = {} + for group_name, norms in groups.items(): + group_stats[group_name] = { + "min": min(norms), + "max": max(norms), + "mean": sum(norms) / len(norms), + "count": len(norms), + } + return { + "global_norm": total_sq ** 0.5, + "groups": group_stats, + "n_nan": n_nan, + "n_inf": n_inf, + "n_zero_grad": n_zero, + "n_total": n_total_params, + } + +def _param_diagnostics(model: nn.Module, prev_params: dict[str, torch.Tensor] | None = None) -> dict[str, dict[str, float]]: + raw = _unwrap_compiled(model) + info: dict[str, dict[str, list[float]]] = {} + for name, param in raw.named_parameters(): + if not param.requires_grad: + continue + param_norm = float(param.data.norm(2).item()) + group_name = name.split(".", 1)[0] + entry = info.setdefault(group_name, {"norms": [], "update_ratios": []}) + entry["norms"].append(param_norm) + if prev_params is not None and name in prev_params: + delta = float((param.data - prev_params[name]).norm(2).item()) + entry["update_ratios"].append(delta / max(param_norm, 1e-12)) + + summary: dict[str, dict[str, float]] = {} + for group_name, values in info.items(): + norms = values["norms"] + ratios = values["update_ratios"] + summary[group_name] = { + "p_min": min(norms), + "p_max": max(norms), + "p_mean": sum(norms) / len(norms), + } + if ratios: + summary[group_name]["ur_min"] = min(ratios) + summary[group_name]["ur_max"] = max(ratios) + summary[group_name]["ur_mean"] = sum(ratios) / len(ratios) + return summary + +def _snapshot_params(model: nn.Module) -> dict[str, torch.Tensor]: + raw = _unwrap_compiled(model) + return { + name: param.data.detach().clone() + for name, param in raw.named_parameters() + if param.requires_grad + } + +def _action_distribution( + model: nn.Module, + image: torch.Tensor, + seg: torch.Tensor, + tmax: int, + use_amp: bool, + amp_dtype: torch.dtype, + *, + strategy: int | None = None, + sample_ids: list[str] | None = None, + mc_cache_split: Literal["train", "val", "test"] | None = None, + mc_cache_run_dir: Path | None = None, +) -> tuple[list[dict[str, float]], torch.Tensor]: + distributions: list[dict[str, float]] = [] + effective_tmax = _resolve_test_iteration_tmax(tmax, context="_action_distribution") if strategy != 2 else max(int(tmax), 1) + refinement_context: dict[str, torch.Tensor] | None = None + if strategy == 3 and _uses_refinement_runtime(model, strategy=strategy): + with autocast_ctx(enabled=use_amp, device=image.device, amp_dtype=amp_dtype): + refinement_context = model.prepare_refinement_context( + image, + sample_ids=sample_ids, + mc_mode="eval", + mc_cache_split=mc_cache_split, + mc_cache_run_dir=mc_cache_run_dir, + ) + seg = seg.float() + for _step in range(effective_tmax): + if refinement_context is not None: + with autocast_ctx(enabled=use_amp, device=image.device, amp_dtype=amp_dtype): + state = model.forward_refinement_state( + refinement_context["base_features"], + seg, + refinement_context["decoder_prob"], + refinement_context["mc_variance"], + refinement_context["pred_entropy"], + encoder_features=refinement_context.get("encoder_features"), + ) + policy_raw, _ = model.forward_from_state(state) + delta = _strategy3_policy_delta(policy_raw).to(dtype=seg.dtype) + seg = _strategy3_apply_delta(seg, delta).to(dtype=seg.dtype) + distributions.append(_strategy3_delta_distribution(delta)) + else: + with autocast_ctx(enabled=use_amp, device=image.device, amp_dtype=amp_dtype): + masked = image * seg + policy_logits = model.forward_policy_only(masked) + actions, _, _ = sample_actions(policy_logits, stochastic=False) + seg = apply_actions(seg, actions, num_actions=policy_logits.shape[1]).to(dtype=seg.dtype) + total_pixels = max(actions.numel(), 1) + step_dist: dict[str, float] = {} + action_count = int(policy_logits.shape[1]) + for action_idx in range(action_count): + step_dist[str(action_idx)] = float((actions == action_idx).sum().item()) / total_pixels * 100.0 + distributions.append(step_dist) + if refinement_context is not None: + return distributions, threshold_binary_mask(seg.float()).float() + return distributions, seg + +def _numerical_health_check(outputs_dict: dict[str, Any], prefix: str = "") -> list[str]: + alerts: list[str] = [] + for name, value in outputs_dict.items(): + if value is None: + continue + if isinstance(value, (int, float)): + if math.isnan(value): + alerts.append(f"{prefix}{name} = NaN") + elif math.isinf(value): + alerts.append(f"{prefix}{name} = Inf") + elif name == "train_reward_zeros_pct" and float(value) > 98.0: + alerts.append(f"{prefix}reward is degenerate (>98% zero-reward pixels)") + continue + if torch.is_tensor(value): + if torch.isnan(value).any(): + alerts.append(f"{prefix}{name} contains NaN") + if torch.isinf(value).any(): + alerts.append(f"{prefix}{name} contains Inf") + return alerts + +def _batch_binary_metrics(pred: torch.Tensor, gt: torch.Tensor) -> tuple[list[float], list[float]]: + pred_np = pred.detach().cpu().numpy().astype(np.uint8) + gt_np = gt.detach().cpu().numpy().astype(np.uint8) + dices: list[float] = [] + ious: list[float] = [] + for idx in range(pred_np.shape[0]): + metrics = compute_all_metrics(pred_np[idx], gt_np[idx]) + dices.append(float(metrics["dice"])) + ious.append(float(metrics["iou"])) + return dices, ious + +def diagnostic_path_for_run(run_dir: Path) -> Path: + return Path(run_dir) / "diagnostic.json" + +def _summary_stats(values: list[float]) -> dict[str, float | int | None]: + if not values: + return {"count": 0, "mean": None, "std": None, "min": None, "max": None} + arr = np.asarray(values, dtype=np.float64) + return { + "count": int(arr.size), + "mean": float(arr.mean()), + "std": float(arr.std()), + "min": float(arr.min()), + "max": float(arr.max()), + } + +def _nanmean_or_default(values: list[float], default: float = 0.0) -> float: + if not values: + return float(default) + arr = np.asarray(values, dtype=np.float64) + if np.isnan(arr).all(): + return float(default) + return float(np.nanmean(arr)) + +def _tensor_stats(tensor: torch.Tensor | None) -> dict[str, Any] | None: + if tensor is None: + return None + data = tensor.detach().float() + flat = data.reshape(-1) + if flat.numel() == 0: + return {"shape": list(data.shape), "dtype": str(tensor.dtype), "numel": 0} + return { + "shape": list(data.shape), + "dtype": str(tensor.dtype), + "numel": int(flat.numel()), + "mean": float(flat.mean().item()), + "std": float(flat.std(unbiased=False).item()), + "min": float(flat.min().item()), + "max": float(flat.max().item()), + } + +def _action_histogram(actions: torch.Tensor, action_count: int) -> dict[str, float]: + total_pixels = max(actions.numel(), 1) + return { + str(action_idx): float((actions == action_idx).sum().item()) / total_pixels * 100.0 + for action_idx in range(action_count) + } + +def _jsonable_action_distribution(distributions: list[dict[int, float]] | list[dict[str, float]]) -> list[dict[str, float]]: + jsonable: list[dict[str, float]] = [] + for step_dist in distributions: + jsonable.append({str(key): float(value) for key, value in step_dist.items()}) + return jsonable + +def _average_action_distributions( + distributions_per_batch: list[list[dict[str, float]]], + steps: int, +) -> list[dict[str, float]]: + averaged: list[dict[str, float]] = [] + if not distributions_per_batch: + return averaged + for step_idx in range(steps): + action_keys = sorted( + { + str(action_idx) + for batch_dist in distributions_per_batch + if step_idx < len(batch_dist) + for action_idx in batch_dist[step_idx].keys() + } + ) + if not action_keys: + continue + step_summary: dict[str, float] = {} + for action_idx in action_keys: + values = [ + float(batch_dist[step_idx][action_idx]) + for batch_dist in distributions_per_batch + if step_idx < len(batch_dist) and action_idx in batch_dist[step_idx] + ] + step_summary[str(action_idx)] = float(np.mean(values)) if values else 0.0 + averaged.append(step_summary) + return averaged + +def _trajectory_degradation_summary(step_trace: list[dict[str, Any]]) -> dict[str, Any]: + if not step_trace: + return {} + ious = [float(step.get("iou_mean", 0.0)) for step in step_trace] + dices = [float(step.get("dice_mean", 0.0)) for step in step_trace] + ts = [int(step.get("t", idx)) for idx, step in enumerate(step_trace)] + init_iou = ious[0] + init_dice = dices[0] + best_iou = max(ious) + best_dice = max(dices) + best_iou_t = ts[ious.index(best_iou)] + best_dice_t = ts[dices.index(best_dice)] + first_worse_than_initial_iou_t = next((ts[idx] for idx, value in enumerate(ious[1:], start=1) if value < init_iou - 1e-6), None) + first_worse_than_prev_iou_t = next((ts[idx] for idx in range(1, len(ious)) if ious[idx] < ious[idx - 1] - 1e-6), None) + largest_iou_drop = max(best_iou - value for value in ious) + largest_iou_drop_t = ts[max(range(len(ious)), key=lambda idx: best_iou - ious[idx])] + return { + "steps_recorded": len(step_trace) - 1, + "best_iou_t": best_iou_t, + "best_iou": best_iou, + "best_dice_t": best_dice_t, + "best_dice": best_dice, + "final_t": ts[-1], + "final_iou": ious[-1], + "final_dice": dices[-1], + "delta_final_vs_init_iou": ious[-1] - init_iou, + "delta_final_vs_init_dice": dices[-1] - init_dice, + "delta_final_vs_best_iou": ious[-1] - best_iou, + "delta_final_vs_best_dice": dices[-1] - best_dice, + "first_worse_than_initial_iou_t": first_worse_than_initial_iou_t, + "first_worse_than_prev_iou_t": first_worse_than_prev_iou_t, + "largest_iou_drop_from_best": largest_iou_drop, + "largest_iou_drop_t": largest_iou_drop_t, + } + +def _average_rollout_traces(traces_per_batch: list[list[dict[str, Any]]]) -> list[dict[str, Any]]: + averaged: list[dict[str, Any]] = [] + if not traces_per_batch: + return averaged + max_steps = max(len(trace) for trace in traces_per_batch) + for step_idx in range(max_steps): + present = [trace[step_idx] for trace in traces_per_batch if step_idx < len(trace)] + if not present: + continue + reward_pos_values = [float(step["reward_pos_pct"]) for step in present if step.get("reward_pos_pct") is not None] + value_scores = [float(step["value_score"]) for step in present if step.get("value_score") is not None] + averaged.append( + { + "t": int(np.mean([float(step.get("t", step_idx)) for step in present])), + "dice_mean": float(np.mean([float(step.get("dice_mean", 0.0)) for step in present])), + "iou_mean": float(np.mean([float(step.get("iou_mean", 0.0)) for step in present])), + "pred_fg_pct": float(np.mean([float(step.get("pred_fg_pct", 0.0)) for step in present])), + "reward_pos_pct": float(np.mean(reward_pos_values)) if reward_pos_values else None, + "value_score": float(np.mean(value_scores)) if value_scores else None, + } + ) + return averaged + +def _rollout_probe_trace( + model: nn.Module, + image: torch.Tensor, + gt_mask: torch.Tensor, + *, + strategy: int, + tmax: int, + use_amp: bool, + amp_dtype: torch.dtype, + use_channels_last: bool, + sample_ids: list[str] | None = None, + mc_cache_split: Literal["train", "val", "test"] | None = None, + mc_cache_run_dir: Path | None = None, +) -> dict[str, Any]: + effective_tmax = _resolve_test_iteration_tmax(tmax, context="_rollout_probe_trace") if strategy != 2 else max(int(tmax), 1) + rollout_trace: list[dict[str, Any]] = [] + batch_action_dist: list[dict[str, float]] = [] + reward_pos_pct = 0.0 + init_fg_pct = 0.0 + first_action_dist: dict[str, float] | None = None + first_policy_stats: dict[str, Any] | None = None + first_value_stats: dict[str, Any] | None = None + decoder_prob_stats: dict[str, Any] | None = None + first_entropy: float | None = None + selected_t = 0 + + def record_step( + *, + t: int, + seg_tensor: torch.Tensor, + seg_prev: torch.Tensor | None = None, + delta_map: torch.Tensor | None = None, + value_score: float | None = None, + action_distribution: dict[str, float] | None = None, + reward_pos: float | None = None, + reward_map_tensor: torch.Tensor | None = None, + step_entropy: float | None = None, + policy_stats: dict[str, Any] | None = None, + ) -> None: + pred_t = threshold_binary_mask(seg_tensor.float()).float() + dice_vals, iou_vals = _batch_binary_metrics(pred_t, gt_mask.float()) + step_data: dict[str, Any] = { + "t": int(t), + "dice_mean": float(np.mean(dice_vals)) if dice_vals else 0.0, + "iou_mean": float(np.mean(iou_vals)) if iou_vals else 0.0, + "pred_fg_pct": float(pred_t.sum().item()) / max(pred_t.numel(), 1) * 100.0, + "reward_pos_pct": None if reward_pos is None else float(reward_pos), + "value_score": None if value_score is None else float(value_score), + "action_distribution": action_distribution, + "seg_soft_stats": _tensor_stats(seg_tensor), + "entropy": step_entropy, + "policy_logit_stats": policy_stats, + } + if seg_prev is not None: + delta = seg_tensor.float() - seg_prev.float() + abs_delta = delta.abs() + # Binary mask flip tracking: how many pixels actually change in the thresholded output + binary_prev = threshold_binary_mask(seg_prev.float()).float() + binary_curr = threshold_binary_mask(seg_tensor.float()).float() + binary_flipped = (binary_prev != binary_curr) + flipped_to_fg = binary_flipped & (binary_curr > 0.5) + flipped_to_bg = binary_flipped & (binary_curr < 0.5) + gt_binary_local = (gt_mask.float() > 0.5) + correct_flips = binary_flipped & ((binary_curr > 0.5) == gt_binary_local) + wrong_flips = binary_flipped & ((binary_curr > 0.5) != gt_binary_local) + total_px = max(binary_prev.numel(), 1) + step_data["mask_delta"] = { + "mean_abs_change": float(abs_delta.mean().item()), + "max_change": float(abs_delta.max().item()), + "pct_pixels_changed": float((abs_delta > 1e-6).float().mean().item() * 100.0), + "fg_gained_pct": float((delta > 1e-6).float().mean().item() * 100.0), + "fg_lost_pct": float((delta < -1e-6).float().mean().item() * 100.0), + } + step_data["binary_mask_flips"] = { + "total_flipped_pct": float(binary_flipped.float().sum().item() / total_px * 100.0), + "flipped_to_fg_pct": float(flipped_to_fg.float().sum().item() / total_px * 100.0), + "flipped_to_bg_pct": float(flipped_to_bg.float().sum().item() / total_px * 100.0), + "correct_flips_pct": float(correct_flips.float().sum().item() / total_px * 100.0), + "wrong_flips_pct": float(wrong_flips.float().sum().item() / total_px * 100.0), + "flip_accuracy": float(correct_flips.float().sum().item() / max(binary_flipped.float().sum().item(), 1.0) * 100.0), + } + if reward_map_tensor is not None: + step_data["reward_stats"] = { + "mean": float(reward_map_tensor.mean().item()), + "std": float(reward_map_tensor.std().item()), + "min": float(reward_map_tensor.min().item()), + "max": float(reward_map_tensor.max().item()), + "pct_positive": float((reward_map_tensor > 0).float().mean().item() * 100.0), + "pct_negative": float((reward_map_tensor < 0).float().mean().item() * 100.0), + "pct_zero": float((reward_map_tensor.abs() < 1e-8).float().mean().item() * 100.0), + } + if delta_map is not None and seg_prev is not None: + gt_f = gt_mask.float() + ref_pred = threshold_binary_mask(seg_prev.float()).float() + gt_fg = (gt_f > 0.5).squeeze(1) + gt_bg = ~gt_fg + pred_fg = (ref_pred > 0.5).squeeze(1) + tp_mask = pred_fg & gt_fg + tn_mask = (~pred_fg) & gt_bg + fp_mask = pred_fg & gt_bg + fn_mask = (~pred_fg) & gt_fg + delta_squeezed = delta_map.squeeze(1).detach().float() + action_breakdown: dict[str, dict[str, float]] = {} + for label, pixel_mask in [("tp", tp_mask), ("tn", tn_mask), ("fp", fp_mask), ("fn", fn_mask)]: + if pixel_mask.any(): + class_delta = delta_squeezed[pixel_mask] + action_breakdown[label] = { + "mean_delta": float(class_delta.mean().item()), + "mean_abs_delta": float(class_delta.abs().mean().item()), + "positive_pct": float((class_delta > 1e-6).float().mean().item() * 100.0), + "negative_pct": float((class_delta < -1e-6).float().mean().item() * 100.0), + } + else: + action_breakdown[label] = { + "mean_delta": 0.0, + "mean_abs_delta": 0.0, + "positive_pct": 0.0, + "negative_pct": 0.0, + } + step_data["action_on_class"] = action_breakdown + if reward_map_tensor is not None: + reward_squeezed = reward_map_tensor.squeeze(1) if reward_map_tensor.ndim == 4 else reward_map_tensor + per_class_reward: dict[str, float] = {} + for label, pixel_mask in [("tp", tp_mask), ("tn", tn_mask), ("fp", fp_mask), ("fn", fn_mask)]: + per_class_reward[label] = float(reward_squeezed[pixel_mask].mean().item()) if pixel_mask.any() else 0.0 + step_data["per_action_reward"] = per_class_reward + rollout_trace.append(step_data) + + if strategy == 2: + with autocast_ctx(enabled=use_amp, device=image.device, amp_dtype=amp_dtype): + logits = model(image) + pred = threshold_binary_mask(torch.sigmoid(logits)).float() + record_step(t=0, seg_tensor=torch.sigmoid(logits)) + return { + "final_pred": pred, + "action_distribution": batch_action_dist, + "reward_pos_pct": reward_pos_pct, + "init_fg_pct": init_fg_pct, + "first_action_distribution": first_action_dist, + "first_policy_stats": first_policy_stats, + "first_value_stats": first_value_stats, + "decoder_prob_stats": decoder_prob_stats, + "first_entropy": first_entropy, + "rollout_trace": rollout_trace, + "rollout_summary": _trajectory_degradation_summary(rollout_trace), + "selected_t": selected_t, + "effective_tmax": effective_tmax, + } + + refinement_runtime = _uses_refinement_runtime(model, strategy=strategy) + if strategy == 3 and refinement_runtime: + with autocast_ctx(enabled=use_amp, device=image.device, amp_dtype=amp_dtype): + refinement_context = model.prepare_refinement_context( + image, + sample_ids=sample_ids, + mc_mode="eval", + mc_cache_split=mc_cache_split, + mc_cache_run_dir=mc_cache_run_dir, + ) + seg = refinement_context["decoder_prob"].float() + decoder_prob_stats = _tensor_stats(refinement_context["decoder_prob"]) + init_fg_pct = float(seg.sum().item()) / max(seg.numel(), 1) * 100.0 + selected_t = 0 + + for step_idx in range(effective_tmax): + with autocast_ctx(enabled=use_amp, device=image.device, amp_dtype=amp_dtype): + state_t = model.forward_refinement_state( + refinement_context["base_features"], + seg, + refinement_context["decoder_prob"], + refinement_context["mc_variance"], + refinement_context["pred_entropy"], + encoder_features=refinement_context.get("encoder_features"), + ) + policy_logits, value_t = model.forward_from_state(state_t) + current_score = float(value_t.detach().mean().item()) + delta = _strategy3_policy_delta(policy_logits).to(dtype=seg.dtype) + + action_dist = _strategy3_delta_distribution(delta) + batch_action_dist.append(action_dist) + if step_idx == 0: + first_action_dist = action_dist + first_policy_stats = _tensor_stats(policy_logits) + first_value_stats = _tensor_stats(value_t) + first_entropy = 0.0 + record_step(t=0, seg_tensor=seg, value_score=current_score, step_entropy=first_entropy, policy_stats=first_policy_stats) + + seg_next = _strategy3_apply_delta(seg, delta) + reward_map = compute_refinement_reward(seg, seg_next, gt_mask.float()) + step_reward_pos = float((reward_map > 0).float().mean().item() * 100.0) + step_entropy_val = 0.0 + if step_idx == 0: + reward_pos_pct = step_reward_pos + record_step( + t=step_idx + 1, + seg_tensor=seg_next, + seg_prev=seg, + delta_map=delta, + action_distribution=action_dist, + reward_pos=step_reward_pos, + reward_map_tensor=reward_map, + step_entropy=step_entropy_val, + policy_stats=_tensor_stats(policy_logits), + ) + seg = seg_next + selected_t = step_idx + 1 + + pred = threshold_binary_mask(seg.float()).float() + decoder_pred = threshold_binary_mask(refinement_context["decoder_prob"].float()).float() + decoder_dice_vals, decoder_iou_vals = _batch_binary_metrics(decoder_pred, gt_mask.float()) + decoder_baseline = { + "dice": float(np.mean(decoder_dice_vals)) if decoder_dice_vals else 0.0, + "iou": float(np.mean(decoder_iou_vals)) if decoder_iou_vals else 0.0, + "fg_pct": float(decoder_pred.sum().item()) / max(decoder_pred.numel(), 1) * 100.0, + } + final_dice_vals, final_iou_vals = _batch_binary_metrics(pred, gt_mask.float()) + rl_vs_decoder = { + "decoder_dice": decoder_baseline["dice"], + "decoder_iou": decoder_baseline["iou"], + "final_dice": float(np.mean(final_dice_vals)) if final_dice_vals else 0.0, + "final_iou": float(np.mean(final_iou_vals)) if final_iou_vals else 0.0, + "dice_gain": (float(np.mean(final_dice_vals)) if final_dice_vals else 0.0) - decoder_baseline["dice"], + "iou_gain": (float(np.mean(final_iou_vals)) if final_iou_vals else 0.0) - decoder_baseline["iou"], + } + summary = _trajectory_degradation_summary(rollout_trace) + summary["selected_t"] = selected_t + return { + "final_pred": pred, + "action_distribution": batch_action_dist, + "reward_pos_pct": reward_pos_pct, + "init_fg_pct": init_fg_pct, + "first_action_distribution": first_action_dist, + "first_policy_stats": first_policy_stats, + "first_value_stats": first_value_stats, + "decoder_prob_stats": decoder_prob_stats, + "first_entropy": first_entropy, + "rollout_trace": rollout_trace, + "rollout_summary": summary, + "selected_t": selected_t, + "effective_tmax": effective_tmax, + "decoder_baseline": decoder_baseline, + "rl_vs_decoder": rl_vs_decoder, + } + + if strategy == 3: + with autocast_ctx(enabled=use_amp, device=image.device, amp_dtype=amp_dtype): + seg = threshold_binary_mask(torch.sigmoid(model.forward_decoder(image))).float() + else: + seg = torch.ones(image.shape[0], 1, image.shape[2], image.shape[3], device=image.device, dtype=image.dtype) + init_fg_pct = float(seg.sum().item()) / max(seg.numel(), 1) * 100.0 + record_step(t=0, seg_tensor=seg) + for step_idx in range(effective_tmax): + with autocast_ctx(enabled=use_amp, device=image.device, amp_dtype=amp_dtype): + masked = image * seg + policy_logits = model.forward_policy_only(masked) + actions, _, entropy = sample_actions(policy_logits, stochastic=False) + action_dist = _action_histogram(actions, int(policy_logits.shape[1])) + batch_action_dist.append({str(key): float(value) for key, value in action_dist.items()}) + if step_idx == 0: + first_action_dist = action_dist + first_policy_stats = _tensor_stats(policy_logits) + first_entropy = float(entropy.detach().item()) + seg_next = apply_actions(seg, actions, num_actions=policy_logits.shape[1]).to(dtype=seg.dtype) + reward_map = (seg - gt_mask).pow(2) - (seg_next - gt_mask).pow(2) + step_reward_pos = float((reward_map > 0).float().mean().item() * 100.0) + if step_idx == 0: + reward_pos_pct = step_reward_pos + record_step( + t=step_idx + 1, + seg_tensor=seg_next, + action_distribution=action_dist, + reward_pos=step_reward_pos, + ) + seg = seg_next + pred = seg.float() + summary = _trajectory_degradation_summary(rollout_trace) + summary["selected_t"] = len(rollout_trace) - 1 + return { + "final_pred": pred, + "action_distribution": batch_action_dist, + "reward_pos_pct": reward_pos_pct, + "init_fg_pct": init_fg_pct, + "first_action_distribution": first_action_dist, + "first_policy_stats": first_policy_stats, + "first_value_stats": first_value_stats, + "decoder_prob_stats": decoder_prob_stats, + "first_entropy": first_entropy, + "rollout_trace": rollout_trace, + "rollout_summary": summary, + "selected_t": len(rollout_trace) - 1, + "effective_tmax": effective_tmax, + } + +def _format_probe_deterioration(label: str, probe_payload: dict[str, Any], tmax: int) -> str: + effective_tmax = int(probe_payload.get("effective_tmax", tmax)) + degradation = probe_payload.get("aggregate", {}).get("degradation", {}) + if not degradation: + return f"{label}: no degradation trace" + first_worse = degradation.get("first_worse_than_initial_iou_t") + first_step_drop = degradation.get("first_worse_than_prev_iou_t") + best_t = degradation.get("best_iou_t") + final_t = degradation.get("final_t") + delta_best = degradation.get("delta_final_vs_best_iou") + worst_t = degradation.get("largest_iou_drop_t") + worst_drop = degradation.get("largest_iou_drop_from_best") + return ( + f"{label}: first_worse={first_worse}/{effective_tmax} " + f"first_drop={first_step_drop}/{effective_tmax} " + f"best={best_t}/{effective_tmax} final={final_t}/{effective_tmax} " + f"final-best_iou={float(delta_best):+.4f} " + f"worst={worst_t}/{effective_tmax} drop={float(worst_drop):+.4f}" + ) + +def _optimizer_diagnostics(optimizer: torch.optim.Optimizer) -> list[dict[str, Any]]: + groups: list[dict[str, Any]] = [] + for group_idx, group in enumerate(optimizer.param_groups): + num_tensors = len(group.get("params", [])) + num_elements = int(sum(param.numel() for param in group.get("params", []))) + groups.append( + { + "index": group_idx, + "lr": float(group.get("lr", 0.0)), + "weight_decay": float(group.get("weight_decay", 0.0)), + "num_tensors": num_tensors, + "num_elements": num_elements, + } + ) + return groups + +def _probe_batches_from_indices( + dataset: BUSIDataset, + *, + indices: list[int], + device: torch.device, +) -> list[dict[str, Any]]: + batches: list[dict[str, Any]] = [] + for start in range(0, len(indices), BATCH_SIZE): + batch_indices = indices[start:start + BATCH_SIZE] + if not batch_indices: + continue + images = torch.stack([dataset._images[idx].clone() for idx in batch_indices], dim=0) + masks = torch.stack([dataset._masks[idx].clone() for idx in batch_indices], dim=0) + sample_ids = [Path(dataset.sample_records[idx]["filename"]).stem for idx in batch_indices] + batches.append( + to_device( + { + "image": images, + "mask": masks, + "sample_id": sample_ids, + "dataset": current_dataset_name(), + }, + device, + ) + ) + return batches + +def _fixed_probe_batches_from_dataset( + dataset: BUSIDataset, + *, + num_batches: int, + device: torch.device, +) -> list[dict[str, Any]]: + max_samples = min(len(dataset), max(int(num_batches), 0) * BATCH_SIZE) + return _probe_batches_from_indices( + dataset, + indices=list(range(max_samples)), + device=device, + ) + +def _rolling_probe_batches_from_dataset( + dataset: BUSIDataset, + *, + num_batches: int, + device: torch.device, + epoch: int, + split_tag: str, +) -> list[dict[str, Any]]: + max_samples = min(len(dataset), max(int(num_batches), 0) * BATCH_SIZE) + if max_samples <= 0: + return [] + if max_samples >= len(dataset): + indices = list(range(len(dataset))) + else: + rng = random.Random(SEED + stable_int_from_text(f"probe:{split_tag}:epoch:{int(epoch)}")) + indices = rng.sample(range(len(dataset)), k=max_samples) + return _probe_batches_from_indices(dataset, indices=indices, device=device) + +def _probe_batch_id_lists(fixed_batches: list[dict[str, Any]]) -> list[list[str]]: + return [list(batch.get("sample_id", [])) for batch in fixed_batches] + +def _reference_eval_payloads(project_dir: Path, percent: float) -> dict[str, Any]: + refs: dict[str, Any] = {} + pct = percent_label(percent) + strat2_dir = project_dir / "strat2_history" + strat3_dir = project_dir / "strat3_history_best" + strat2_candidates = [ + strat2_dir / f"evaluation_strat2_pc{pct}.json", + strat2_dir / f"evaluation_strat2_pct{pct}.json", + ] + strat3_candidate = strat3_dir / f"evaluation_{pct} (1)" + for candidate in strat2_candidates: + if candidate.exists(): + refs["strategy2_reference"] = load_json(candidate) + break + if strat3_candidate.exists(): + refs["strategy3_best_reference"] = load_json(strat3_candidate) + return refs + +def empty_epoch_diagnostic_payload( + *, + run_type: str, + run_config: dict[str, Any], + bundle: DataBundle, + train_probe_batches: list[dict[str, Any]], + val_probe_batches: list[dict[str, Any]], +) -> dict[str, Any]: + payload = { + "diagnostic_version": 1, + "run_type": run_type, + "strategy": int(run_config["strategy"]), + "dataset_percent": float(bundle.percent), + "run_config": run_config, + "probe_setup": { + "mode": str(run_config.get("epoch_probe_mode", "fixed")), + "train_probe_batches": _probe_batch_id_lists(train_probe_batches), + "val_probe_batches": _probe_batch_id_lists(val_probe_batches), + "train_probe_batch_count": len(train_probe_batches), + "val_probe_batch_count": len(val_probe_batches), + "tmax": int(run_config.get("tmax", DEFAULT_TMAX)), + }, + "epochs": [], + } + payload.update(_reference_eval_payloads(PROJECT_DIR, bundle.percent)) + return payload + +def load_epoch_diagnostic_for_resume( + path: Path, + checkpoint_payload: dict[str, Any] | None, + default_payload: dict[str, Any], +) -> dict[str, Any]: + payload = dict(default_payload) + checkpoint_epoch = int(checkpoint_payload.get("epoch", 0)) if checkpoint_payload is not None else 0 + if path.exists(): + loaded = load_json(path) + if isinstance(loaded, dict): + payload.update({k: v for k, v in loaded.items() if k != "epochs"}) + epochs = loaded.get("epochs", []) + if isinstance(epochs, list): + payload["epochs"] = [dict(row) for row in epochs if isinstance(row, dict) and int(row.get("epoch", 0)) <= checkpoint_epoch] + if "epochs" not in payload: + payload["epochs"] = [] + return payload + +def _evaluate_probe_batches( + model: nn.Module, + fixed_batches: list[dict[str, Any]], + *, + strategy: int, + tmax: int, + use_amp: bool, + amp_dtype: torch.dtype, + use_channels_last: bool, + mc_cache_split: Literal["train", "val", "test"] | None = None, + mc_cache_run_dir: Path | None = None, +) -> dict[str, Any]: + if not fixed_batches: + return {"n_batches": 0, "batch_details": [], "aggregate": {}, "alerts": []} + + effective_tmax = _resolve_test_iteration_tmax(tmax, context="_evaluate_probe_batches") if strategy != 2 else max(int(tmax), 1) + was_training = model.training + batch_details: list[dict[str, Any]] = [] + alerts: list[str] = [] + action_distributions: list[list[dict[str, float]]] = [] + rollout_traces: list[list[dict[str, Any]]] = [] + metric_lists: dict[str, list[float]] = { + key: [] + for key in ("dice", "ppv", "sen", "iou", "biou", "biou_contour", "hd95") + } + reward_pos_values: list[float] = [] + pred_fg_values: list[float] = [] + gt_fg_values: list[float] = [] + init_fg_values: list[float] = [] + decoder_dices: list[float] = [] + decoder_ious: list[float] = [] + iou_gains: list[float] = [] + dice_gains: list[float] = [] + + model.eval() + try: + if strategy == 3 and _uses_refinement_runtime(model, strategy=strategy) and mc_cache_split != "train": + _strategy3_bump_mc_cache_fingerprint(model) + _strategy3_reset_mc_cache_stats(model) + with torch.inference_mode(): + for batch_index, batch in enumerate(fixed_batches): + image = batch["image"] + gt_mask = batch["mask"].float() + sample_ids = [str(item) for item in batch["sample_id"]] if "sample_id" in batch else None + if use_channels_last and image.ndim == 4 and image.device.type == "cuda": + image = image.contiguous(memory_format=torch.channels_last) + if use_amp and image.device.type == "cuda": + image = image.to(dtype=amp_dtype) + + rollout_probe = _rollout_probe_trace( + model, + image, + gt_mask, + strategy=strategy, + tmax=tmax, + use_amp=use_amp, + amp_dtype=amp_dtype, + use_channels_last=use_channels_last, + sample_ids=sample_ids, + mc_cache_split=mc_cache_split, + mc_cache_run_dir=mc_cache_run_dir, + ) + pred = rollout_probe["final_pred"].float() + batch_action_dist = rollout_probe["action_distribution"] + reward_pos_pct = float(rollout_probe["reward_pos_pct"]) + init_fg_pct = float(rollout_probe["init_fg_pct"]) + first_action_dist = rollout_probe["first_action_distribution"] + first_policy_stats = rollout_probe["first_policy_stats"] + first_value_stats = rollout_probe["first_value_stats"] + decoder_prob_stats = rollout_probe["decoder_prob_stats"] + first_entropy = rollout_probe["first_entropy"] + rollout_trace = rollout_probe["rollout_trace"] + rollout_summary = rollout_probe["rollout_summary"] + + if batch_action_dist: + action_distributions.append(batch_action_dist) + if rollout_trace: + rollout_traces.append(rollout_trace) + + pred_fg_pct = float(pred.sum().item()) / max(pred.numel(), 1) * 100.0 + gt_fg_pct = float(gt_mask.sum().item()) / max(gt_mask.numel(), 1) * 100.0 + reward_pos_values.append(reward_pos_pct) + pred_fg_values.append(pred_fg_pct) + gt_fg_values.append(gt_fg_pct) + init_fg_values.append(init_fg_pct) + rl_vs_dec = rollout_probe.get("rl_vs_decoder") + if rl_vs_dec: + decoder_dices.append(rl_vs_dec["decoder_dice"]) + decoder_ious.append(rl_vs_dec["decoder_iou"]) + iou_gains.append(rl_vs_dec["iou_gain"]) + dice_gains.append(rl_vs_dec["dice_gain"]) + + batch_alerts = _numerical_health_check( + { + "pred": pred, + "gt_mask": gt_mask, + "pred_fg_pct": pred_fg_pct, + "gt_fg_pct": gt_fg_pct, + "reward_pos_pct": reward_pos_pct, + "first_entropy": first_entropy if first_entropy is not None else 0.0, + }, + prefix=f"probe[{batch_index}]:", + ) + alerts.extend(batch_alerts) + + pred_np = pred.detach().cpu().numpy().astype(np.uint8) + gt_np = gt_mask.detach().cpu().numpy().astype(np.uint8) + per_sample: list[dict[str, Any]] = [] + for sample_index in range(pred_np.shape[0]): + metrics = compute_all_metrics(pred_np[sample_index], gt_np[sample_index]) + per_sample.append( + { + "sample_id": sample_ids[sample_index] if sample_index < len(sample_ids) else f"sample_{sample_index}", + **{key: float(value) for key, value in metrics.items()}, + } + ) + for key, value in metrics.items(): + metric_lists.setdefault(key, []).append(float(value)) + + batch_details.append( + { + "batch_index": batch_index, + "sample_ids": sample_ids, + "pred_fg_pct": pred_fg_pct, + "gt_fg_pct": gt_fg_pct, + "init_fg_pct": init_fg_pct, + "reward_pos_pct": reward_pos_pct, + "action_distribution": _jsonable_action_distribution(batch_action_dist), + "first_action_distribution": first_action_dist, + "first_entropy": first_entropy, + "decoder_prob_stats": decoder_prob_stats, + "first_policy_stats": first_policy_stats, + "first_value_stats": first_value_stats, + "pred_stats": _tensor_stats(pred), + "rollout_trace": rollout_trace, + "rollout_summary": rollout_summary, + "decoder_baseline": rollout_probe.get("decoder_baseline"), + "rl_vs_decoder": rollout_probe.get("rl_vs_decoder"), + "alerts": batch_alerts, + "per_sample": per_sample, + } + ) + finally: + model.train(was_training) + if strategy == 3 and _uses_refinement_runtime(model, strategy=strategy) and mc_cache_split != "train": + mc_cache_stats = _strategy3_get_mc_cache_stats(model) + print( + "[Strategy3 MC Cache] " + f"ram_hits={mc_cache_stats['ram_hits']} " + f"disk_hits={mc_cache_stats['disk_hits']} " + f"misses={mc_cache_stats['misses']} " + f"writes={mc_cache_stats['writes']}" + ) + + aggregate_trace = _average_rollout_traces(rollout_traces) + rl_vs_decoder_aggregate: dict[str, Any] = {} + if decoder_dices: + rl_vs_decoder_aggregate = { + "decoder_dice": _summary_stats(decoder_dices), + "decoder_iou": _summary_stats(decoder_ious), + "iou_gain": _summary_stats(iou_gains), + "dice_gain": _summary_stats(dice_gains), + } + return { + "n_batches": len(fixed_batches), + "batch_details": batch_details, + "aggregate": { + "metrics": {key: _summary_stats(values) for key, values in metric_lists.items()}, + "reward_pos_pct": _summary_stats(reward_pos_values), + "pred_fg_pct": _summary_stats(pred_fg_values), + "gt_fg_pct": _summary_stats(gt_fg_values), + "init_fg_pct": _summary_stats(init_fg_values), + "action_distribution": _average_action_distributions(action_distributions, effective_tmax), + "rollout_trace": aggregate_trace, + "degradation": _trajectory_degradation_summary(aggregate_trace), + "rl_vs_decoder": rl_vs_decoder_aggregate, + }, + "alerts": alerts, + "effective_tmax": effective_tmax, + } + +def run_overfit_test( + *, + strategy: int, + model_config: RuntimeModelConfig, + bundle: DataBundle, + overfit_root: Path, + strategy2_checkpoint_path: str | Path | None = None, +) -> dict[str, Any]: + amp_dtype = resolve_amp_dtype(AMP_DTYPE) + use_amp = amp_autocast_enabled(DEVICE) + use_channels_last = _use_channels_last_for_run(model_config) + overfit_root = ensure_dir(overfit_root) + ckpt_dir = ensure_dir(overfit_root / "checkpoints") + history_path = checkpoint_history_path(overfit_root, "overfit") + run_config = { + "project_dir": str(PROJECT_DIR), + "data_root": str(DATA_ROOT), + "run_type": "overfit", + "strategy": strategy, + "dataset_percent": bundle.percent, + "dataset_name": bundle.split_payload["dataset_name"], + "dataset_split_policy": bundle.split_payload["dataset_split_policy"], + "dataset_splits_path": bundle.split_payload["dataset_splits_path"], + "split_type": bundle.split_payload["split_type"], + "train_subset_key": bundle.split_payload["train_subset_key"], + "max_epochs": OVERFIT_N_EPOCHS, + "head_lr": OVERFIT_HEAD_LR, + "encoder_lr": OVERFIT_ENCODER_LR, + "weight_decay": DEFAULT_WEIGHT_DECAY, + "dropout_p": DEFAULT_DROPOUT_P, + "tmax": DEFAULT_TMAX, + "entropy_lr": DEFAULT_ENTROPY_LR, + "gamma": DEFAULT_GAMMA, + "grad_clip_norm": DEFAULT_GRAD_CLIP_NORM, + "train_resume_mode": TRAIN_RESUME_MODE, + "train_resume_specific_checkpoint": TRAIN_RESUME_SPECIFIC_CHECKPOINT, + } + if strategy == 3: + run_config.setdefault( + "strategy3_freeze_bootstrapped_segmentation", + DEFAULT_STRATEGY3_FREEZE_BOOTSTRAPPED_SEGMENTATION, + ) + bootstrap_freeze = ( + strategy2_checkpoint_path is not None + and bool(run_config["strategy3_freeze_bootstrapped_segmentation"]) + ) + run_config.setdefault("strategy3_variant", DEFAULT_STRATEGY3_VARIANT) + run_config.setdefault("decoder_lr", 0.0 if bootstrap_freeze else OVERFIT_HEAD_LR * 0.1) + run_config.setdefault("rl_lr", OVERFIT_HEAD_LR) + run_config.setdefault("strategy3_decoder_ce_weight", 0.0 if bootstrap_freeze else DEFAULT_CE_WEIGHT) + run_config.setdefault("strategy3_decoder_dice_weight", 0.0 if bootstrap_freeze else DEFAULT_DICE_WEIGHT) + run_config.setdefault("strategy3_delta_max", DEFAULT_STRATEGY3_DELTA_MAX) + run_config.setdefault("strategy3_sam_attention_grid", DEFAULT_STRATEGY3_SAM_ATTENTION_GRID) + run_config.setdefault("strategy3_r1_progress_weight", DEFAULT_STRATEGY3_R1_PROGRESS_WEIGHT) + run_config.setdefault("biou_reward_weight", DEFAULT_BIOU_REWARD_WEIGHT) + run_config.setdefault("strategy3_advantage_normalize", DEFAULT_STRATEGY3_ADVANTAGE_NORMALIZE) + run_config.setdefault("strategy3_rl_loss_scale", DEFAULT_STRATEGY3_RL_LOSS_SCALE) + run_config.setdefault("elastic_aug_prob", 0.3) + run_config.setdefault("strategy3_rl_grad_clip_norm", DEFAULT_STRATEGY3_RL_GRAD_CLIP_NORM) + run_config.setdefault("strategy3_aux_ce_weight", DEFAULT_STRATEGY3_AUX_CE_WEIGHT) + run_config.setdefault("strategy3_aux_ce_anneal_start_epoch", DEFAULT_STRATEGY3_AUX_CE_ANNEAL_START_EPOCH) + run_config.setdefault("strategy3_aux_ce_anneal_epochs", DEFAULT_STRATEGY3_AUX_CE_ANNEAL_EPOCHS) + run_config.setdefault("strategy3_aux_ce_floor_fraction", DEFAULT_STRATEGY3_AUX_CE_FLOOR_FRACTION) + run_config.setdefault("epoch_probe_mode", DEFAULT_STRATEGY3_PROBE_MODE) + run_config.setdefault("early_stopping_monitor", DEFAULT_EARLY_STOPPING_MONITOR) + run_config.setdefault("early_stopping_mode", DEFAULT_EARLY_STOPPING_MODE) + run_config.setdefault("early_stopping_min_delta", DEFAULT_EARLY_STOPPING_MIN_DELTA) + run_config.setdefault("early_stopping_start_epoch", DEFAULT_EARLY_STOPPING_START_EPOCH) + run_config.setdefault("early_stopping_patience", DEFAULT_STRATEGY3_EARLY_STOPPING_PATIENCE) + run_config.update(model_config.to_payload()) + if strategy2_checkpoint_path is not None: + run_config["strategy2_checkpoint_path"] = str(Path(strategy2_checkpoint_path)) + save_json(overfit_root / "run_config.json", run_config) + set_current_job_params(run_config) + + banner( + f"OVERFIT TEST | {run_identity_label(strategy=strategy, percent=bundle.percent, split_payload=bundle.split_payload)}" + ) + effective_test_tmax = _resolve_test_iteration_tmax(DEFAULT_TMAX, context="run_overfit_test") if strategy != 2 else max(int(DEFAULT_TMAX), 1) + print( + f"[Overfit] Fixed batches={OVERFIT_N_BATCHES}, epochs={OVERFIT_N_EPOCHS}, " + f"head_lr={OVERFIT_HEAD_LR:.2e}, encoder_lr={OVERFIT_ENCODER_LR:.2e}" + ) + + fixed_batches: list[dict[str, Any]] = [] + for batch_index, batch in enumerate(bundle.train_loader): + fixed_batches.append(to_device(batch, DEVICE)) + if batch_index + 1 >= OVERFIT_N_BATCHES: + break + if not fixed_batches: + raise RuntimeError("Overfit test could not collect any training batches.") + if len(fixed_batches) < OVERFIT_N_BATCHES: + print(f"[Overfit] Warning: only {len(fixed_batches)} train batch(es) available.") + + model, description, compiled = build_model( + strategy, + DEFAULT_DROPOUT_P, + model_config=model_config, + strategy2_checkpoint_path=strategy2_checkpoint_path, + ) + resume_checkpoint_path = resolve_train_resume_checkpoint_path(overfit_root) + if resume_checkpoint_path is not None and strategy == 3: + _configure_model_from_checkpoint_path(model, resume_checkpoint_path) + print_model_parameter_summary( + model=model, + description=f"{description} | Overfit Test", + strategy=strategy, + model_config=model_config, + dropout_p=DEFAULT_DROPOUT_P, + amp_dtype=amp_dtype, + compiled=compiled, + ) + + optimizer = make_optimizer( + model, + strategy, + head_lr=OVERFIT_HEAD_LR, + encoder_lr=OVERFIT_ENCODER_LR, + weight_decay=DEFAULT_WEIGHT_DECAY, + ) + scaler = make_grad_scaler(enabled=use_amp, amp_dtype=amp_dtype, device=DEVICE) + log_alpha: torch.Tensor | None = None + alpha_optimizer: Adam | None = None + target_entropy = 0.0 + + history = empty_overfit_history() + prev_loss: float | None = None + best_dice = -1.0 + elapsed_before_resume = 0.0 + start_epoch = 1 + resume_source: dict[str, Any] | None = None + if resume_checkpoint_path is not None: + checkpoint_payload = load_checkpoint( + resume_checkpoint_path, + model=model, + optimizer=optimizer, + scheduler=None, + scaler=scaler, + device=DEVICE, + log_alpha=log_alpha, + alpha_optimizer=alpha_optimizer, + expected_run_type="overfit", + require_run_metadata=True, + ) + validate_resume_checkpoint_identity( + run_config, + checkpoint_run_config_payload(checkpoint_payload), + checkpoint_path=resume_checkpoint_path, + ) + start_epoch = int(checkpoint_payload["epoch"]) + 1 + best_dice = float(checkpoint_payload["best_metric_value"]) + elapsed_before_resume = float(checkpoint_payload.get("elapsed_seconds", 0.0)) + history = load_overfit_history_for_resume(history_path, checkpoint_payload) + resume_source = { + "checkpoint_path": str(Path(resume_checkpoint_path).resolve()), + "checkpoint_epoch": int(checkpoint_payload["epoch"]), + "checkpoint_run_type": checkpoint_payload.get("run_type", "overfit"), + } + print( + f"[Resume] overfit run continuing from {resume_checkpoint_path} " + f"at epoch {start_epoch}/{OVERFIT_N_EPOCHS}." + ) + if history["loss"]: + prev_loss = float(history["loss"][-1]) + prev_params = _snapshot_params(model) + start_time = time.time() + + for epoch in range(start_epoch, OVERFIT_N_EPOCHS + 1): + full_dump = epoch <= 5 or epoch % max(OVERFIT_PRINT_EVERY, 1) == 0 or epoch == OVERFIT_N_EPOCHS + epoch_losses: list[float] = [] + epoch_dices: list[float] = [] + epoch_ious: list[float] = [] + epoch_rewards: list[float] = [] + epoch_actor: list[float] = [] + epoch_critic: list[float] = [] + epoch_ce: list[float] = [] + epoch_dice_losses: list[float] = [] + epoch_entropy: list[float] = [] + epoch_grad_norms: list[float] = [] + epoch_action_dist: list[list[dict[str, float]]] = [] + epoch_reward_pos_pct: list[float] = [] + epoch_pred_fg_pct: list[float] = [] + epoch_gt_fg_pct: list[float] = [] + epoch_alerts: list[str] = [] + + for batch in fixed_batches: + if strategy == 2: + metrics = train_step_supervised( + model, + batch, + optimizer, + scaler=scaler, + use_amp=use_amp, + amp_dtype=amp_dtype, + use_channels_last=use_channels_last, + grad_clip_norm=DEFAULT_GRAD_CLIP_NORM, + ce_weight=DEFAULT_CE_WEIGHT, + dice_weight=DEFAULT_DICE_WEIGHT, + ) + else: + metrics = train_step_strategy3( + model, + batch, + optimizer, + gamma=DEFAULT_GAMMA, + tmax=DEFAULT_TMAX, + critic_loss_weight=DEFAULT_CRITIC_LOSS_WEIGHT, + log_alpha=log_alpha, + alpha_optimizer=alpha_optimizer, + target_entropy=target_entropy, + ce_weight=DEFAULT_CE_WEIGHT, + dice_weight=DEFAULT_DICE_WEIGHT, + grad_clip_norm=DEFAULT_GRAD_CLIP_NORM, + scaler=scaler, + use_amp=use_amp, + amp_dtype=amp_dtype, + stepwise_backward=STEPWISE_BACKWARD, + use_channels_last=use_channels_last, + current_epoch=epoch, + max_epochs=OVERFIT_N_EPOCHS, + ) + + epoch_losses.append(float(metrics["loss"])) + epoch_rewards.append(float(metrics["mean_reward"])) + epoch_actor.append(float(metrics["actor_loss"])) + epoch_critic.append(float(metrics["critic_loss"])) + epoch_ce.append(float(metrics["ce_loss"])) + epoch_dice_losses.append(float(metrics["dice_loss"])) + epoch_entropy.append(float(metrics["entropy"])) + epoch_grad_norms.append(float(metrics["grad_norm"])) + epoch_alerts.extend( + _numerical_health_check( + { + "loss": metrics["loss"], + "actor_loss": metrics["actor_loss"], + "critic_loss": metrics["critic_loss"], + "reward": metrics["mean_reward"], + "entropy": metrics["entropy"], + "grad_norm": metrics["grad_norm"], + "ce_loss": metrics["ce_loss"], + "dice_loss": metrics["dice_loss"], + }, + prefix="train:", + ) + ) + + model.eval() + with torch.inference_mode(): + image = batch["image"] + gt_mask = batch["mask"].float() + sample_ids = [str(item) for item in batch["sample_id"]] if "sample_id" in batch else None + if use_channels_last and image.ndim == 4 and image.device.type == "cuda": + image = image.contiguous(memory_format=torch.channels_last) + if use_amp and DEVICE.type == "cuda": + image = image.to(dtype=amp_dtype) + + if strategy == 2: + with autocast_ctx(enabled=use_amp, device=image.device, amp_dtype=amp_dtype): + logits = model(image) + pred = threshold_binary_mask(torch.sigmoid(logits)).float() + else: + refinement_runtime = _uses_refinement_runtime(model, strategy=strategy) + if strategy == 3 and refinement_runtime: + with autocast_ctx(enabled=use_amp, device=image.device, amp_dtype=amp_dtype): + init_mask = model.prepare_refinement_context( + image, + sample_ids=sample_ids, + mc_mode="eval", + mc_cache_split="train", + mc_cache_run_dir=overfit_root, + )["decoder_prob"].float() + else: + init_mask = torch.ones( + image.shape[0], + 1, + image.shape[2], + image.shape[3], + device=image.device, + dtype=image.dtype, + ) + if strategy == 3: + with autocast_ctx(enabled=use_amp, device=image.device, amp_dtype=amp_dtype): + init_mask = threshold_binary_mask(torch.sigmoid(model.forward_decoder(image))).float() + action_dist, pred = _action_distribution( + model, + image, + init_mask, + effective_test_tmax, + use_amp, + amp_dtype, + strategy=strategy, + sample_ids=sample_ids, + mc_cache_split="train", + mc_cache_run_dir=overfit_root, + ) + epoch_action_dist.append(action_dist) + + if strategy == 3 and refinement_runtime: + with autocast_ctx(enabled=use_amp, device=image.device, amp_dtype=amp_dtype): + refinement_context = model.prepare_refinement_context( + image, + sample_ids=sample_ids, + mc_mode="eval", + mc_cache_split="train", + mc_cache_run_dir=overfit_root, + ) + soft_init_mask = refinement_context["decoder_prob"].float() + state_t = model.forward_refinement_state( + refinement_context["base_features"], + soft_init_mask, + refinement_context["decoder_prob"], + refinement_context["mc_variance"], + refinement_context["pred_entropy"], + encoder_features=refinement_context.get("encoder_features"), + ) + policy_logits, _ = model.forward_from_state(state_t) + first_delta = _strategy3_policy_delta(policy_logits).to(dtype=soft_init_mask.dtype) + first_seg = _strategy3_apply_delta(soft_init_mask, first_delta) + reward_map = compute_refinement_reward( + soft_init_mask, first_seg, gt_mask.float(), + ) + else: + with autocast_ctx(enabled=use_amp, device=image.device, amp_dtype=amp_dtype): + masked = image * init_mask + policy_logits = model.forward_policy_only(masked) + first_actions, _, _ = sample_actions(policy_logits, stochastic=False) + first_seg = apply_actions(init_mask, first_actions, num_actions=policy_logits.shape[1]) + reward_map = (init_mask - gt_mask).pow(2) - (first_seg - gt_mask).pow(2) + epoch_reward_pos_pct.append(float((reward_map > 0).float().mean().item() * 100.0)) + + pred_fg_pct = float(pred.sum().item()) / max(pred.numel(), 1) * 100.0 + gt_fg_pct = float(gt_mask.sum().item()) / max(gt_mask.numel(), 1) * 100.0 + epoch_pred_fg_pct.append(pred_fg_pct) + epoch_gt_fg_pct.append(gt_fg_pct) + dice_values, iou_values = _batch_binary_metrics(pred.float(), gt_mask.float()) + epoch_dices.extend(dice_values) + epoch_ious.extend(iou_values) + epoch_alerts.extend( + _numerical_health_check( + {"pred": pred, "gt_mask": gt_mask}, + prefix="eval:", + ) + ) + model.train() + + grad_stats = _grad_diagnostics(model) + param_stats = _param_diagnostics(model, prev_params) + prev_params = _snapshot_params(model) + + avg_loss = float(np.mean(epoch_losses)) if epoch_losses else 0.0 + avg_dice = float(np.mean(epoch_dices)) if epoch_dices else 0.0 + avg_iou = float(np.mean(epoch_ious)) if epoch_ious else 0.0 + avg_reward = float(np.mean(epoch_rewards)) if epoch_rewards else 0.0 + avg_actor = float(np.mean(epoch_actor)) if epoch_actor else 0.0 + avg_critic = float(np.mean(epoch_critic)) if epoch_critic else 0.0 + avg_ce = float(np.mean(epoch_ce)) if epoch_ce else 0.0 + avg_dice_loss = float(np.mean(epoch_dice_losses)) if epoch_dice_losses else 0.0 + avg_entropy = float(np.mean(epoch_entropy)) if epoch_entropy else 0.0 + avg_grad_norm = float(np.mean(epoch_grad_norms)) if epoch_grad_norms else 0.0 + avg_reward_pos = float(np.mean(epoch_reward_pos_pct)) if epoch_reward_pos_pct else 0.0 + avg_pred_fg = float(np.mean(epoch_pred_fg_pct)) if epoch_pred_fg_pct else 0.0 + avg_gt_fg = float(np.mean(epoch_gt_fg_pct)) if epoch_gt_fg_pct else 0.0 + + avg_action_dist = _average_action_distributions(epoch_action_dist, effective_test_tmax) + + history["dice"].append(avg_dice) + history["iou"].append(avg_iou) + history["loss"].append(avg_loss) + history["reward"].append(avg_reward) + history["actor_loss"].append(avg_actor) + history["critic_loss"].append(avg_critic) + history["ce_loss"].append(avg_ce) + history["dice_loss"].append(avg_dice_loss) + history["entropy"].append(avg_entropy) + history["grad_norm"].append(avg_grad_norm) + history["action_dist"].append(avg_action_dist) + history["reward_pos_pct"].append(avg_reward_pos) + history["pred_fg_pct"].append(avg_pred_fg) + history["gt_fg_pct"].append(avg_gt_fg) + save_json(history_path, history) + + loss_delta = avg_loss - prev_loss if prev_loss is not None else 0.0 + prev_loss = avg_loss + if epoch_alerts: + print(f"[Overfit][Epoch {epoch}] Numerical alerts: {' | '.join(epoch_alerts)}") + + if full_dump: + current_alpha = float(log_alpha.exp().detach().item()) if log_alpha is not None else 0.0 + print( + f"[Overfit][Epoch {epoch:03d}] loss={avg_loss:.6f} (delta={loss_delta:+.6f}) " + f"dice={avg_dice:.4f} iou={avg_iou:.4f} reward={avg_reward:+.6f} " + f"entropy={avg_entropy:.6f} alpha={current_alpha:.4f}" + ) + print( + f"[Overfit][Epoch {epoch:03d}] ce={avg_ce:.6f} dice_l={avg_dice_loss:.6f} " + f"grad_norm={avg_grad_norm:.6f} global_grad={grad_stats['global_norm']:.6f}" + ) + if avg_action_dist: + first = avg_action_dist[0] + last = avg_action_dist[-1] + print( + f"[Overfit][Epoch {epoch:03d}] action step0={first} step_last={last} " + f"reward_pos={avg_reward_pos:.2f}%" + ) + print( + f"[Overfit][Epoch {epoch:03d}] pred_fg={avg_pred_fg:.2f}% gt_fg={avg_gt_fg:.2f}% " + f"param_groups={list(param_stats.keys())}" + ) + else: + print( + f"[Overfit][Epoch {epoch:03d}] loss={avg_loss:.6f} dice={avg_dice:.4f} " + f"iou={avg_iou:.4f} reward={avg_reward:+.6f}" + ) + + row = { + "epoch": epoch, + "dice": avg_dice, + "iou": avg_iou, + "loss": avg_loss, + "reward": avg_reward, + "actor_loss": avg_actor, + "critic_loss": avg_critic, + "ce_loss": avg_ce, + "dice_loss": avg_dice_loss, + "entropy": avg_entropy, + "grad_norm": avg_grad_norm, + "action_dist": avg_action_dist, + "reward_pos_pct": avg_reward_pos, + "pred_fg_pct": avg_pred_fg, + "gt_fg_pct": avg_gt_fg, + } + if avg_dice > best_dice: + best_dice = avg_dice + save_checkpoint( + ckpt_dir / "best.pt", + run_type="overfit", + model=model, + optimizer=optimizer, + scheduler=None, + scaler=scaler, + epoch=epoch, + best_metric_value=best_dice, + best_metric_name="overfit_dice", + run_config=run_config, + epoch_metrics=row, + patience_counter=0, + elapsed_seconds=elapsed_before_resume + (time.time() - start_time), + log_alpha=log_alpha, + alpha_optimizer=alpha_optimizer, + resume_source=resume_source, + ) + + if SAVE_LATEST_EVERY_EPOCH: + save_checkpoint( + ckpt_dir / "latest.pt", + run_type="overfit", + model=model, + optimizer=optimizer, + scheduler=None, + scaler=scaler, + epoch=epoch, + best_metric_value=best_dice, + best_metric_name="overfit_dice", + run_config=run_config, + epoch_metrics=row, + patience_counter=0, + elapsed_seconds=elapsed_before_resume + (time.time() - start_time), + log_alpha=log_alpha, + alpha_optimizer=alpha_optimizer, + resume_source=resume_source, + ) + if CHECKPOINT_EVERY_N_EPOCHS > 0 and epoch % CHECKPOINT_EVERY_N_EPOCHS == 0: + save_checkpoint( + ckpt_dir / f"epoch_{epoch:04d}.pt", + run_type="overfit", + model=model, + optimizer=optimizer, + scheduler=None, + scaler=scaler, + epoch=epoch, + best_metric_value=best_dice, + best_metric_name="overfit_dice", + run_config=run_config, + epoch_metrics=row, + patience_counter=0, + elapsed_seconds=elapsed_before_resume + (time.time() - start_time), + log_alpha=log_alpha, + alpha_optimizer=alpha_optimizer, + resume_source=resume_source, + ) + + peak_dice = max(history["dice"]) if history["dice"] else 0.0 + final_dice = history["dice"][-1] if history["dice"] else 0.0 + summary = { + "run_type": "overfit", + "strategy": strategy, + "peak_dice": peak_dice, + "final_dice": final_dice, + "description": description, + "resumed": resume_source is not None, + "elapsed_seconds": elapsed_before_resume + (time.time() - start_time), + "final_epoch": max(len(history["dice"]), start_epoch - 1), + } + if resume_source is not None: + summary["resume_source"] = resume_source + save_json(overfit_root / "summary.json", summary) + print( + f"[Overfit] {run_identity_label(strategy=strategy, percent=bundle.percent, split_payload=bundle.split_payload)} | " + f"peak_dice={peak_dice:.4f}, final_dice={final_dice:.4f}" + ) + + del model + run_cuda_cleanup( + context=f"overfit {run_identity_label(strategy=strategy, percent=bundle.percent, split_payload=bundle.split_payload)}" + ) + return {**summary, "history": history} + +def run_configured_overfit_tests( + bundles: dict[float, DataBundle], + *, + model_config: RuntimeModelConfig, +) -> None: + banner("OVERFIT TEST MODE") + for percent in DATASET_PERCENTS: + bundle = bundles[percent] + for strategy in STRATEGIES: + strategy2_checkpoint_path = None + if strategy == 3 and STRATEGY3_BOOTSTRAP_FROM_STRATEGY2: + strategy2_checkpoint_path = resolve_strategy2_checkpoint_path(strategy, percent, model_config) + run_overfit_test( + strategy=strategy, + model_config=model_config, + bundle=bundle, + overfit_root=strategy_root_for_percent(strategy, percent, model_config) / "overfit_test", + strategy2_checkpoint_path=strategy2_checkpoint_path, + ) + +"""============================================================================= +OPTUNA + ORCHESTRATION +============================================================================= +""" + +def strategy_epochs(strategy: int) -> int: + strategy = _require_supported_strategy(strategy) + if strategy == 2: + return STRATEGY_2_MAX_EPOCHS + if strategy == 3: + return STRATEGY_3_MAX_EPOCHS + raise ValueError(f"Unsupported strategy for epoch selection: {strategy}") + +def suggest_hyperparameters(trial: optuna.trial.Trial, strategy: int) -> dict[str, Any]: + # ------------------------------------------------------------------ + # SLIMMED search space (simplified "lite" model: no critic, no SAM, R1 off). + # Only the params that actually move the metric are tuned; dead knobs + # (critic_loss_weight, sam_attention_grid, r1_progress_weight, + # advantage_normalize) are pinned to inert values instead of searched. + # Ranges are set for the TransUNet (pretrained ViT+ResNet50) backbone. + # ------------------------------------------------------------------ + strategy = _require_supported_strategy(strategy) + if strategy == 3: + # --- TUNED: the 6 high-impact refinement knobs --- + rl_lr = trial.suggest_float("rl_lr", 1e-5, 5e-4, log=True) + return { + "head_lr": rl_lr, + "encoder_lr": 0.0, + "decoder_lr": 0.0, + "strategy3_decoder_ce_weight": 0.0, + "strategy3_decoder_dice_weight": 0.0, + "strategy3_freeze_bootstrapped_segmentation": True, + "strategy3_variant": DEFAULT_STRATEGY3_VARIANT, + "rl_lr": rl_lr, + "strategy3_delta_max": trial.suggest_float("strategy3_delta_max", 0.05, 0.30), + "biou_reward_weight": trial.suggest_float("biou_reward_weight", 0.5, 2.0), + "strategy3_aux_ce_weight": trial.suggest_float("strategy3_aux_ce_weight", 0.2, 1.0), + "tmax": trial.suggest_int("tmax", 3, 8), + "threshold": trial.suggest_float("threshold", 0.40, 0.60), + # --- FIXED: inert in the lite model (removed from the search) --- + "critic_loss_weight": 0.0, # lite model has no critic head + "strategy3_r1_progress_weight": 0.0, # R1 progress reward disabled + "strategy3_advantage_normalize": False, + "smp_encoder_proj_dim": 256, + "dropout_p": 0.05, + "weight_decay": 1e-3, + "elastic_aug_prob": 0.0, + "strategy3_rl_grad_clip_norm": DEFAULT_STRATEGY3_RL_GRAD_CLIP_NORM, + "strategy3_rl_loss_scale": DEFAULT_STRATEGY3_RL_LOSS_SCALE, + "strategy3_aux_ce_anneal_start_epoch": DEFAULT_STRATEGY3_AUX_CE_ANNEAL_START_EPOCH, + "strategy3_aux_ce_anneal_epochs": DEFAULT_STRATEGY3_AUX_CE_ANNEAL_EPOCHS, + "strategy3_aux_ce_floor_fraction": DEFAULT_STRATEGY3_AUX_CE_FLOOR_FRACTION, + "epoch_probe_mode": DEFAULT_STRATEGY3_PROBE_MODE, + "early_stopping_patience": DEFAULT_STRATEGY3_EARLY_STOPPING_PATIENCE, + "best_checkpoint_metric_name": BEST_CHECKPOINT_METRICS[3], + } + + # --- Strategy 2 (supervised): 4 knobs, ranges tuned for the pretrained ViT --- + head_lr = trial.suggest_float("head_lr", 1e-4, 2e-3, log=True) # fresh decoder/head + encoder_lr = trial.suggest_float("encoder_lr", 1e-5, 5e-4, log=True) # pretrained ViT+ResNet: keep low + weight_decay = trial.suggest_float("weight_decay", 1e-5, 1e-3, log=True) + dropout_p = trial.suggest_float("dropout_p", 0.0, 0.30) + return { + "head_lr": head_lr, + "encoder_lr": encoder_lr, + "weight_decay": weight_decay, + "dropout_p": dropout_p, + "tmax": DEFAULT_TMAX, + "entropy_lr": DEFAULT_ENTROPY_LR, + "best_checkpoint_metric_name": BEST_CHECKPOINT_METRICS[2], + } + +def _format_hparam_value(key: str, value: Any) -> str: + if isinstance(value, float): + if key in {"head_lr", "encoder_lr", "entropy_lr"}: + return f"{value:.3e}" + return f"{value:.6g}" + return str(value) + +def log_optuna_trial_start( + *, + study_name: str, + strategy: int, + bundle: DataBundle, + trial: optuna.trial.Trial, + trial_dir: Path, + params: dict[str, Any], + max_epochs: int, +) -> None: + run_name = run_identity_label( + strategy=strategy, + percent=bundle.percent, + trial_number=trial.number, + split_payload=bundle.split_payload, + ) + lines = [ + "", + "-" * 80, + f"OPTUNA TRIAL START | {run_name}", + "-" * 80, + f"Study name : {study_name}", + f"Run dir : {trial_dir}", + f"Max epochs : {max_epochs}", + f"Objective metric : {_strategy_selection_metric_name(strategy)}", + ] + for key in sorted(params): + lines.append(f"{key:22s}: {_format_hparam_value(key, params[key])}") + tqdm.write("\n".join(lines)) + +def log_optuna_trial_result( + *, + strategy: int, + bundle: DataBundle, + trial: optuna.trial.Trial, + metric_value: float, + aggregate: dict[str, dict[str, float]], +) -> None: + run_name = run_identity_label( + strategy=strategy, + percent=bundle.percent, + trial_number=trial.number, + split_payload=bundle.split_payload, + ) + tqdm.write( + f"[{run_name}] completed: {_strategy_selection_metric_name(strategy)}={metric_value:.4f}, " + f"best_test_iou={aggregate['iou']['mean']:.4f}" + ) + +def study_paths_for( + strategy: int, + percent: float, + model_config: RuntimeModelConfig | None = None, +) -> tuple[Path, Path, Path]: + pct_root = RUNS_ROOT / MODEL_NAME / f"pct_{percent_label(percent)}" + strategy_root = pct_root / strategy_dir_name(strategy, model_config) + study_root = strategy_root / "study" + trials_root = strategy_root / "trials" + return strategy_root, study_root, trials_root + +def manual_hparams_key(strategy: int, percent: float) -> str: + return f"{strategy}:{percent_label(percent)}" + +def reset_study_artifacts(strategy: int, percent: float, *, model_config: RuntimeModelConfig) -> None: + strategy_root, study_root, trials_root = study_paths_for(strategy, percent, model_config) + removed_any = False + for path in (study_root, trials_root): + if path.exists(): + shutil.rmtree(path) + removed_any = True + if removed_any: + print( + f"[Optuna Reset] Removed cached study artifacts for strategy={strategy}, " + f"percent={percent_text(percent)} under {strategy_root}." + ) + else: + print( + f"[Optuna Reset] No existing study artifacts found for strategy={strategy}, " + f"percent={percent_text(percent)}." + ) + +class _PlateauPruner(optuna.pruners.BasePruner): + """Prune a trial whose metric has plateaued (no improvement to its + own personal best within a patience window). + + Behaviour: + - During the first *n_warmup_steps* epochs: never prune. + - After warmup, track the trial's own best metric and the epoch + at which it was achieved. + - If *patience_steps* epochs pass without the trial beating its + own best, the trial is pruned (it has stagnated). + """ + + def __init__( + self, + n_warmup_steps: int = 80, + patience_steps: int = 40, + ) -> None: + self._n_warmup_steps = n_warmup_steps + self._patience_steps = patience_steps + + def prune( + self, + study: "optuna.study.Study", + trial: "optuna.trial.FrozenTrial", + ) -> bool: + step = trial.last_step + if step is None or step < self._n_warmup_steps: + return False + + post_warmup = { + s: v for s, v in trial.intermediate_values.items() + if s >= self._n_warmup_steps + } + if not post_warmup: + return False + + best_step = max(post_warmup, key=post_warmup.get) + epochs_since_improvement = step - best_step + return epochs_since_improvement >= self._patience_steps + + +def pruner_for_run() -> optuna.pruners.BasePruner: + if USE_TRIAL_PRUNING: + return _PlateauPruner( + n_warmup_steps=TRIAL_PRUNER_WARMUP_STEPS, + patience_steps=TRIAL_PRUNER_PATIENCE_STEPS, + ) + return optuna.pruners.NopPruner() + +def run_single_job( + *, + strategy: int, + model_config: RuntimeModelConfig, + bundle: DataBundle, + run_dir: Path, + params: dict[str, Any], + max_epochs: int, + trial: optuna.trial.Trial | None, + strategy2_checkpoint_path: str | Path | None = None, + resume_checkpoint_path: Path | None = None, + retrying_from_trial_number: int | None = None, +) -> tuple[dict[str, Any], list[dict[str, Any]], dict[str, dict[str, float]]]: + strategy = _require_supported_strategy(strategy) + params = dict(params) + params.setdefault("best_checkpoint_metric_name", BEST_CHECKPOINT_METRICS[strategy]) + params.setdefault("entropy_lr", DEFAULT_ENTROPY_LR) + if strategy == 3: + params.setdefault( + "strategy3_freeze_bootstrapped_segmentation", + DEFAULT_STRATEGY3_FREEZE_BOOTSTRAPPED_SEGMENTATION, + ) + bootstrap_freeze = ( + strategy2_checkpoint_path is not None + and bool(params["strategy3_freeze_bootstrapped_segmentation"]) + ) + params.setdefault("strategy3_variant", DEFAULT_STRATEGY3_VARIANT) + params.setdefault("decoder_lr", 0.0 if bootstrap_freeze else params["head_lr"] * 0.1) + params.setdefault("rl_lr", params["head_lr"]) + params.setdefault("strategy3_decoder_ce_weight", 0.0 if bootstrap_freeze else DEFAULT_CE_WEIGHT) + params.setdefault("strategy3_decoder_dice_weight", 0.0 if bootstrap_freeze else DEFAULT_DICE_WEIGHT) + params.setdefault("strategy3_delta_max", DEFAULT_STRATEGY3_DELTA_MAX) + params.setdefault("strategy3_sam_attention_grid", DEFAULT_STRATEGY3_SAM_ATTENTION_GRID) + params.setdefault("strategy3_r1_progress_weight", DEFAULT_STRATEGY3_R1_PROGRESS_WEIGHT) + params.setdefault("biou_reward_weight", DEFAULT_BIOU_REWARD_WEIGHT) + params.setdefault("strategy3_advantage_normalize", DEFAULT_STRATEGY3_ADVANTAGE_NORMALIZE) + params.setdefault("strategy3_rl_loss_scale", DEFAULT_STRATEGY3_RL_LOSS_SCALE) + params.setdefault("elastic_aug_prob", 0.3) + params.setdefault("strategy3_rl_grad_clip_norm", DEFAULT_STRATEGY3_RL_GRAD_CLIP_NORM) + params.setdefault("strategy3_aux_ce_weight", DEFAULT_STRATEGY3_AUX_CE_WEIGHT) + params.setdefault("strategy3_aux_ce_anneal_start_epoch", DEFAULT_STRATEGY3_AUX_CE_ANNEAL_START_EPOCH) + params.setdefault("strategy3_aux_ce_anneal_epochs", DEFAULT_STRATEGY3_AUX_CE_ANNEAL_EPOCHS) + params.setdefault("strategy3_aux_ce_floor_fraction", DEFAULT_STRATEGY3_AUX_CE_FLOOR_FRACTION) + params.setdefault("epoch_probe_mode", DEFAULT_STRATEGY3_PROBE_MODE) + params.setdefault("early_stopping_monitor", DEFAULT_EARLY_STOPPING_MONITOR) + params.setdefault("early_stopping_mode", DEFAULT_EARLY_STOPPING_MODE) + params.setdefault("early_stopping_min_delta", DEFAULT_EARLY_STOPPING_MIN_DELTA) + params.setdefault("early_stopping_start_epoch", DEFAULT_EARLY_STOPPING_START_EPOCH) + params.setdefault("early_stopping_patience", DEFAULT_STRATEGY3_EARLY_STOPPING_PATIENCE) + set_current_job_params(params) + if "smp_encoder_proj_dim" in params and int(params["smp_encoder_proj_dim"]) != model_config.smp_encoder_proj_dim: + model_config = RuntimeModelConfig.from_payload( + {**model_config.to_payload(), "smp_encoder_proj_dim": int(params["smp_encoder_proj_dim"])} + ).validate() + entropy_target_ratio = float(_job_param("entropy_target_ratio", 0.35)) + entropy_alpha_init = float(_job_param("entropy_alpha_init", 0.12)) + critic_loss_weight = float(_job_param("critic_loss_weight", DEFAULT_CRITIC_LOSS_WEIGHT)) + ensure_dir(run_dir) + run_type = "trial" if trial is not None else "final" + config = { + "project_dir": str(PROJECT_DIR), + "data_root": str(DATA_ROOT), + "run_type": run_type, + "run_name": run_identity_label( + strategy=strategy, + percent=bundle.percent, + trial_number=trial.number if trial is not None else None, + split_payload=bundle.split_payload, + ), + "strategy": strategy, + "dataset_percent": bundle.percent, + "dataset_name": bundle.split_payload["dataset_name"], + "dataset_split_policy": bundle.split_payload["dataset_split_policy"], + "dataset_splits_path": bundle.split_payload["dataset_splits_path"], + "split_type": bundle.split_payload["split_type"], + "train_subset_key": bundle.split_payload["train_subset_key"], + "train_subset_variant": bundle.split_payload.get("train_subset_variant", 0), + "train_subset_source": bundle.split_payload.get("train_subset_source", "persisted"), + "selected_split_manifest_path": bundle.split_payload.get("selected_split_manifest_path"), + "normalization_cache_path": bundle.split_payload["normalization_cache_path"], + "best_checkpoint_metric_name": _strategy_selection_metric_name(strategy), + "best_checkpoint_metrics": {str(key): value for key, value in BEST_CHECKPOINT_METRICS.items()}, + "save_history_incrementally": bool(SAVE_HISTORY_INCREMENTALLY), + "write_epoch_diagnostic": bool(WRITE_EPOCH_DIAGNOSTIC), + "head_lr": params["head_lr"], + "encoder_lr": params["encoder_lr"], + "weight_decay": params["weight_decay"], + "dropout_p": params["dropout_p"], + "tmax": params["tmax"], + "entropy_lr": params["entropy_lr"], + "max_epochs": max_epochs, + "gamma": DEFAULT_GAMMA, + "critic_loss_weight": critic_loss_weight, + "grad_clip_norm": DEFAULT_GRAD_CLIP_NORM, + "scheduler_factor": SCHEDULER_FACTOR, + "scheduler_patience": SCHEDULER_PATIENCE, + "scheduler_threshold": SCHEDULER_THRESHOLD, + "scheduler_min_lr": SCHEDULER_MIN_LR, + "execution_mode": EXECUTION_MODE, + "evaluation_checkpoint_mode": EVAL_CHECKPOINT_MODE, + "strategy2_checkpoint_mode": STRATEGY2_CHECKPOINT_MODE, + "train_resume_mode": TRAIN_RESUME_MODE, + "train_resume_specific_checkpoint": TRAIN_RESUME_SPECIFIC_CHECKPOINT, + } + config.update({key: value for key, value in params.items() if key not in config}) + config.update(model_config.to_payload()) + if strategy2_checkpoint_path is not None: + config["strategy2_checkpoint_path"] = str(Path(strategy2_checkpoint_path)) + if resume_checkpoint_path is not None: + config["resume_checkpoint_path"] = str(Path(resume_checkpoint_path)) + if retrying_from_trial_number is not None: + config["retrying_from_trial_number"] = int(retrying_from_trial_number) + save_json(run_dir / "run_config.json", config) + + model: nn.Module | None = None + try: + model, description, _compiled = build_model( + strategy, + params["dropout_p"], + model_config=model_config, + strategy2_checkpoint_path=strategy2_checkpoint_path, + ) + summary, history = train_model( + run_type=run_type, + model_config=model_config, + run_config=config, + model=model, + description=description, + strategy=strategy, + run_dir=run_dir, + bundle=bundle, + max_epochs=max_epochs, + head_lr=params["head_lr"], + encoder_lr=params["encoder_lr"], + weight_decay=params["weight_decay"], + tmax=params["tmax"], + entropy_lr=params["entropy_lr"], + entropy_alpha_init=entropy_alpha_init, + entropy_target_ratio=entropy_target_ratio, + critic_loss_weight=critic_loss_weight, + ce_weight=DEFAULT_CE_WEIGHT, + dice_weight=DEFAULT_DICE_WEIGHT, + dropout_p=params["dropout_p"], + resume_checkpoint_path=resume_checkpoint_path, + trial=trial, + ) + + if trial is not None: + save_json( + run_dir / "summary.json", + { + "params": params, + "best_iou": float(summary["best_val_iou"]), + "best_model_metric_name": str(summary["best_model_metric_name"]), + "best_model_metric": float(summary["best_model_metric"]), + "resumed": bool(resume_checkpoint_path is not None), + "retrying_from_trial_number": retrying_from_trial_number, + }, + ) + return summary, history, {} + + del model + model = None + run_cuda_cleanup() + + aggregate, _per_sample = run_evaluation_for_run( + strategy=strategy, + percent=bundle.percent, + bundle=bundle, + run_dir=run_dir, + strategy2_checkpoint_path=strategy2_checkpoint_path, + ) + return summary, history, aggregate + finally: + if model is not None: + del model + model = None + run_cuda_cleanup() + +def _save_best_params_so_far( + study: optuna.study.Study, + study_root: Path, + strategy: int, + *, + current_trial: optuna.trial.Trial | None = None, + current_best_value: float | None = None, +) -> None: + best, _best_value = _current_optuna_study_best_candidate( + study, + current_trial=current_trial, + current_best_value=current_best_value, + ) + if best is None: + return + params = dict(best.params) + if strategy == 2: + params.setdefault("tmax", DEFAULT_TMAX) + params.setdefault("entropy_lr", DEFAULT_ENTROPY_LR) + save_json(study_root / "best_params.json", params) + +def run_study( + strategy: int, + bundle: DataBundle, + *, + model_config: RuntimeModelConfig, + strategy2_checkpoint_path: str | Path | None = None, +) -> dict[str, Any]: + strategy = _require_supported_strategy(strategy) + strategy_root, study_root, trials_root = study_paths_for(strategy, bundle.percent, model_config) + ensure_dir(strategy_root.parent) + strategy_root = ensure_dir(strategy_root) + study_root = ensure_dir(strategy_root / "study") + trials_root = ensure_dir(strategy_root / "trials") + storage_path = study_root / "study.sqlite3" + storage = RDBStorage( + url=f"sqlite:///{storage_path.resolve()}", + heartbeat_interval=OPTUNA_HEARTBEAT_INTERVAL, + grace_period=OPTUNA_HEARTBEAT_GRACE_PERIOD, + ) + sampler = optuna.samplers.TPESampler(seed=SEED) + study_name = ( + f"{MODEL_NAME}_{model_config.backbone_tag()}_{run_identity_slug(strategy=strategy, percent=bundle.percent, split_payload=bundle.split_payload)}" + ) + study = optuna.create_study( + study_name=study_name, + direction=STUDY_DIRECTION, + sampler=sampler, + pruner=pruner_for_run(), + storage=storage, + load_if_exists=LOAD_EXISTING_STUDIES, + ) + existing_trials = [trial for trial in study.trials if trial.state.is_finished()] + if existing_trials: + print( + f"[Optuna Study] Loaded existing study '{study_name}' with " + f"{len(existing_trials)} existing finished trial(s). Running {NUM_TRIALS} new trial(s)." + ) + else: + print(f"[Optuna Study] Starting new study '{study_name}' with {NUM_TRIALS} trial(s).") + + def objective(trial: optuna.trial.Trial) -> float: + trial_dir = ensure_dir(trials_root / f"trial_{trial.number:03d}") + params = suggest_hyperparameters(trial, strategy) + log_optuna_trial_start( + study_name=study_name, + strategy=strategy, + bundle=bundle, + trial=trial, + trial_dir=trial_dir, + params=params, + max_epochs=strategy_epochs(strategy), + ) + summary: dict[str, Any] | None = None + _history: list[dict[str, Any]] | None = None + aggregate: dict[str, dict[str, float]] | None = None + completed_successfully = False + pruned_by_optuna = False + run_cuda_cleanup() + try: + summary, _history, aggregate = run_single_job( + strategy=strategy, + model_config=model_config, + bundle=bundle, + run_dir=trial_dir, + params=params, + max_epochs=strategy_epochs(strategy), + trial=trial, + strategy2_checkpoint_path=strategy2_checkpoint_path, + ) + metric_value = float(summary["best_model_metric"]) + completed_successfully = True + tqdm.write( + f"[{run_identity_label(strategy=strategy, percent=bundle.percent, trial_number=trial.number, split_payload=bundle.split_payload)}] " + f"completed: {summary['best_model_metric_name']}={metric_value:.4f}" + ) + return metric_value + except optuna.TrialPruned: + pruned_by_optuna = True + raise + finally: + current_trial = trial if (completed_successfully or pruned_by_optuna) else None + current_best_value = None + if summary is not None and summary.get("best_model_metric") is not None: + current_best_value = float(summary["best_model_metric"]) + _save_best_params_so_far( + study, + study_root, + strategy, + current_trial=current_trial, + current_best_value=current_best_value, + ) + if aggregate is not None: + del aggregate + aggregate = None + if _history is not None: + del _history + _history = None + if summary is not None: + del summary + summary = None + prune_optuna_trial_dir(trial_dir) + run_cuda_cleanup(context=f"trial {trial.number:03d} boundary") + + study.optimize(objective, n_trials=NUM_TRIALS, show_progress_bar=True) + + best_trial, best_observed_value = _current_optuna_study_best_candidate(study) + if best_trial is None or best_observed_value is None: + raise RuntimeError( + f"Study '{study_name}' has no trials with recorded best-observed values, so best params cannot be resolved. " + f"Finished trials={len([trial for trial in study.trials if trial.state.is_finished()])}, " + f"configured cap={NUM_TRIALS}." + ) + + best_params = dict(best_trial.params) + if strategy == 2: + best_params.setdefault("tmax", DEFAULT_TMAX) + best_params.setdefault("entropy_lr", DEFAULT_ENTROPY_LR) + save_json(study_root / "best_params.json", best_params) + optuna_best_value: float | None + try: + optuna_best_value = float(study.best_value) + except Exception: + optuna_best_value = None + save_json( + study_root / "summary.json", + { + "best_params": best_params, + "optimized_param_names": sorted(best_params.keys()), + "best_metric_name": _strategy_selection_metric_name(strategy), + "best_metric_value": float(best_observed_value), + "best_observed_value": float(best_observed_value), + "best_trial_number": int(getattr(best_trial, "number", -1)), + "optuna_best_value": optuna_best_value, + "best_iou": float(best_observed_value) if _strategy_selection_metric_name(strategy) == "val_iou" else None, + "finished_trials": len([trial for trial in study.trials if trial.state.is_finished()]), + "completed_trials": len([t for t in study.trials if t.state == optuna.trial.TrialState.COMPLETE]), + "target_trials": int(NUM_TRIALS), + "ran_trials": int(NUM_TRIALS), + }, + ) + prune_optuna_study_dir(study_root) + if trials_root.exists(): + shutil.rmtree(trials_root, ignore_errors=True) + return best_params + +def run_final_training( + strategy: int, + bundle: DataBundle, + params: dict[str, Any], + *, + model_config: RuntimeModelConfig, + strategy2_checkpoint_path: str | Path | None = None, +) -> None: + strategy = _require_supported_strategy(strategy) + final_root = final_root_for_strategy(strategy, bundle.percent, model_config) + if SKIP_EXISTING_FINALS and (final_root / "summary.json").exists(): + print(f"Skipping existing final run: {final_root}") + return + save_json(final_root / "best_params.json", params) + resume_checkpoint_path = resolve_train_resume_checkpoint_path(final_root) + run_single_job( + strategy=strategy, + model_config=model_config, + bundle=bundle, + run_dir=final_root, + params=params, + max_epochs=strategy_epochs(strategy), + trial=None, + strategy2_checkpoint_path=strategy2_checkpoint_path, + resume_checkpoint_path=resume_checkpoint_path, + ) + +def print_environment_summary(model_config: RuntimeModelConfig) -> None: + banner("RUNTIME SUMMARY") + images_dir, annotations_dir = current_dataset_dirs() + print(f"Project dir : {PROJECT_DIR}") + print(f"Data root : {DATA_ROOT}") + print(f"Runs root : {RUNS_ROOT}") + print(f"Dataset name : {current_dataset_name()}") + if current_dataset_name() == "BUSI_with_classes": + print(f"Dataset split policy : {current_busi_with_classes_split_policy()}") + print(f"Images dir : {images_dir}") + print(f"Masks dir : {annotations_dir}") + print(f"Dataset splits json : {current_dataset_splits_json_path()}") + print(f"Split type : {SPLIT_TYPE}") + print(f"Experiment mode : {EXPERIMENT_MODE}") + print(f"Device : {DEVICE}") + print(f"Device source : {DEVICE_FALLBACK_SOURCE}") + print(f"Model name : {MODEL_NAME}") + print(f"Seed : {SEED}") + print(f"PyTorch version : {torch.__version__}") + print(f"Batch size : {BATCH_SIZE}") + print(f"Use AMP : {USE_AMP}") + print(f"Num workers : {NUM_WORKERS}") + print(f"Pin memory : {USE_PIN_MEMORY}") + print(f"CuDNN deterministic : {torch.backends.cudnn.deterministic}") + print(f"CuDNN benchmark : {torch.backends.cudnn.benchmark}") + + if DEVICE.type == "cuda": + props = torch.cuda.get_device_properties(0) + print(f"GPU : {torch.cuda.get_device_name(0)}") + print(f"GPU VRAM : {props.total_memory / (1024 ** 3):.2f} GB") + print(f"AMP dtype : {resolve_amp_dtype(AMP_DTYPE)}") + print(f"Trial pruning : {USE_TRIAL_PRUNING}") + print(f"Backbone family : {model_config.backbone_family}") + if model_config.backbone_family == "custom_vgg": + print(f"VGG feature scales : {model_config.vgg_feature_scales}") + print(f"VGG feature dilation : {model_config.vgg_feature_dilation}") + else: + print(f"SMP encoder : {model_config.smp_encoder_name}") + print(f"SMP encoder depth : {model_config.smp_encoder_depth}") + print(f"SMP encoder proj dim : {model_config.smp_encoder_proj_dim}") + print(f"SMP decoder : {model_config.smp_decoder_type}") + print(f"Strategies : {STRATEGIES}") + print(f"Dataset percents : {[percent_text(value) for value in DATASET_PERCENTS]}") + print(f"Best metrics : {BEST_CHECKPOINT_METRICS}") + print(f"History incremental : {SAVE_HISTORY_INCREMENTALLY}") + print(f"Write diagnostics : {WRITE_EPOCH_DIAGNOSTIC}") + print_imagenet_normalization_status() + print(f"Trials per study : {NUM_TRIALS}") + print(f"Execution mode : {EXECUTION_MODE}") + print(f"Run Optuna : {RUN_OPTUNA}") + print(f"Use saved best params : {USE_EXISTING_BEST_PARAMS_WHEN_OPTUNA_OFF}") + print(f"Reset studies/run : {RESET_ALL_STUDIES_EACH_RUN}") + print(f"Load existing studies : {LOAD_EXISTING_STUDIES}") + print(f"Eval ckpt selector : {EVAL_CHECKPOINT_MODE}") + print(f"S2 ckpt selector : {STRATEGY2_CHECKPOINT_MODE}") + print(f"S3 bootstrap from S2 : {STRATEGY3_BOOTSTRAP_FROM_STRATEGY2}") + print(f"S3 freeze default : {DEFAULT_STRATEGY3_FREEZE_BOOTSTRAPPED_SEGMENTATION}") + print(f"Train resume mode : {TRAIN_RESUME_MODE}") + print(f"Verbose epoch log : {VERBOSE_EPOCH_LOG}") + print(f"Validate every epochs : {VALIDATE_EVERY_N_EPOCHS}") + print(f"Smoke test enabled : {RUN_SMOKE_TEST}") + print(f"Test iter control : {TEST_ITERATION_CONTROL}") + print(f"Test iter target t : {TEST_ITERATION_T}") + print(f"Overfit test enabled : {RUN_OVERFIT_TEST}") + print(f"Overfit batches : {OVERFIT_N_BATCHES}") + print(f"Overfit epochs : {OVERFIT_N_EPOCHS}") + +def maybe_run_strategy_smoke_test( + *, + strategy: int, + model_config: RuntimeModelConfig, + bundle: DataBundle, + strategy2_checkpoint_path: str | Path | None = None, +) -> None: + if not RUN_SMOKE_TEST: + return + if EXECUTION_MODE == "eval_only": + return + run_smoke_test( + strategy=strategy, + model_config=model_config, + bundle=bundle, + smoke_root=strategy_root_for_percent(strategy, bundle.percent, model_config) / "smoke_test", + strategy2_checkpoint_path=strategy2_checkpoint_path, + ) + + +"""============================================================================= +REPEATED HOLDOUT INTEGRATION +============================================================================= +""" + +base = sys.modules[__name__] + +REPEATED_HOLDOUT_ROOT = base.RUNS_ROOT / base.MODEL_NAME / "repeated_holdout" +EXPERIMENT_ROOT = REPEATED_HOLDOUT_ROOT / FOLDS_EXPERIMENT_NAME +EXPERIMENT_DB_PATH = EXPERIMENT_ROOT / "experiment_state.sqlite3" +SPLIT_MANIFESTS_DIR = EXPERIMENT_ROOT / "manifests" / "splits" +SUBSET_MANIFESTS_DIR = EXPERIMENT_ROOT / "manifests" / "subsets" +EXPORTS_DIR = EXPERIMENT_ROOT / "exports" +"""============================================================================= +RUNTIME STATE +============================================================================= +""" + + +@dataclass(frozen=True) +class PercentRepeatSpec: + percent_int: int + fraction: float + repeat_count: int + + +@dataclass(frozen=True) +class FoldRunContext: + split_repeat_index: int + subset_repeat_index: int + percent_int: int + percent_fraction: float + split_seed: int + subset_seed: int + repeat_root: Path + split_manifest_path: Path + subset_manifest_path: Path + + +@dataclass(frozen=True) +class RunKey: + split_repeat_index: int + dataset_percent: int + subset_repeat_index: int + strategy: int + + +CURRENT_FOLD_CONTEXT: FoldRunContext | None = None +LEDGER_CONN: sqlite3.Connection | None = None +PERCENT_SPECS_CACHE: list[PercentRepeatSpec] | None = None + +ORIGINAL_SAVE_JSON = base.save_json +ORIGINAL_PERCENT_ROOT = base.percent_root +ORIGINAL_STRATEGY_ROOT_FOR_PERCENT = base.strategy_root_for_percent +ORIGINAL_FINAL_ROOT_FOR_STRATEGY = base.final_root_for_strategy +ORIGINAL_STUDY_PATHS_FOR = base.study_paths_for +ORIGINAL_SAVE_CHECKPOINT = base.save_checkpoint +ORIGINAL_RUN_EVALUATION_FOR_RUN = base.run_evaluation_for_run + +BASE_RESUME_IDENTITY_KEYS = tuple(base.RESUME_IDENTITY_KEYS) +RUNTIME_ONLY_CONFIG_KEYS = frozenset( + { + "PERCENT_EXECUTION_MODE", + "SELECTED_DATASET_PERCENTS", + "SPLIT_EXECUTION_MODE", + "SELECTED_SPLIT_INDICES", + "PHASE_EXECUTION_MODE", + "SELECTED_PHASES", + "REPEAT_EXECUTION_MODE", + "SELECTED_REPEAT_INDICES", + } +) +PORTABLE_FINGERPRINT_FOLD_KEYS = frozenset( + { + "RESUME_FOLDS", + "REPEATED_HOLDOUT_ROOT", + "EXPERIMENT_ROOT", + "EXPERIMENT_DB_PATH", + } +) + + +"""============================================================================= +UTILITIES +============================================================================= +""" + + +def now_utc_iso() -> str: + return datetime.now(timezone.utc).isoformat() + + +def _jsonify(value: Any) -> Any: + if isinstance(value, Path): + return str(value) + if isinstance(value, dict): + return {str(key): _jsonify(val) for key, val in sorted(value.items(), key=lambda item: str(item[0]))} + if isinstance(value, (list, tuple)): + return [_jsonify(item) for item in value] + if isinstance(value, set): + return [_jsonify(item) for item in sorted(value, key=str)] + if isinstance(value, (str, int, float, bool)) or value is None: + return value + return repr(value) + + +def _summary_mean_std(values: list[float]) -> dict[str, float]: + arr = np.array(values, dtype=np.float64) + return { + "mean": float(arr.mean()) if arr.size > 0 else 0.0, + "std": float(arr.std()) if arr.size > 0 else 0.0, + } + + +def _phase_timing_summary_path() -> Path: + return EXPERIMENT_ROOT / "phase_timing_summary.json" + + +def _completed_run_rows_for_phase(phase_index: int) -> list[sqlite3.Row]: + return list( + require_ledger().execute( + """ + SELECT * + FROM run_status + WHERE status = 'completed' + AND split_repeat_index = ? + ORDER BY dataset_percent, subset_repeat_index, strategy + """, + (int(phase_index),), + ).fetchall() + ) + + +def _run_training_elapsed_seconds(row: sqlite3.Row) -> float | None: + run_dir = Path(str(row["run_dir"])) + summary_path = run_dir / "summary.json" + if summary_path.exists(): + try: + summary = base.load_json(summary_path) + if summary.get("elapsed_seconds") is not None: + return float(summary["elapsed_seconds"]) + except Exception as exc: + print(f"[Timing] Could not read {summary_path}: {exc}") + if row["elapsed_seconds"] is not None: + return float(row["elapsed_seconds"]) + return None + + +def write_phase_timing_summary_after_phase(phase_index: int) -> None: + if LEDGER_CONN is None: + return + rows = _completed_run_rows_for_phase(phase_index) + if not rows: + return + + run_entries: list[dict[str, Any]] = [] + phase_values: list[float] = [] + for row in rows: + elapsed = _run_training_elapsed_seconds(row) + entry = { + "phase_index": int(row["split_repeat_index"]), + "dataset_percent": int(row["dataset_percent"]), + "subset_repeat_index": int(row["subset_repeat_index"]), + "strategy": int(row["strategy"]), + "run_dir": str(row["run_dir"]), + "training_elapsed_seconds": elapsed, + } + run_entries.append(entry) + if elapsed is not None: + phase_values.append(float(elapsed)) + + phase_stats = _summary_mean_std(phase_values) + existing_payload: dict[str, Any] = {} + summary_path = _phase_timing_summary_path() + if summary_path.exists(): + try: + existing_payload = base.load_json(summary_path) + except Exception as exc: + print(f"[Timing] Could not read existing phase timing summary {summary_path}: {exc}") + + phases_by_index: dict[int, dict[str, Any]] = {} + for phase_payload in existing_payload.get("phases", []): + if isinstance(phase_payload, dict) and phase_payload.get("phase_index") is not None: + phases_by_index[int(phase_payload["phase_index"])] = dict(phase_payload) + phases_by_index[int(phase_index)] = { + "phase_index": int(phase_index), + "completed_strategy_count": len(run_entries), + "completed_strategies": [int(entry["strategy"]) for entry in run_entries], + "runs": run_entries, + "training_elapsed_seconds_mean": phase_stats["mean"], + "training_elapsed_seconds_std": phase_stats["std"], + "updated_at": now_utc_iso(), + } + + phases = [phases_by_index[index] for index in sorted(phases_by_index)] + global_phase_means = [ + float(phase["training_elapsed_seconds_mean"]) + for phase in phases + if phase.get("training_elapsed_seconds_mean") is not None + ] + global_stats = _summary_mean_std(global_phase_means) + payload = { + "scope": "fixed_phase_training_time", + "definition": "training elapsed_seconds from summary.json, falling back to the ledger checkpoint elapsed_seconds", + "phase_count": len(phases), + "training_elapsed_seconds_mean_across_phases": global_stats["mean"], + "training_elapsed_seconds_std_across_phases": global_stats["std"], + "phases": phases, + "updated_at": now_utc_iso(), + } + atomic_save_json(summary_path, payload) + print( + f"[Timing] Phase {phase_index:03d} training time summary updated -> {summary_path} " + f"(mean={phase_stats['mean']:.2f}s, std={phase_stats['std']:.2f}s)." + ) + + +def validate_hf_backup_settings() -> None: + """Fail fast at startup if backups are enabled but HF env vars are missing. + + Refuses to run rather than discovering hours into training (at the first + backup) that nothing can be uploaded. Disable by setting + ASYNC_REPO_BACKUP_AFTER_PHASE = False if you intentionally want no backups. + """ + if not ASYNC_REPO_BACKUP_AFTER_PHASE: + return + repo_id = HF_REPO_ID or os.environ.get("HF_REPO_ID", "") + token = os.environ.get("HF_TOKEN") or os.environ.get("HUGGINGFACE_HUB_TOKEN") + missing = [] + if not repo_id: + missing.append("HF_REPO_ID (target repo, e.g. 'your-username/ADVAI24JUN-backup')") + if not token: + missing.append("HF_TOKEN (Hugging Face write token)") + if missing: + raise RuntimeError( + "Hugging Face backup is enabled (ASYNC_REPO_BACKUP_AFTER_PHASE = True) " + "but required environment variables are not set:\n - " + + "\n - ".join(missing) + + "\n\nSet them before running, e.g.:\n" + " export HF_REPO_ID='your-username/ADVAI24JUN-backup'\n" + " export HF_TOKEN='hf_xxxxxxxxxxxxxxxxxxxxx'\n" + "Or set ASYNC_REPO_BACKUP_AFTER_PHASE = False to run without backups." + ) + + +def _hf_backup_due(phase_index: int) -> bool: + """True only on every HF_BACKUP_EVERY_N_PHASES-th phase (0-indexed boundary).""" + n = max(1, int(HF_BACKUP_EVERY_N_PHASES)) + return (phase_index + 1) % n == 0 + + +def _hf_upload_project(*, label: str) -> bool: + """Create the HF dataset repo if needed and mirror PROJECT_DIR into it. + + Shared by the initial pre-training backup and the per-phase backups. + `upload_large_folder` is resumable and content-addressed: unchanged files are + skipped and an interrupted upload (e.g. a 503) can be safely re-run, so the repo + always converges to the latest project state. Retries with backoff to ride out + transient HF outages. Returns True on a verified successful upload. + """ + repo_id = HF_REPO_ID or os.environ.get("HF_REPO_ID", "") + token = os.environ.get("HF_TOKEN") or os.environ.get("HUGGINGFACE_HUB_TOKEN") + if not repo_id: + print(f"[Backup] Skipping HF backup ({label}): HF_REPO_ID is not set (export HF_REPO_ID=user/repo).") + return False + if not token: + print(f"[Backup] Skipping HF backup ({label}): HF_TOKEN env var is not set.") + return False + + try: + from huggingface_hub import HfApi + except Exception: + print(f"[Backup] Skipping HF backup ({label}): huggingface_hub not installed (pip install huggingface_hub).") + return False + + api = HfApi(token=token) + try: + api.create_repo(repo_id=repo_id, repo_type=HF_REPO_TYPE, private=True, exist_ok=True) + except Exception as exc: + print(f"[Backup] Could not ensure HF repo {repo_id} exists: {exc}") + + last_exc: Exception | None = None + for attempt in range(1, HF_BACKUP_MAX_RETRIES + 1): + try: + print( + f"[Backup] {label}: uploading project to " + f"hf://{HF_REPO_TYPE}/{repo_id} (attempt {attempt}/{HF_BACKUP_MAX_RETRIES})..." + ) + api.upload_large_folder( + repo_id=repo_id, + repo_type=HF_REPO_TYPE, + folder_path=str(PROJECT_DIR.resolve()), + ignore_patterns=list(HF_IGNORE_PATTERNS), + print_report=True, + ) + print(f"[Backup] {label}: HF backup complete -> {repo_id}.") + return True + except Exception as exc: + last_exc = exc + wait = min(60, 5 * attempt) + print(f"[Backup] {label}: HF upload attempt {attempt} failed: {exc}. Retrying in {wait}s...") + time.sleep(wait) + print(f"[Backup] {label}: HF backup FAILED after {HF_BACKUP_MAX_RETRIES} attempts: {last_exc}") + return False + + +def run_initial_hf_backup() -> None: + """Fresh backup BEFORE any training begins. + + Creates the repo and uploads the current project state synchronously, so the + entire backup pipeline (repo creation, token, upload) is proven before we commit + hours of compute. Later phase backups refresh this same repo. Runs in the + foreground on purpose -- if the first backup cannot complete, we want to know now. + """ + if not ASYNC_REPO_BACKUP_AFTER_PHASE or not HF_BACKUP_ON_START: + return + print("[Backup] Running initial pre-training backup (this proves the backup pipeline before training)...") + _hf_upload_project(label="Initial backup") + + +def run_repo_backup_after_phase(phase_index: int) -> None: + """Refresh the Hugging Face dataset repo after a training phase. + + Fires only on every HF_BACKUP_EVERY_N_PHASES-th phase so we don't hammer HF. + Runs in a background thread at the call site. + """ + if not ASYNC_REPO_BACKUP_AFTER_PHASE: + return + if not _hf_backup_due(phase_index): + print( + f"[Backup] Phase {phase_index:03d}: skipping HF backup " + f"(uploads every {HF_BACKUP_EVERY_N_PHASES} phases)." + ) + return + _hf_upload_project(label=f"Phase {phase_index:03d}") + + +def atomic_write_text(path: str | Path, text: str) -> None: + target = Path(path) + ensure_dir(target.parent) + fd, tmp_name = tempfile.mkstemp(prefix=f".{target.name}.", suffix=".tmp", dir=str(target.parent)) + tmp_path = Path(tmp_name) + try: + with os.fdopen(fd, "w", encoding="utf-8") as handle: + handle.write(text) + handle.flush() + os.fsync(handle.fileno()) + os.replace(tmp_path, target) + finally: + if tmp_path.exists(): + tmp_path.unlink(missing_ok=True) + + +def atomic_write_bytes(path: str | Path, payload: bytes) -> None: + target = Path(path) + ensure_dir(target.parent) + fd, tmp_name = tempfile.mkstemp(prefix=f".{target.name}.", suffix=".tmp", dir=str(target.parent)) + tmp_path = Path(tmp_name) + try: + with os.fdopen(fd, "wb") as handle: + handle.write(payload) + handle.flush() + os.fsync(handle.fileno()) + os.replace(tmp_path, target) + finally: + if tmp_path.exists(): + tmp_path.unlink(missing_ok=True) + + +def atomic_save_json(path: str | Path, payload: Any) -> None: + atomic_write_text(path, json.dumps(payload, indent=2, sort_keys=True)) + + +def atomic_torch_save(path: str | Path, payload: Any) -> None: + target = Path(path) + ensure_dir(target.parent) + fd, tmp_name = tempfile.mkstemp(prefix=f".{target.name}.", suffix=".tmp", dir=str(target.parent)) + tmp_path = Path(tmp_name) + try: + with os.fdopen(fd, "wb") as handle: + torch.save(payload, handle) + handle.flush() + os.fsync(handle.fileno()) + os.replace(tmp_path, target) + finally: + if tmp_path.exists(): + tmp_path.unlink(missing_ok=True) + + +def stable_hash(text: str) -> str: + return hashlib.sha256(text.encode("utf-8")).hexdigest() + + +def stable_int(text: str) -> int: + return base.stable_int_from_text(text) + + +def fold_seed(tag: str) -> int: + return int(base.SEED) + stable_int(tag) + + +def current_split_generation_mode() -> str: + mode = str(SPLIT_GENERATION_MODE).strip().lower() + if mode not in SUPPORTED_SPLIT_GENERATION_MODES: + raise ValueError( + f"SPLIT_GENERATION_MODE must be one of {SUPPORTED_SPLIT_GENERATION_MODES}, got {mode!r}" + ) + return mode + + +def using_fixed_phase_mode() -> bool: + return current_split_generation_mode() == "fixed_stratified_phases_8_1_1" + + +def primary_unit_name(*, plural: bool = False) -> str: + if using_fixed_phase_mode(): + return "phases" if plural else "phase" + return "splits" if plural else "split" + + +def current_phase_execution_mode() -> str: + mode = str(PHASE_EXECUTION_MODE).strip().lower() + if mode not in SUPPORTED_PHASE_EXECUTION_MODES: + raise ValueError( + f"PHASE_EXECUTION_MODE must be one of {SUPPORTED_PHASE_EXECUTION_MODES}, got {mode!r}" + ) + return mode + + +def phase_count() -> int: + if isinstance(NUM_PHASES, bool) or int(NUM_PHASES) <= 0: + raise ValueError("NUM_PHASES must be a positive integer.") + return int(NUM_PHASES) + + +def phase_val_offset() -> int: + if isinstance(PHASE_VAL_OFFSET, bool): + raise TypeError("PHASE_VAL_OFFSET must be an integer.") + return int(PHASE_VAL_OFFSET) + + +def phase_indices() -> list[int]: + return list(range(1, phase_count() + 1)) + + +def phase_execution_indices_to_run() -> list[int]: + indices = phase_indices() + if current_phase_execution_mode() == "auto": + return indices + + if not SELECTED_PHASES: + raise ValueError("SELECTED_PHASES must be non-empty when PHASE_EXECUTION_MODE='manual'.") + + selected: list[int] = [] + seen: set[int] = set() + max_index = indices[-1] + for raw_index in SELECTED_PHASES: + if isinstance(raw_index, bool) or not isinstance(raw_index, int): + raise TypeError( + f"SELECTED_PHASES entries must be integer phase indices in the range [1, {max_index}]." + ) + if raw_index < 1 or raw_index > max_index: + raise ValueError( + f"SELECTED_PHASES entries must be in the range [1, {max_index}], got {raw_index}." + ) + if raw_index in seen: + raise ValueError(f"SELECTED_PHASES contains duplicate phase index {raw_index}.") + seen.add(raw_index) + selected.append(raw_index) + return selected + + +def phase_fold_indices(phase_index: int) -> tuple[int, int]: + count = phase_count() + if phase_index < 1 or phase_index > count: + raise ValueError(f"Phase index must be in [1, {count}], got {phase_index}.") + val_offset = phase_val_offset() + if val_offset <= 0 or val_offset >= count: + raise ValueError( + f"PHASE_VAL_OFFSET must be in [1, {count - 1}] for {count} phases, got {val_offset}." + ) + test_fold_index = phase_index + val_fold_index = ((phase_index - 1 + val_offset) % count) + 1 + return val_fold_index, test_fold_index + + +def partition_seed() -> int: + if using_fixed_phase_mode(): + return fold_seed(f"phase_partition::{phase_count()}") + return int(base.SEED) + + +def split_generation_display_name() -> str: + if using_fixed_phase_mode(): + return "fixed stratified 10-phase 8/1/1" + return "repeated stratified holdout" + + +def cycle_index_label(index: int) -> str: + return f"{primary_unit_name()}_{int(index):03d}" + + +def cycle_identity_label(index: int) -> str: + return f"{primary_unit_name()}={int(index):03d}" + + +def all_split_repeat_indices() -> list[int]: + if using_fixed_phase_mode(): + return phase_indices() + return list(range(1, int(NUM_STRATIFIED_SPLIT_REPEATS) + 1)) + + +def max_subset_repeat_index() -> int: + return max(int(spec.repeat_count) for spec in percent_specs()) + + +def current_percent_sampling_mode() -> str: + mode = str(PERCENT_SAMPLING_MODE).strip().lower() + if mode not in SUPPORTED_PERCENT_SAMPLING_MODES: + raise ValueError( + f"PERCENT_SAMPLING_MODE must be one of {SUPPORTED_PERCENT_SAMPLING_MODES}, got {mode!r}" + ) + return mode + + +def current_split_execution_mode() -> str: + mode = str(SPLIT_EXECUTION_MODE).strip().lower() + if mode not in SUPPORTED_SPLIT_EXECUTION_MODES: + raise ValueError( + f"SPLIT_EXECUTION_MODE must be one of {SUPPORTED_SPLIT_EXECUTION_MODES}, got {mode!r}" + ) + return mode + + +def current_repeat_execution_mode() -> str: + mode = str(REPEAT_EXECUTION_MODE).strip().lower() + if mode not in SUPPORTED_REPEAT_EXECUTION_MODES: + raise ValueError( + f"REPEAT_EXECUTION_MODE must be one of {SUPPORTED_REPEAT_EXECUTION_MODES}, got {mode!r}" + ) + return mode + + +def current_percent_execution_mode() -> str: + mode = str(PERCENT_EXECUTION_MODE).strip().lower() + if mode not in SUPPORTED_PERCENT_EXECUTION_MODES: + raise ValueError( + f"PERCENT_EXECUTION_MODE must be one of {SUPPORTED_PERCENT_EXECUTION_MODES}, got {mode!r}" + ) + return mode + + +def split_repeat_indices_to_run() -> list[int]: + if using_fixed_phase_mode(): + return phase_execution_indices_to_run() + + split_indices = all_split_repeat_indices() + if current_split_execution_mode() == "auto": + return split_indices + + if not SELECTED_SPLIT_INDICES: + raise ValueError( + "SELECTED_SPLIT_INDICES must be non-empty when SPLIT_EXECUTION_MODE='manual'." + ) + + selected: list[int] = [] + seen: set[int] = set() + max_index = split_indices[-1] + for raw_index in SELECTED_SPLIT_INDICES: + if isinstance(raw_index, bool) or not isinstance(raw_index, int): + raise TypeError( + "SELECTED_SPLIT_INDICES entries must be integer split indices in the " + f"range [1, {max_index}]." + ) + if raw_index < 1 or raw_index > max_index: + raise ValueError( + f"SELECTED_SPLIT_INDICES entries must be in the range [1, {max_index}], got {raw_index}." + ) + if raw_index in seen: + raise ValueError(f"SELECTED_SPLIT_INDICES contains duplicate split index {raw_index}.") + seen.add(raw_index) + selected.append(raw_index) + return selected + + +def subset_repeat_indices_to_run() -> list[int]: + repeat_indices = list(range(1, max_subset_repeat_index() + 1)) + if current_repeat_execution_mode() == "auto": + return repeat_indices + + if not SELECTED_REPEAT_INDICES: + raise ValueError( + "SELECTED_REPEAT_INDICES must be non-empty when REPEAT_EXECUTION_MODE='manual'." + ) + + selected: list[int] = [] + seen: set[int] = set() + max_index = repeat_indices[-1] + for raw_index in SELECTED_REPEAT_INDICES: + if isinstance(raw_index, bool) or not isinstance(raw_index, int): + raise TypeError( + "SELECTED_REPEAT_INDICES entries must be integer repeat indices in the " + f"range [1, {max_index}]." + ) + if raw_index < 1 or raw_index > max_index: + raise ValueError( + f"SELECTED_REPEAT_INDICES entries must be in the range [1, {max_index}], got {raw_index}." + ) + if raw_index in seen: + raise ValueError(f"SELECTED_REPEAT_INDICES contains duplicate repeat index {raw_index}.") + seen.add(raw_index) + selected.append(raw_index) + return selected + + +def percent_specs_to_run() -> list[PercentRepeatSpec]: + all_specs = percent_specs() + if current_percent_execution_mode() == "auto": + return all_specs + + if not SELECTED_DATASET_PERCENTS: + raise ValueError( + "SELECTED_DATASET_PERCENTS must be non-empty when PERCENT_EXECUTION_MODE='manual'." + ) + + all_percent_ints = {spec.percent_int for spec in all_specs} + selected: list[PercentRepeatSpec] = [] + seen: set[int] = set() + for raw_percent in SELECTED_DATASET_PERCENTS: + if isinstance(raw_percent, bool) or not isinstance(raw_percent, int): + raise TypeError( + "SELECTED_DATASET_PERCENTS entries must be integer percentages in the range [1, 100]." + ) + if raw_percent not in all_percent_ints: + raise ValueError( + f"SELECTED_DATASET_PERCENTS entry {raw_percent} is not defined in " + f"DATASET_PERCENT_REPEAT_COUNTS. Available: {sorted(all_percent_ints)}." + ) + if raw_percent in seen: + raise ValueError(f"SELECTED_DATASET_PERCENTS contains duplicate percent {raw_percent}.") + seen.add(raw_percent) + spec_map = {spec.percent_int: spec for spec in all_specs} + for raw_percent in SELECTED_DATASET_PERCENTS: + selected.append(spec_map[raw_percent]) + selected.sort(key=lambda s: s.percent_int) + return selected + + +def validate_repeated_holdout_settings() -> None: + if using_fixed_phase_mode(): + if phase_count() != 10: + raise ValueError( + f"fixed phase mode requires NUM_PHASES=10, got {phase_count()}." + ) + phase_fold_indices(1) + if current_dataset_name() != "BUSI_with_classes": + raise ValueError( + "fixed phase mode currently supports DATASET_NAME='BUSI_with_classes' only." + ) + if current_busi_with_classes_split_policy() != "stratified": + raise ValueError( + "fixed phase mode requires BUSI_WITH_CLASSES_SPLIT_POLICY='stratified'." + ) + if base.SPLIT_TYPE != "80_10_10": + raise ValueError( + f"fixed phase mode requires SPLIT_TYPE='80_10_10', got {base.SPLIT_TYPE!r}." + ) + current_phase_execution_mode() + else: + if int(NUM_STRATIFIED_SPLIT_REPEATS) <= 0: + raise ValueError("NUM_STRATIFIED_SPLIT_REPEATS must be a positive integer.") + current_split_execution_mode() + current_percent_sampling_mode() + current_repeat_execution_mode() + current_percent_execution_mode() + split_repeat_indices_to_run() + subset_repeat_indices_to_run() + selected_percent_specs = percent_specs_to_run() + if using_fixed_phase_mode(): + if len(selected_percent_specs) != 1 or int(selected_percent_specs[0].percent_int) != 100: + raise ValueError( + "fixed phase mode only supports dataset percent 100. " + "If PERCENT_EXECUTION_MODE='manual', set SELECTED_DATASET_PERCENTS=[100]." + ) + + +def repeated_holdout_split_policy() -> str | None: + if base.current_dataset_name() == "BUSI_with_classes": + return base.current_busi_with_classes_split_policy() + return None + + +def active_specs_for_subset_repeat(subset_repeat_index: int) -> list[PercentRepeatSpec]: + return [ + spec + for spec in percent_specs() + if subset_repeat_index <= int(spec.repeat_count) + ] + + +def percent_specs() -> list[PercentRepeatSpec]: + global PERCENT_SPECS_CACHE + if PERCENT_SPECS_CACHE is not None: + return list(PERCENT_SPECS_CACHE) + specs: list[PercentRepeatSpec] = [] + if not DATASET_PERCENT_REPEAT_COUNTS: + raise ValueError("DATASET_PERCENT_REPEAT_COUNTS must contain at least one percentage entry.") + for raw_percent, raw_repeat_count in DATASET_PERCENT_REPEAT_COUNTS.items(): + if isinstance(raw_percent, bool) or not isinstance(raw_percent, int): + raise TypeError( + "DATASET_PERCENT_REPEAT_COUNTS keys must be integer percentages in the range [1, 100]." + ) + if raw_percent <= 0 or raw_percent > 100: + raise ValueError(f"Invalid dataset percent {raw_percent}; expected an integer in [1, 100].") + if isinstance(raw_repeat_count, bool) or int(raw_repeat_count) <= 0: + raise ValueError( + f"Invalid repeat count for percent {raw_percent}: {raw_repeat_count!r}. Expected a positive integer." + ) + repeat_count = int(raw_repeat_count) + if using_fixed_phase_mode() and raw_percent == 100 and repeat_count != 1: + raise ValueError( + "fixed phase mode requires DATASET_PERCENT_REPEAT_COUNTS={100: 1}. " + f"Got repeat_count={repeat_count} for percent 100." + ) + if raw_percent == 100 and repeat_count > 1: + print( + f"[Repeated Holdout] Percent 100 was configured with repeat_count={repeat_count}. " + "Collapsing to one effective repeat per split." + ) + repeat_count = 1 + fraction = float(raw_percent) / 100.0 + specs.append(PercentRepeatSpec(percent_int=raw_percent, fraction=fraction, repeat_count=repeat_count)) + specs.sort(key=lambda item: item.percent_int) + if using_fixed_phase_mode(): + if len(specs) != 1 or int(specs[0].percent_int) != 100: + configured = {spec.percent_int: spec.repeat_count for spec in specs} + raise ValueError( + "fixed phase mode only supports dataset percent 100. " + "Set DATASET_PERCENT_REPEAT_COUNTS={100: 1}. " + f"Got {configured}." + ) + PERCENT_SPECS_CACHE = list(specs) + return list(PERCENT_SPECS_CACHE) + + +def fold_experiment_summary(model_config: base.RuntimeModelConfig) -> None: + if using_fixed_phase_mode(): + base.banner("RUNNER FOLDS | FIXED STRATIFIED 10-PHASE 8/1/1") + else: + base.banner("RUNNER FOLDS | REPEATED STRATIFIED HOLDOUT") + print(f"Experiment name : {FOLDS_EXPERIMENT_NAME}") + print(f"Resume folds : {RESUME_FOLDS}") + print(f"Experiment root : {EXPERIMENT_ROOT}") + print(f"Experiment DB : {EXPERIMENT_DB_PATH}") + print(f"Dataset name : {base.current_dataset_name()}") + print(f"Split type : {base.SPLIT_TYPE}") + print(f"Split generation mode : {current_split_generation_mode()}") + print(f"Generation display : {split_generation_display_name()}") + if using_fixed_phase_mode(): + print(f"Phase count : {phase_count()}") + print(f"Phase val offset : {phase_val_offset()}") + print(f"Phase execution mode : {current_phase_execution_mode()}") + print("Train percent mode : 100% of phase-train only") + if current_phase_execution_mode() == "manual": + print(f"Selected phases : {phase_execution_indices_to_run()}") + else: + print(f"Split repeats : {NUM_STRATIFIED_SPLIT_REPEATS}") + print(f"Split execution mode : {current_split_execution_mode()}") + if current_split_execution_mode() == "manual": + print(f"Selected split indices: {split_repeat_indices_to_run()}") + print(f"Sampling mode : {current_percent_sampling_mode()}") + print(f"Repeat execution mode : {current_repeat_execution_mode()}") + if current_repeat_execution_mode() == "manual": + print(f"Selected repeat idxs : {subset_repeat_indices_to_run()}") + print(f"Percent execution mode: {current_percent_execution_mode()}") + if current_percent_execution_mode() == "manual": + print(f"Selected percents : {[s.percent_int for s in percent_specs_to_run()]}") + print(f"Strategies : {base.STRATEGIES}") + print( + "Percent repeats : " + + ", ".join(f"{spec.percent_int}% x{spec.repeat_count}" for spec in percent_specs()) + ) + print(f"Execution mode : {base.EXECUTION_MODE}") + print(f"Run smoke test : {base.RUN_SMOKE_TEST}") + print(f"Test iter control : {base.TEST_ITERATION_CONTROL}") + print(f"Test iter target t : {base.TEST_ITERATION_T}") + print(f"Run overfit test : {base.RUN_OVERFIT_TEST}") + print(f"Run Optuna : {base.RUN_OPTUNA}") + print(f"Load existing studies : {base.LOAD_EXISTING_STUDIES}") + print(f"Repo backup enabled : {ASYNC_REPO_BACKUP_AFTER_PHASE}") + if ASYNC_REPO_BACKUP_AFTER_PHASE: + print(f"Repo backup target : hf://{HF_REPO_TYPE}/{HF_REPO_ID or ''}") + print(f"Repo backup cadence : every {HF_BACKUP_EVERY_N_PHASES} phases") + print(f"Initial backup on run : {HF_BACKUP_ON_START}") + print(f"Phase timing summary : {_phase_timing_summary_path()}") + print(f"Backbone : {model_config.backbone_display_name()}") + + +def config_snapshot(model_config: base.RuntimeModelConfig) -> dict[str, Any]: + base_config = { + name: _jsonify(getattr(base, name)) + for name in sorted(dir(base)) + if name.isupper() and not name.startswith("_") + and name not in RUNTIME_ONLY_CONFIG_KEYS + } + return { + "folds_runner": { + "SPLIT_GENERATION_MODE": current_split_generation_mode(), + "NUM_STRATIFIED_SPLIT_REPEATS": int(NUM_STRATIFIED_SPLIT_REPEATS), + "NUM_PHASES": int(NUM_PHASES), + "PHASE_VAL_OFFSET": int(PHASE_VAL_OFFSET), + "DATASET_PERCENT_REPEAT_COUNTS": _jsonify(DATASET_PERCENT_REPEAT_COUNTS), + "PERCENT_SAMPLING_MODE": current_percent_sampling_mode(), + "FOLDS_EXPERIMENT_NAME": str(FOLDS_EXPERIMENT_NAME), + "RESUME_FOLDS": bool(RESUME_FOLDS), + "REPEATED_HOLDOUT_ROOT": str(REPEATED_HOLDOUT_ROOT), + "EXPERIMENT_ROOT": str(EXPERIMENT_ROOT), + "EXPERIMENT_DB_PATH": str(EXPERIMENT_DB_PATH), + }, + "runner": base_config, + "model_config": model_config.to_payload(), + } + + +def portable_config_snapshot_for_fingerprint(snapshot: dict[str, Any]) -> dict[str, Any]: + portable = json.loads(json.dumps(snapshot, sort_keys=True)) + folds_runner = portable.get("folds_runner") + if isinstance(folds_runner, dict): + for key in PORTABLE_FINGERPRINT_FOLD_KEYS: + folds_runner.pop(key, None) + return portable + + +def config_fingerprint(snapshot: dict[str, Any]) -> str: + return stable_hash(json.dumps(portable_config_snapshot_for_fingerprint(snapshot), sort_keys=True)) + + +def dataset_fingerprint(sample_records: list[dict[str, str]]) -> str: + payload = { + "dataset_name": base.current_dataset_name(), + "records": [ + { + "filename": record["filename"], + "image_rel_path": record["image_rel_path"], + "mask_rel_path": record["mask_rel_path"], + "class_label": record.get("class_label"), + } + for record in sample_records + ], + } + return stable_hash(json.dumps(payload, sort_keys=True)) + + +def cycle_dirname(split_repeat_index: int) -> str: + return f"{primary_unit_name()}_{split_repeat_index:03d}" + + +def split_manifest_path(split_repeat_index: int) -> Path: + return SPLIT_MANIFESTS_DIR / f"{cycle_dirname(split_repeat_index)}.json" + + +def subset_manifest_path(split_repeat_index: int, percent_int: int, subset_repeat_index: int) -> Path: + return SUBSET_MANIFESTS_DIR / ( + f"{cycle_dirname(split_repeat_index)}_pct_{percent_int:03d}_repeat_{subset_repeat_index:02d}.json" + ) + + +def repeat_root(split_repeat_index: int, percent_int: int, subset_repeat_index: int) -> Path: + return ( + EXPERIMENT_ROOT + / cycle_dirname(split_repeat_index) + / f"pct_{percent_int:03d}" + / f"repeat_{subset_repeat_index:02d}" + ) + + +def run_dir_for(strategy: int, ctx: FoldRunContext, model_config: base.RuntimeModelConfig | None = None) -> Path: + strategy_dir = base.strategy_dir_name(strategy, model_config) + return ensure_dir(ctx.repeat_root / strategy_dir / "final") + + +def overfit_root_for(strategy: int, ctx: FoldRunContext, model_config: base.RuntimeModelConfig | None = None) -> Path: + strategy_dir = base.strategy_dir_name(strategy, model_config) + return ensure_dir(ctx.repeat_root / strategy_dir / "overfit_test") + + +def strategy_root_for(strategy: int, ctx: FoldRunContext, model_config: base.RuntimeModelConfig | None = None) -> Path: + strategy_dir = base.strategy_dir_name(strategy, model_config) + return ensure_dir(ctx.repeat_root / strategy_dir) + + +def fold_study_paths_for(strategy: int, ctx: FoldRunContext, model_config: base.RuntimeModelConfig | None = None) -> tuple[Path, Path, Path]: + strategy_root = strategy_root_for(strategy, ctx, model_config) + return strategy_root, ensure_dir(strategy_root / "study"), ensure_dir(strategy_root / "trials") + + +def select_sample_records() -> tuple[list[dict[str, str]], Path]: + dataset_name = base.current_dataset_name() + images_dir, annotations_dir = base.current_dataset_dirs() + if not images_dir.exists() or not annotations_dir.exists(): + raise FileNotFoundError( + f"Expected dataset directories for {dataset_name} under {base.DATA_ROOT}: " + f"images={images_dir}, masks={annotations_dir}" + ) + + matched, missing_masks, missing_images = base.validate_image_mask_consistency(images_dir, annotations_dir) + if missing_masks or missing_images: + raise RuntimeError( + "BUSI image/mask mismatch detected. " + f"missing_masks={len(missing_masks)}, missing_images={len(missing_images)}" + ) + + dataset_root = images_dir.parent.resolve() + sample_records = base.build_sample_records( + matched, + images_subdir=images_dir.relative_to(dataset_root).as_posix(), + annotations_subdir=annotations_dir.relative_to(dataset_root).as_posix(), + dataset_name=dataset_name, + ) + if dataset_name == "BUSI_with_classes": + pipeline_check_path = base.current_pipeline_check_path() + if pipeline_check_path is not None: + base.validate_busi_with_classes_pipeline_report(pipeline_check_path, sample_records) + return sample_records, dataset_root + + +def record_filenames(records: list[dict[str, str]]) -> list[str]: + return [str(record["filename"]) for record in records] + + +def duplicate_filenames(records: list[dict[str, str]]) -> list[str]: + counts = Counter(record_filenames(records)) + return sorted(name for name, count in counts.items() if count > 1) + + +def format_filename_preview(filenames: list[str], *, limit: int = 5) -> str: + preview = filenames[:limit] + suffix = "" if len(filenames) <= limit else f" ... (+{len(filenames) - limit} more)" + return f"{preview}{suffix}" + + +def overlap_preview(leaks: dict[str, list[str]], *, limit: int = 5) -> str: + if not leaks: + return "[]" + key = sorted(leaks.keys())[0] + return f"{key}: {format_filename_preview(leaks[key], limit=limit)}" + + +def validate_disjoint_record_sets( + record_sets: dict[str, list[dict[str, str]]], + *, + context: str, + expected_filenames: set[str] | None = None, +) -> None: + split_filenames: dict[str, list[str]] = {} + for split_name, records in record_sets.items(): + duplicates = duplicate_filenames(records) + if duplicates: + raise RuntimeError( + f"Duplicate filenames detected inside {context} {split_name}: " + f"{format_filename_preview(duplicates)}" + ) + split_filenames[split_name] = record_filenames(records) + + leaks = base.check_data_leakage(split_filenames) + if leaks: + raise RuntimeError( + f"Data leakage detected for {context}: {overlap_preview(leaks)}" + ) + + if expected_filenames is not None: + actual_filenames = set().union(*(set(values) for values in split_filenames.values())) + missing = sorted(expected_filenames - actual_filenames) + extra = sorted(actual_filenames - expected_filenames) + if missing or extra: + details: list[str] = [] + if missing: + details.append(f"missing={format_filename_preview(missing)}") + if extra: + details.append(f"extra={format_filename_preview(extra)}") + raise RuntimeError( + f"{context} does not match the expected dataset membership: {'; '.join(details)}" + ) + + +def validate_fixed_phase_dataset_requirements(sample_records: list[dict[str, str]]) -> None: + class_distribution = base.compute_class_distribution(sample_records) + if class_distribution is None: + raise RuntimeError( + "fixed phase mode requires class-aware records with class_label metadata." + ) + insufficient = { + label: int(count) + for label, count in class_distribution.items() + if int(count) < phase_count() + } + if insufficient: + raise RuntimeError( + "fixed phase mode requires enough samples to place every class in every phase. " + f"Need >= {phase_count()} samples per class, got {insufficient}." + ) + + +def build_fixed_stratified_phase_folds( + sample_records: list[dict[str, str]], + *, + seed: int, +) -> dict[int, list[dict[str, str]]]: + folds: dict[int, list[dict[str, str]]] = {index: [] for index in phase_indices()} + grouped = base.group_records_by_class(sample_records) + for class_label in sorted(grouped.keys()): + records = base.deterministic_shuffle_records( + grouped[class_label], + seed=seed, + tag=f"phase_partition::{phase_count()}::{class_label}", + ) + for record_index, record in enumerate(records): + fold_index = (record_index % phase_count()) + 1 + folds[fold_index].append(dict(record)) + + for fold_index in phase_indices(): + folds[fold_index] = base.deterministic_shuffle_records( + folds[fold_index], + seed=seed, + tag=f"phase_partition::{phase_count()}::fold::{fold_index:03d}", + ) + return folds + + +def validate_fixed_phase_folds( + phase_folds: dict[int, list[dict[str, str]]], + *, + sample_records: list[dict[str, str]], +) -> None: + if sorted(phase_folds.keys()) != phase_indices(): + raise RuntimeError( + f"Expected fixed phase folds for indices {phase_indices()}, got {sorted(phase_folds.keys())}." + ) + validate_disjoint_record_sets( + {f"fold_{fold_index:03d}": records for fold_index, records in sorted(phase_folds.items())}, + context="fixed phase fold partition", + expected_filenames={record["filename"] for record in sample_records}, + ) + + +def build_phase_base_split( + phase_folds: dict[int, list[dict[str, str]]], + *, + phase_index: int, + seed: int, +) -> dict[str, list[dict[str, str]]]: + val_fold_index, test_fold_index = phase_fold_indices(phase_index) + train_records: list[dict[str, str]] = [] + for fold_index in phase_indices(): + if fold_index in {val_fold_index, test_fold_index}: + continue + train_records.extend(dict(record) for record in phase_folds[fold_index]) + return { + "train": base.deterministic_shuffle_records( + train_records, + seed=seed, + tag=f"phase::{phase_index:03d}::train", + ), + "val": base.deterministic_shuffle_records( + phase_folds[val_fold_index], + seed=seed, + tag=f"phase::{phase_index:03d}::val", + ), + "test": base.deterministic_shuffle_records( + phase_folds[test_fold_index], + seed=seed, + tag=f"phase::{phase_index:03d}::test", + ), + } + + +def build_base_split_for_repeat(sample_records: list[dict[str, str]], split_seed: int) -> dict[str, list[dict[str, str]]]: + dataset_name = base.current_dataset_name() + if dataset_name == "BUSI_with_classes": + split_policy = repeated_holdout_split_policy() + if split_policy != "stratified": + raise ValueError( + "RUNNER_FOLDS.py requires BUSI_with_classes to use BUSI_WITH_CLASSES_SPLIT_POLICY='stratified'." + ) + return base.build_stratified_base_split( + sample_records, + split_type=base.SPLIT_TYPE, + seed=split_seed, + ) + return base.build_unstratified_base_split( + sample_records, + split_type=base.SPLIT_TYPE, + seed=split_seed, + ) + + +def validate_base_split( + base_splits: dict[str, list[dict[str, str]]], + *, + split_repeat_index: int, + expected_filenames: set[str] | None = None, +) -> None: + context = f"{primary_unit_name()}={split_repeat_index:03d}" + validate_disjoint_record_sets( + base_splits, + context=context, + expected_filenames=expected_filenames, + ) + + +def validate_phase_coverage( + phase_splits_by_index: dict[int, dict[str, list[dict[str, str]]]], + *, + sample_records: list[dict[str, str]], +) -> None: + expected_phase_indices = phase_indices() + if sorted(phase_splits_by_index.keys()) != expected_phase_indices: + raise RuntimeError( + f"Expected materialized phases {expected_phase_indices}, got {sorted(phase_splits_by_index.keys())}." + ) + + expected_filenames = {record["filename"] for record in sample_records} + train_counts: Counter[str] = Counter() + val_counts: Counter[str] = Counter() + test_counts: Counter[str] = Counter() + + for phase_index, phase_splits in sorted(phase_splits_by_index.items()): + validate_disjoint_record_sets( + phase_splits, + context=f"phase={phase_index:03d}", + expected_filenames=expected_filenames, + ) + train_counts.update(record_filenames(phase_splits["train"])) + val_counts.update(record_filenames(phase_splits["val"])) + test_counts.update(record_filenames(phase_splits["test"])) + + expected_counts = { + "train": phase_count() - 2, + "val": 1, + "test": 1, + } + counters_by_name = { + "train": train_counts, + "val": val_counts, + "test": test_counts, + } + for split_name, expected_count in expected_counts.items(): + offending = sorted( + filename + for filename in expected_filenames + if int(counters_by_name[split_name].get(filename, 0)) != expected_count + ) + if offending: + raise RuntimeError( + f"Invalid global phase coverage for {split_name}: expected each filename to appear " + f"{expected_count} time(s), offenders={format_filename_preview(offending)}" + ) + + +def build_subset_for_repeat( + train_records: list[dict[str, str]], + *, + percent_fraction: float, + subset_seed: int, +) -> list[dict[str, str]]: + if percent_fraction >= 1.0: + return [dict(record) for record in train_records] + subsets = base.build_nested_train_subsets( + train_records, + [percent_fraction], + split_type=base.SPLIT_TYPE, + seed=subset_seed, + split_policy=repeated_holdout_split_policy(), + subset_variant=0, + ) + return subsets[base.percent_label(percent_fraction)] + + +def build_incremental_subset_chain( + train_records: list[dict[str, str]], + *, + active_specs: list[PercentRepeatSpec], + subset_seed: int, +) -> dict[str, list[dict[str, str]]]: + fractions = [spec.fraction for spec in active_specs] + return base.build_nested_train_subsets( + train_records, + fractions, + split_type=base.SPLIT_TYPE, + seed=subset_seed, + split_policy=repeated_holdout_split_policy(), + subset_variant=0, + ) + + +def iter_manifested_contexts( + split_repeat_indices: list[int] | None = None, + subset_repeat_indices: list[int] | None = None, +) -> Iterator[FoldRunContext]: + selected_indices = all_split_repeat_indices() if split_repeat_indices is None else list(split_repeat_indices) + selected_subset_repeats = ( + subset_repeat_indices_to_run() if subset_repeat_indices is None else list(subset_repeat_indices) + ) + selected_subset_repeat_set = set(selected_subset_repeats) + for split_repeat_index in selected_indices: + for spec in percent_specs_to_run(): + for subset_repeat_index in range(1, int(spec.repeat_count) + 1): + if subset_repeat_index not in selected_subset_repeat_set: + continue + yield load_context(split_repeat_index, spec.percent_int, subset_repeat_index) + + +def validate_subset_records( + train_records: list[dict[str, str]], + subset_records: list[dict[str, str]], + *, + split_repeat_index: int, + percent_int: int, + subset_repeat_index: int, +) -> None: + train_filenames = {record["filename"] for record in train_records} + subset_filenames = [record["filename"] for record in subset_records] + cycle_context = f"{primary_unit_name()}={split_repeat_index:03d}" + if len(subset_filenames) != len(set(subset_filenames)): + raise RuntimeError( + f"Duplicate filenames found in subset {cycle_context}, " + f"percent={percent_int}, repeat={subset_repeat_index}." + ) + outside_train = sorted(set(subset_filenames) - train_filenames) + if outside_train: + raise RuntimeError( + f"Subset contains filenames outside the base train split for " + f"{cycle_context}, percent={percent_int}, repeat={subset_repeat_index}: {outside_train[:5]}" + ) + + +"""============================================================================= +SQLITE LEDGER +============================================================================= +""" + + +def require_ledger() -> sqlite3.Connection: + if LEDGER_CONN is None: + raise RuntimeError("Ledger is not initialized.") + return LEDGER_CONN + + +def ledger_execute(sql: str, params: tuple[Any, ...] = ()) -> sqlite3.Cursor: + conn = require_ledger() + cursor = conn.execute(sql, params) + conn.commit() + return cursor + + +def setup_ledger(path: Path) -> sqlite3.Connection: + ensure_dir(path.parent) + conn = sqlite3.connect(path) + conn.row_factory = sqlite3.Row + conn.execute("PRAGMA journal_mode=WAL") + conn.execute("PRAGMA synchronous=FULL") + conn.execute( + """ + CREATE TABLE IF NOT EXISTS experiment_meta ( + experiment_name TEXT PRIMARY KEY, + config_fingerprint TEXT NOT NULL, + config_json TEXT NOT NULL, + dataset_fingerprint TEXT NOT NULL, + base_seed INTEGER NOT NULL, + created_at TEXT NOT NULL + ) + """ + ) + conn.execute( + """ + CREATE TABLE IF NOT EXISTS split_manifests ( + split_repeat_index INTEGER PRIMARY KEY, + split_seed INTEGER NOT NULL, + manifest_path TEXT NOT NULL, + train_count INTEGER NOT NULL, + val_count INTEGER NOT NULL, + test_count INTEGER NOT NULL, + config_fingerprint TEXT NOT NULL, + dataset_fingerprint TEXT NOT NULL, + created_at TEXT NOT NULL + ) + """ + ) + conn.execute( + """ + CREATE TABLE IF NOT EXISTS subset_manifests ( + split_repeat_index INTEGER NOT NULL, + dataset_percent INTEGER NOT NULL, + subset_repeat_index INTEGER NOT NULL, + subset_seed INTEGER NOT NULL, + manifest_path TEXT NOT NULL, + train_subset_count INTEGER NOT NULL, + config_fingerprint TEXT NOT NULL, + dataset_fingerprint TEXT NOT NULL, + created_at TEXT NOT NULL, + PRIMARY KEY (split_repeat_index, dataset_percent, subset_repeat_index) + ) + """ + ) + conn.execute( + """ + CREATE TABLE IF NOT EXISTS run_status ( + split_repeat_index INTEGER NOT NULL, + dataset_percent INTEGER NOT NULL, + subset_repeat_index INTEGER NOT NULL, + strategy INTEGER NOT NULL, + dataset_fraction REAL NOT NULL, + split_seed INTEGER NOT NULL, + subset_seed INTEGER NOT NULL, + split_manifest_path TEXT NOT NULL, + subset_manifest_path TEXT NOT NULL, + run_dir TEXT NOT NULL, + status TEXT NOT NULL, + stage TEXT NOT NULL, + attempt_count INTEGER NOT NULL DEFAULT 0, + started_at TEXT, + updated_at TEXT NOT NULL, + heartbeat_at TEXT, + completed_at TEXT, + last_epoch INTEGER, + latest_checkpoint_path TEXT, + best_checkpoint_path TEXT, + evaluation_path TEXT, + best_metric_name TEXT, + best_metric_value REAL, + elapsed_seconds REAL, + error_text TEXT, + PRIMARY KEY (split_repeat_index, dataset_percent, subset_repeat_index, strategy) + ) + """ + ) + conn.execute( + """ + CREATE TABLE IF NOT EXISTS final_metrics ( + split_repeat_index INTEGER NOT NULL, + dataset_percent INTEGER NOT NULL, + subset_repeat_index INTEGER NOT NULL, + strategy INTEGER NOT NULL, + metric_name TEXT NOT NULL, + mean REAL NOT NULL, + std REAL, + run_dir TEXT NOT NULL, + evaluation_path TEXT NOT NULL, + PRIMARY KEY (split_repeat_index, dataset_percent, subset_repeat_index, strategy, metric_name) + ) + """ + ) + conn.commit() + return conn + + +def fetch_one(sql: str, params: tuple[Any, ...]) -> sqlite3.Row | None: + return require_ledger().execute(sql, params).fetchone() + + +def load_run_status(key: RunKey) -> sqlite3.Row | None: + return fetch_one( + """ + SELECT * + FROM run_status + WHERE split_repeat_index = ? + AND dataset_percent = ? + AND subset_repeat_index = ? + AND strategy = ? + """, + (key.split_repeat_index, key.dataset_percent, key.subset_repeat_index, key.strategy), + ) + + +def upsert_experiment_meta( + *, + snapshot: dict[str, Any], + config_hash: str, + data_hash: str, +) -> None: + ledger_execute( + """ + INSERT OR REPLACE INTO experiment_meta ( + experiment_name, + config_fingerprint, + config_json, + dataset_fingerprint, + base_seed, + created_at + ) VALUES (?, ?, ?, ?, ?, ?) + """, + ( + FOLDS_EXPERIMENT_NAME, + config_hash, + json.dumps(snapshot, sort_keys=True), + data_hash, + int(base.SEED), + now_utc_iso(), + ), + ) + + +def existing_experiment_meta() -> sqlite3.Row | None: + return fetch_one( + "SELECT * FROM experiment_meta WHERE experiment_name = ?", + (FOLDS_EXPERIMENT_NAME,), + ) + + +def ledger_row_count(table_name: str) -> int: + row = require_ledger().execute(f"SELECT COUNT(*) AS count FROM {table_name}").fetchone() + return int(row["count"]) if row is not None else 0 + + +def upsert_split_manifest_row( + *, + split_repeat_index: int, + split_seed: int, + manifest_path: Path, + train_count: int, + val_count: int, + test_count: int, + config_hash: str, + data_hash: str, +) -> None: + ledger_execute( + """ + INSERT OR REPLACE INTO split_manifests ( + split_repeat_index, + split_seed, + manifest_path, + train_count, + val_count, + test_count, + config_fingerprint, + dataset_fingerprint, + created_at + ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?) + """, + ( + split_repeat_index, + split_seed, + str(manifest_path.resolve()), + train_count, + val_count, + test_count, + config_hash, + data_hash, + now_utc_iso(), + ), + ) + + +def upsert_subset_manifest_row( + *, + split_repeat_index: int, + percent_int: int, + subset_repeat_index: int, + subset_seed: int, + manifest_path: Path, + subset_count: int, + config_hash: str, + data_hash: str, +) -> None: + ledger_execute( + """ + INSERT OR REPLACE INTO subset_manifests ( + split_repeat_index, + dataset_percent, + subset_repeat_index, + subset_seed, + manifest_path, + train_subset_count, + config_fingerprint, + dataset_fingerprint, + created_at + ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?) + """, + ( + split_repeat_index, + percent_int, + subset_repeat_index, + subset_seed, + str(manifest_path.resolve()), + subset_count, + config_hash, + data_hash, + now_utc_iso(), + ), + ) + + +def upsert_run_plan_row( + *, + key: RunKey, + dataset_fraction: float, + split_seed: int, + subset_seed: int, + split_manifest: Path, + subset_manifest: Path, + run_dir: Path, +) -> None: + existing = load_run_status(key) + if existing is not None: + return + ledger_execute( + """ + INSERT INTO run_status ( + split_repeat_index, + dataset_percent, + subset_repeat_index, + strategy, + dataset_fraction, + split_seed, + subset_seed, + split_manifest_path, + subset_manifest_path, + run_dir, + status, + stage, + attempt_count, + updated_at + ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) + """, + ( + key.split_repeat_index, + key.dataset_percent, + key.subset_repeat_index, + key.strategy, + dataset_fraction, + split_seed, + subset_seed, + str(split_manifest.resolve()), + str(subset_manifest.resolve()), + str(run_dir.resolve()), + "planned", + "manifested", + 0, + now_utc_iso(), + ), + ) + + +def mark_stale_running_as_interrupted() -> None: + ledger_execute( + """ + UPDATE run_status + SET status = 'interrupted', + updated_at = ? + WHERE status = 'running' + """, + (now_utc_iso(),), + ) + + +def mark_run_running(key: RunKey, *, stage: str) -> None: + row = load_run_status(key) + attempt_count = 1 if row is None else int(row["attempt_count"]) + 1 + started_at = row["started_at"] if row is not None else None + if not started_at: + started_at = now_utc_iso() + ledger_execute( + """ + UPDATE run_status + SET status = 'running', + stage = ?, + attempt_count = ?, + started_at = ?, + updated_at = ?, + heartbeat_at = ?, + error_text = NULL + WHERE split_repeat_index = ? + AND dataset_percent = ? + AND subset_repeat_index = ? + AND strategy = ? + """, + ( + stage, + attempt_count, + started_at, + now_utc_iso(), + now_utc_iso(), + key.split_repeat_index, + key.dataset_percent, + key.subset_repeat_index, + key.strategy, + ), + ) + + +def mark_run_stage(key: RunKey, *, stage: str) -> None: + ledger_execute( + """ + UPDATE run_status + SET stage = ?, + status = 'running', + updated_at = ?, + heartbeat_at = ? + WHERE split_repeat_index = ? + AND dataset_percent = ? + AND subset_repeat_index = ? + AND strategy = ? + """, + ( + stage, + now_utc_iso(), + now_utc_iso(), + key.split_repeat_index, + key.dataset_percent, + key.subset_repeat_index, + key.strategy, + ), + ) + + +def update_run_checkpoint_progress( + key: RunKey, + *, + checkpoint_path: Path, + epoch: int, + best_metric_name: str, + best_metric_value: float, + elapsed_seconds: float, +) -> None: + column_name = "best_checkpoint_path" if checkpoint_path.name == "best.pt" else "latest_checkpoint_path" + sql = f""" + UPDATE run_status + SET {column_name} = ?, + last_epoch = ?, + best_metric_name = ?, + best_metric_value = ?, + elapsed_seconds = ?, + status = 'running', + stage = 'training', + heartbeat_at = ?, + updated_at = ? + WHERE split_repeat_index = ? + AND dataset_percent = ? + AND subset_repeat_index = ? + AND strategy = ? + """ + ledger_execute( + sql, + ( + str(checkpoint_path.resolve()), + int(epoch), + str(best_metric_name), + float(best_metric_value), + float(elapsed_seconds), + now_utc_iso(), + now_utc_iso(), + key.split_repeat_index, + key.dataset_percent, + key.subset_repeat_index, + key.strategy, + ), + ) + + +def mark_run_failed(key: RunKey, error_text: str) -> None: + ledger_execute( + """ + UPDATE run_status + SET status = 'failed', + updated_at = ?, + error_text = ? + WHERE split_repeat_index = ? + AND dataset_percent = ? + AND subset_repeat_index = ? + AND strategy = ? + """, + ( + now_utc_iso(), + error_text, + key.split_repeat_index, + key.dataset_percent, + key.subset_repeat_index, + key.strategy, + ), + ) + + +def mark_run_interrupted(key: RunKey) -> None: + ledger_execute( + """ + UPDATE run_status + SET status = 'interrupted', + updated_at = ? + WHERE split_repeat_index = ? + AND dataset_percent = ? + AND subset_repeat_index = ? + AND strategy = ? + """, + ( + now_utc_iso(), + key.split_repeat_index, + key.dataset_percent, + key.subset_repeat_index, + key.strategy, + ), + ) + + +def ingest_evaluation_into_db(key: RunKey, evaluation_path: Path, run_dir: Path) -> None: + payload = base.load_json(evaluation_path) + metrics = payload.get("metrics", {}) + ledger_execute( + """ + DELETE FROM final_metrics + WHERE split_repeat_index = ? + AND dataset_percent = ? + AND subset_repeat_index = ? + AND strategy = ? + """, + (key.split_repeat_index, key.dataset_percent, key.subset_repeat_index, key.strategy), + ) + conn = require_ledger() + for metric_name, metric_payload in metrics.items(): + conn.execute( + """ + INSERT INTO final_metrics ( + split_repeat_index, + dataset_percent, + subset_repeat_index, + strategy, + metric_name, + mean, + std, + run_dir, + evaluation_path + ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?) + """, + ( + key.split_repeat_index, + key.dataset_percent, + key.subset_repeat_index, + key.strategy, + str(metric_name), + float(metric_payload.get("mean", 0.0)), + float(metric_payload.get("std")) if metric_payload.get("std") is not None else None, + str(run_dir.resolve()), + str(evaluation_path.resolve()), + ), + ) + conn.commit() + best_metric_name = str(payload.get("best_metric_name", "")) + best_metric_value = None + if best_metric_name and best_metric_name in metrics: + best_metric_value = float(metrics[best_metric_name]["mean"]) + ledger_execute( + """ + UPDATE run_status + SET status = 'completed', + stage = 'done', + evaluation_path = ?, + best_metric_name = COALESCE(?, best_metric_name), + best_metric_value = COALESCE(?, best_metric_value), + completed_at = ?, + updated_at = ?, + heartbeat_at = ?, + error_text = NULL + WHERE split_repeat_index = ? + AND dataset_percent = ? + AND subset_repeat_index = ? + AND strategy = ? + """, + ( + str(evaluation_path.resolve()), + best_metric_name or None, + best_metric_value, + now_utc_iso(), + now_utc_iso(), + now_utc_iso(), + key.split_repeat_index, + key.dataset_percent, + key.subset_repeat_index, + key.strategy, + ), + ) + + +def completed_run_rows() -> list[sqlite3.Row]: + return list( + require_ledger().execute( + """ + SELECT * + FROM run_status + WHERE status = 'completed' + ORDER BY split_repeat_index, dataset_percent, subset_repeat_index, strategy + """ + ).fetchall() + ) + + +def metric_rows_for_completed_runs() -> list[sqlite3.Row]: + return list( + require_ledger().execute( + """ + SELECT + rs.split_repeat_index, + rs.dataset_percent, + rs.subset_repeat_index, + rs.strategy, + rs.run_dir, + rs.split_manifest_path, + rs.subset_manifest_path, + rs.evaluation_path, + fm.metric_name, + fm.mean AS metric_mean, + fm.std AS metric_std + FROM final_metrics fm + JOIN run_status rs + ON rs.split_repeat_index = fm.split_repeat_index + AND rs.dataset_percent = fm.dataset_percent + AND rs.subset_repeat_index = fm.subset_repeat_index + AND rs.strategy = fm.strategy + WHERE rs.status = 'completed' + ORDER BY rs.split_repeat_index, rs.dataset_percent, rs.subset_repeat_index, rs.strategy, fm.metric_name + """ + ).fetchall() + ) + + +def export_stats() -> None: + ensure_dir(EXPORTS_DIR) + rows = metric_rows_for_completed_runs() + split_manifest_cache: dict[str, dict[str, Any]] = {} + + def split_manifest_payload(path_text: str) -> dict[str, Any]: + cached = split_manifest_cache.get(path_text) + if cached is None: + cached = base.load_json(Path(path_text)) + split_manifest_cache[path_text] = cached + return cached + + raw_rows_by_run: dict[tuple[int, int, int, int], dict[str, Any]] = {} + for row in rows: + key = ( + int(row["split_repeat_index"]), + int(row["dataset_percent"]), + int(row["subset_repeat_index"]), + int(row["strategy"]), + ) + manifest_payload = split_manifest_payload(str(row["split_manifest_path"])) + raw_row = raw_rows_by_run.setdefault( + key, + { + "split_repeat_index": int(row["split_repeat_index"]), + "dataset_percent": int(row["dataset_percent"]), + "subset_repeat_index": int(row["subset_repeat_index"]), + "strategy": int(row["strategy"]), + "run_dir": row["run_dir"], + "split_manifest_path": row["split_manifest_path"], + "subset_manifest_path": row["subset_manifest_path"], + "evaluation_path": row["evaluation_path"], + "split_generation_mode": str( + manifest_payload.get("split_generation_mode", current_split_generation_mode()) + ), + }, + ) + if manifest_payload.get("phase_index") is not None: + raw_row["phase_index"] = int(manifest_payload["phase_index"]) + raw_row["phase_val_fold_index"] = int(manifest_payload["phase_val_fold_index"]) + raw_row["phase_test_fold_index"] = int(manifest_payload["phase_test_fold_index"]) + raw_row[f"{row['metric_name']}_mean"] = float(row["metric_mean"]) + raw_row[f"{row['metric_name']}_std"] = ( + float(row["metric_std"]) if row["metric_std"] is not None else None + ) + + raw_rows = list(raw_rows_by_run.values()) + raw_rows.sort( + key=lambda item: ( + item["split_repeat_index"], + item["dataset_percent"], + item["subset_repeat_index"], + item["strategy"], + ) + ) + + if raw_rows: + raw_fieldnames = sorted({key for row in raw_rows for key in row.keys()}) + with tempfile.NamedTemporaryFile("w", encoding="utf-8", newline="", delete=False, dir=str(EXPORTS_DIR)) as handle: + writer = csv.DictWriter(handle, fieldnames=raw_fieldnames) + writer.writeheader() + writer.writerows(raw_rows) + handle.flush() + os.fsync(handle.fileno()) + tmp_csv = Path(handle.name) + os.replace(tmp_csv, EXPORTS_DIR / "raw_run_metrics.csv") + atomic_save_json(EXPORTS_DIR / "raw_run_metrics.json", raw_rows) + else: + atomic_write_text(EXPORTS_DIR / "raw_run_metrics.csv", "") + atomic_save_json(EXPORTS_DIR / "raw_run_metrics.json", []) + + grouped: dict[tuple[int, int], dict[str, Any]] = {} + for row in rows: + group_key = (int(row["dataset_percent"]), int(row["strategy"])) + manifest_payload = split_manifest_payload(str(row["split_manifest_path"])) + bucket = grouped.setdefault( + group_key, + { + "dataset_percent": int(row["dataset_percent"]), + "strategy": int(row["strategy"]), + "split_generation_mode": str( + manifest_payload.get("split_generation_mode", current_split_generation_mode()) + ), + "_phase_indices": set(), + "_metric_values": {}, + }, + ) + if manifest_payload.get("phase_index") is not None: + bucket["_phase_indices"].add(int(manifest_payload["phase_index"])) + bucket["_metric_values"].setdefault(str(row["metric_name"]), []).append( + { + "mean": float(row["metric_mean"]), + "std": float(row["metric_std"]) if row["metric_std"] is not None else None, + } + ) + + aggregated_rows: list[dict[str, Any]] = [] + for (_percent_int, _strategy), bucket in sorted(grouped.items()): + row = { + "dataset_percent": bucket["dataset_percent"], + "strategy": bucket["strategy"], + "split_generation_mode": bucket["split_generation_mode"], + } + metric_values: dict[str, list[dict[str, float | None]]] = bucket["_metric_values"] + row["n_runs"] = max((len(values) for values in metric_values.values()), default=0) + if bucket["_phase_indices"]: + phase_indices = sorted(int(value) for value in bucket["_phase_indices"]) + row["completed_phase_count"] = len(phase_indices) + row["completed_phases"] = ",".join(str(value) for value in phase_indices) + for metric_name, values in sorted(metric_values.items()): + means = [value["mean"] for value in values] + stds = [value["std"] for value in values if value["std"] is not None] + row[f"{metric_name}_mean"] = float(base.np.mean(means)) if means else None + row[f"{metric_name}_std"] = float(base.np.std(means)) if means else None + row[f"{metric_name}_within_run_std_mean"] = float(base.np.mean(stds)) if stds else None + aggregated_rows.append(row) + + if aggregated_rows: + aggregated_fieldnames = sorted({key for row in aggregated_rows for key in row.keys()}) + with tempfile.NamedTemporaryFile("w", encoding="utf-8", newline="", delete=False, dir=str(EXPORTS_DIR)) as handle: + writer = csv.DictWriter(handle, fieldnames=aggregated_fieldnames) + writer.writeheader() + writer.writerows(aggregated_rows) + handle.flush() + os.fsync(handle.fileno()) + tmp_csv = Path(handle.name) + os.replace(tmp_csv, EXPORTS_DIR / "aggregated_metrics_by_percent_strategy.csv") + atomic_save_json(EXPORTS_DIR / "aggregated_metrics_by_percent_strategy.json", aggregated_rows) + else: + atomic_write_text(EXPORTS_DIR / "aggregated_metrics_by_percent_strategy.csv", "") + atomic_save_json(EXPORTS_DIR / "aggregated_metrics_by_percent_strategy.json", []) + + +"""============================================================================= +BASE MODULE PATCHES +============================================================================= +""" + + +def patched_save_json(path: str | Path, payload: Any) -> None: + atomic_save_json(path, payload) + + +def _context_matches_percent(ctx: FoldRunContext | None, percent: float) -> bool: + if ctx is None: + return False + return abs(float(percent) - float(ctx.percent_fraction)) <= 1e-12 + + +def patched_percent_root(percent: float) -> Path: + if _context_matches_percent(CURRENT_FOLD_CONTEXT, percent): + return ensure_dir(CURRENT_FOLD_CONTEXT.repeat_root) + return ORIGINAL_PERCENT_ROOT(percent) + + +def patched_strategy_root_for_percent( + strategy: int, + percent: float, + model_config: base.RuntimeModelConfig | None = None, +) -> Path: + if _context_matches_percent(CURRENT_FOLD_CONTEXT, percent): + return strategy_root_for(strategy, CURRENT_FOLD_CONTEXT, model_config) + return ORIGINAL_STRATEGY_ROOT_FOR_PERCENT(strategy, percent, model_config) + + +def patched_final_root_for_strategy( + strategy: int, + percent: float, + model_config: base.RuntimeModelConfig | None = None, +) -> Path: + if _context_matches_percent(CURRENT_FOLD_CONTEXT, percent): + return run_dir_for(strategy, CURRENT_FOLD_CONTEXT, model_config) + return ORIGINAL_FINAL_ROOT_FOR_STRATEGY(strategy, percent, model_config) + + +def patched_study_paths_for( + strategy: int, + percent: float, + model_config: base.RuntimeModelConfig | None = None, +) -> tuple[Path, Path, Path]: + if _context_matches_percent(CURRENT_FOLD_CONTEXT, percent): + return fold_study_paths_for(strategy, CURRENT_FOLD_CONTEXT, model_config) + return ORIGINAL_STUDY_PATHS_FOR(strategy, percent, model_config) + + +def patched_save_checkpoint( + path: Path, + *, + run_type: str, + model: base.nn.Module, + optimizer: torch.optim.Optimizer, + scheduler: Any, + scaler: Any, + epoch: int, + best_metric_value: float, + best_metric_name: str, + run_config: dict[str, Any], + epoch_metrics: dict[str, Any], + patience_counter: int, + elapsed_seconds: float, + history: list[dict[str, Any]] | None = None, + log_alpha: torch.Tensor | None = None, + alpha_optimizer: torch.optim.Optimizer | None = None, + resume_source: dict[str, Any] | None = None, +) -> None: + payload = { + "run_type": run_type, + "epoch": epoch, + "model_state_dict": base._unwrap_compiled(model).state_dict(), + "optimizer_state_dict": optimizer.state_dict(), + "best_metric_name": best_metric_name, + "best_metric_value": best_metric_value, + "patience_counter": int(patience_counter), + "elapsed_seconds": float(elapsed_seconds), + "run_config": run_config, + "config": run_config, + "epoch_metrics": epoch_metrics, + } + if history is not None: + payload["history"] = [dict(row) for row in history] + if scheduler is not None: + payload["scheduler_state_dict"] = scheduler.state_dict() + if scaler is not None: + payload["scaler_state_dict"] = scaler.state_dict() + if log_alpha is not None: + payload["log_alpha"] = float(log_alpha.detach().item()) + if alpha_optimizer is not None: + payload["alpha_optimizer_state_dict"] = alpha_optimizer.state_dict() + if resume_source is not None: + payload["resume_source"] = resume_source + base.validate_checkpoint_payload( + Path(path), + payload, + required_keys=base.checkpoint_required_keys( + optimizer=optimizer, + scheduler=scheduler, + scaler=scaler, + log_alpha=log_alpha, + alpha_optimizer=alpha_optimizer, + require_run_metadata=True, + ), + expected_run_type=run_type, + ) + atomic_torch_save(path, payload) + base.write_checkpoint_manifest(path, payload) + + if run_type != "final" or CURRENT_FOLD_CONTEXT is None: + return + run_key = RunKey( + split_repeat_index=CURRENT_FOLD_CONTEXT.split_repeat_index, + dataset_percent=CURRENT_FOLD_CONTEXT.percent_int, + subset_repeat_index=CURRENT_FOLD_CONTEXT.subset_repeat_index, + strategy=int(run_config["strategy"]), + ) + update_run_checkpoint_progress( + run_key, + checkpoint_path=Path(path), + epoch=int(epoch), + best_metric_name=str(best_metric_name), + best_metric_value=float(best_metric_value), + elapsed_seconds=float(elapsed_seconds), + ) + + +def patched_run_evaluation_for_run( + *, + strategy: int, + percent: float, + bundle: base.DataBundle, + run_dir: Path, + strategy2_checkpoint_path: str | Path | None = None, +) -> dict[str, dict[str, float]]: + if CURRENT_FOLD_CONTEXT is not None and LEDGER_CONN is not None: + run_key = RunKey( + split_repeat_index=CURRENT_FOLD_CONTEXT.split_repeat_index, + dataset_percent=CURRENT_FOLD_CONTEXT.percent_int, + subset_repeat_index=CURRENT_FOLD_CONTEXT.subset_repeat_index, + strategy=int(strategy), + ) + mark_run_stage(run_key, stage="evaluating") + return ORIGINAL_RUN_EVALUATION_FOR_RUN( + strategy=strategy, + percent=percent, + bundle=bundle, + run_dir=run_dir, + strategy2_checkpoint_path=strategy2_checkpoint_path, + ) + + +def install_base_patches() -> None: + base.save_json = patched_save_json + base.percent_root = patched_percent_root + base.strategy_root_for_percent = patched_strategy_root_for_percent + base.final_root_for_strategy = patched_final_root_for_strategy + base.study_paths_for = patched_study_paths_for + base.save_checkpoint = patched_save_checkpoint + base.run_evaluation_for_run = patched_run_evaluation_for_run + base.RESUME_IDENTITY_KEYS = BASE_RESUME_IDENTITY_KEYS + ( + "folds_experiment_name", + "split_repeat_index", + "subset_repeat_index", + "split_seed", + "subset_seed", + "base_split_manifest_path", + "subset_manifest_path", + ) + if RESUME_FOLDS and base.RUN_OPTUNA: + base.LOAD_EXISTING_STUDIES = True + + +@contextmanager +def activate_context(ctx: FoldRunContext) -> Iterator[None]: + global CURRENT_FOLD_CONTEXT + previous = CURRENT_FOLD_CONTEXT + CURRENT_FOLD_CONTEXT = ctx + try: + yield + finally: + CURRENT_FOLD_CONTEXT = previous + + +"""============================================================================= +EXPERIMENT PLAN MATERIALIZATION +============================================================================= +""" + + +def create_split_manifest_payload( + *, + split_repeat_index: int, + split_seed: int, + base_splits: dict[str, list[dict[str, str]]], + config_hash: str, + data_hash: str, + phase_index: int | None = None, + phase_val_fold_index: int | None = None, + phase_test_fold_index: int | None = None, +) -> dict[str, Any]: + payload = { + "experiment_name": FOLDS_EXPERIMENT_NAME, + "config_fingerprint": config_hash, + "dataset_fingerprint": data_hash, + "dataset_name": base.current_dataset_name(), + "dataset_split_policy": ( + base.current_busi_with_classes_split_policy() + if base.current_dataset_name() == "BUSI_with_classes" + else None + ), + "split_generation_mode": current_split_generation_mode(), + "split_type": base.SPLIT_TYPE, + "split_repeat_index": split_repeat_index, + "split_seed": split_seed, + "percent_sampling_mode": current_percent_sampling_mode(), + "base_splits": { + split_name: [dict(record) for record in records] + for split_name, records in base_splits.items() + }, + "counts": {split_name: len(records) for split_name, records in base_splits.items()}, + "class_distributions": { + split_name: base.compute_class_distribution(records) + for split_name, records in base_splits.items() + }, + } + if phase_index is not None: + payload["phase_index"] = int(phase_index) + payload["phase_count"] = phase_count() + payload["phase_val_fold_index"] = int(phase_val_fold_index) + payload["phase_test_fold_index"] = int(phase_test_fold_index) + payload["phase_partition_seed"] = int(split_seed) + return payload + + +def create_subset_manifest_payload( + *, + split_repeat_index: int, + split_seed: int, + percent_int: int, + percent_fraction: float, + subset_repeat_index: int, + subset_seed: int, + split_manifest: Path, + base_splits: dict[str, list[dict[str, str]]], + subset_records: list[dict[str, str]], + subset_sampling_source: str, + sampling_chain_dataset_percents: list[int], + config_hash: str, + data_hash: str, + phase_index: int | None = None, + phase_val_fold_index: int | None = None, + phase_test_fold_index: int | None = None, +) -> dict[str, Any]: + payload = { + "experiment_name": FOLDS_EXPERIMENT_NAME, + "config_fingerprint": config_hash, + "dataset_fingerprint": data_hash, + "dataset_name": base.current_dataset_name(), + "dataset_split_policy": ( + base.current_busi_with_classes_split_policy() + if base.current_dataset_name() == "BUSI_with_classes" + else None + ), + "split_generation_mode": current_split_generation_mode(), + "split_type": base.SPLIT_TYPE, + "split_repeat_index": split_repeat_index, + "split_seed": split_seed, + "dataset_percent": percent_int, + "dataset_fraction": percent_fraction, + "subset_repeat_index": subset_repeat_index, + "subset_seed": subset_seed, + "percent_sampling_mode": current_percent_sampling_mode(), + "subset_sampling_source": subset_sampling_source, + "sampling_chain_dataset_percents": [int(value) for value in sampling_chain_dataset_percents], + "parent_split_manifest_path": str(split_manifest.resolve()), + "train_records": [dict(record) for record in subset_records], + "val_records": [dict(record) for record in base_splits["val"]], + "test_records": [dict(record) for record in base_splits["test"]], + "base_train_records": [dict(record) for record in base_splits["train"]], + "counts": { + "base_train": len(base_splits["train"]), + "train_subset": len(subset_records), + "val": len(base_splits["val"]), + "test": len(base_splits["test"]), + }, + "class_distributions": { + "base_train": base.compute_class_distribution(base_splits["train"]), + "train_subset": base.compute_class_distribution(subset_records), + "val": base.compute_class_distribution(base_splits["val"]), + "test": base.compute_class_distribution(base_splits["test"]), + }, + } + if phase_index is not None: + payload["phase_index"] = int(phase_index) + payload["phase_count"] = phase_count() + payload["phase_val_fold_index"] = int(phase_val_fold_index) + payload["phase_test_fold_index"] = int(phase_test_fold_index) + return payload + + +def validate_materialized_phase_manifests(*, sample_records: list[dict[str, str]]) -> None: + if not using_fixed_phase_mode(): + return + phase_splits_by_index: dict[int, dict[str, list[dict[str, str]]]] = {} + for phase_index in phase_indices(): + manifest_path = split_manifest_path(phase_index) + if not manifest_path.exists(): + raise RuntimeError(f"Missing phase manifest for phase={phase_index:03d}: {manifest_path}") + payload = base.load_json(manifest_path) + if str(payload.get("split_generation_mode", "")).strip().lower() != "fixed_stratified_phases_8_1_1": + raise RuntimeError( + f"Expected fixed phase split_generation_mode in {manifest_path}, got " + f"{payload.get('split_generation_mode')!r}." + ) + if int(payload.get("phase_index", -1)) != phase_index: + raise RuntimeError( + f"Phase manifest {manifest_path} reports phase_index={payload.get('phase_index')!r}, " + f"expected {phase_index}." + ) + if int(payload.get("phase_count", -1)) != phase_count(): + raise RuntimeError( + f"Phase manifest {manifest_path} reports phase_count={payload.get('phase_count')!r}, " + f"expected {phase_count()}." + ) + val_fold_index, test_fold_index = phase_fold_indices(phase_index) + if int(payload.get("phase_val_fold_index", -1)) != val_fold_index: + raise RuntimeError( + f"Phase manifest {manifest_path} reports phase_val_fold_index=" + f"{payload.get('phase_val_fold_index')!r}, expected {val_fold_index}." + ) + if int(payload.get("phase_test_fold_index", -1)) != test_fold_index: + raise RuntimeError( + f"Phase manifest {manifest_path} reports phase_test_fold_index=" + f"{payload.get('phase_test_fold_index')!r}, expected {test_fold_index}." + ) + phase_splits_by_index[phase_index] = { + split_name: [dict(record) for record in payload["base_splits"][split_name]] + for split_name in ("train", "val", "test") + } + validate_phase_coverage(phase_splits_by_index, sample_records=sample_records) + + +def validate_materialized_subset_manifests() -> None: + if not using_fixed_phase_mode(): + return + for phase_index in phase_indices(): + split_payload = base.load_json(split_manifest_path(phase_index)) + for spec in percent_specs(): + for subset_repeat_index in range(1, int(spec.repeat_count) + 1): + manifest_path = subset_manifest_path(phase_index, spec.percent_int, subset_repeat_index) + if not manifest_path.exists(): + raise RuntimeError( + f"Missing subset manifest for phase={phase_index:03d}, " + f"percent={spec.percent_int}, repeat={subset_repeat_index}: {manifest_path}" + ) + subset_payload = base.load_json(manifest_path) + validate_loaded_context_payloads( + split_payload, + subset_payload, + split_repeat_index=phase_index, + percent_int=spec.percent_int, + subset_repeat_index=subset_repeat_index, + ) + + +def validate_loaded_context_payloads( + split_payload: dict[str, Any], + subset_payload: dict[str, Any], + *, + split_repeat_index: int, + percent_int: int, + subset_repeat_index: int, +) -> None: + base_splits = { + split_name: [dict(record) for record in split_payload["base_splits"][split_name]] + for split_name in ("train", "val", "test") + } + validate_base_split(base_splits, split_repeat_index=split_repeat_index) + + train_records = [dict(record) for record in subset_payload["train_records"]] + val_records = [dict(record) for record in subset_payload["val_records"]] + test_records = [dict(record) for record in subset_payload["test_records"]] + base_train_records = [dict(record) for record in subset_payload["base_train_records"]] + validate_disjoint_record_sets( + { + "train_subset": train_records, + "val": val_records, + "test": test_records, + }, + context=( + f"{primary_unit_name()}={split_repeat_index:03d}, " + f"percent={percent_int}, repeat={subset_repeat_index}" + ), + ) + validate_subset_records( + base_splits["train"], + train_records, + split_repeat_index=split_repeat_index, + percent_int=percent_int, + subset_repeat_index=subset_repeat_index, + ) + if set(record_filenames(base_train_records)) != set(record_filenames(base_splits["train"])): + raise RuntimeError( + f"Subset manifest base train records do not match the parent {primary_unit_name()} " + f"{split_repeat_index:03d}." + ) + if set(record_filenames(val_records)) != set(record_filenames(base_splits["val"])): + raise RuntimeError( + f"Subset manifest validation records do not match the parent {primary_unit_name()} " + f"{split_repeat_index:03d}." + ) + if set(record_filenames(test_records)) != set(record_filenames(base_splits["test"])): + raise RuntimeError( + f"Subset manifest test records do not match the parent {primary_unit_name()} " + f"{split_repeat_index:03d}." + ) + if using_fixed_phase_mode(): + phase_index = int(split_payload.get("phase_index", split_repeat_index)) + if int(split_payload.get("phase_count", -1)) != phase_count(): + raise RuntimeError( + f"Parent phase manifest for phase={phase_index:03d} has unexpected phase_count=" + f"{split_payload.get('phase_count')!r}." + ) + val_fold_index, test_fold_index = phase_fold_indices(phase_index) + if int(split_payload.get("phase_val_fold_index", -1)) != val_fold_index: + raise RuntimeError( + f"Parent phase manifest for phase={phase_index:03d} has unexpected phase_val_fold_index=" + f"{split_payload.get('phase_val_fold_index')!r}." + ) + if int(split_payload.get("phase_test_fold_index", -1)) != test_fold_index: + raise RuntimeError( + f"Parent phase manifest for phase={phase_index:03d} has unexpected phase_test_fold_index=" + f"{split_payload.get('phase_test_fold_index')!r}." + ) + if int(subset_payload.get("phase_index", phase_index)) != phase_index: + raise RuntimeError( + f"Subset manifest phase_index={subset_payload.get('phase_index')!r} does not match " + f"phase={phase_index:03d}." + ) + if int(subset_payload.get("phase_count", phase_count())) != phase_count(): + raise RuntimeError( + f"Subset manifest for phase={phase_index:03d} has unexpected phase_count=" + f"{subset_payload.get('phase_count')!r}." + ) + if int(subset_payload.get("phase_val_fold_index", val_fold_index)) != val_fold_index: + raise RuntimeError( + f"Subset manifest for phase={phase_index:03d} has unexpected phase_val_fold_index=" + f"{subset_payload.get('phase_val_fold_index')!r}." + ) + if int(subset_payload.get("phase_test_fold_index", test_fold_index)) != test_fold_index: + raise RuntimeError( + f"Subset manifest for phase={phase_index:03d} has unexpected phase_test_fold_index=" + f"{subset_payload.get('phase_test_fold_index')!r}." + ) + + +def materialize_experiment_plan( + *, + sample_records: list[dict[str, str]], + model_config: base.RuntimeModelConfig, +) -> None: + ensure_dir(EXPERIMENT_ROOT) + ensure_dir(SPLIT_MANIFESTS_DIR) + ensure_dir(SUBSET_MANIFESTS_DIR) + ensure_dir(EXPORTS_DIR) + + snapshot = config_snapshot(model_config) + config_hash = config_fingerprint(snapshot) + data_hash = dataset_fingerprint(sample_records) + sampling_mode = current_percent_sampling_mode() + upsert_experiment_meta(snapshot=snapshot, config_hash=config_hash, data_hash=data_hash) + expected_filenames = {record["filename"] for record in sample_records} + partition_seed_value = partition_seed() + phase_splits_by_index: dict[int, dict[str, list[dict[str, str]]]] = {} + fixed_phase_folds: dict[int, list[dict[str, str]]] | None = None + if using_fixed_phase_mode(): + validate_fixed_phase_dataset_requirements(sample_records) + fixed_phase_folds = build_fixed_stratified_phase_folds( + sample_records, + seed=partition_seed_value, + ) + validate_fixed_phase_folds(fixed_phase_folds, sample_records=sample_records) + + for split_repeat_index in all_split_repeat_indices(): + phase_index = None + phase_val_fold_index = None + phase_test_fold_index = None + if using_fixed_phase_mode(): + if fixed_phase_folds is None: + raise RuntimeError("Fixed phase folds were not initialized.") + split_seed = partition_seed_value + phase_index = split_repeat_index + phase_val_fold_index, phase_test_fold_index = phase_fold_indices(phase_index) + base_splits = build_phase_base_split( + fixed_phase_folds, + phase_index=phase_index, + seed=split_seed, + ) + phase_splits_by_index[phase_index] = { + split_name: [dict(record) for record in records] + for split_name, records in base_splits.items() + } + else: + split_seed = fold_seed(f"split::{split_repeat_index}") + base_splits = build_base_split_for_repeat(sample_records, split_seed) + validate_base_split( + base_splits, + split_repeat_index=split_repeat_index, + expected_filenames=expected_filenames, + ) + + split_manifest = split_manifest_path(split_repeat_index) + split_payload = create_split_manifest_payload( + split_repeat_index=split_repeat_index, + split_seed=split_seed, + base_splits=base_splits, + config_hash=config_hash, + data_hash=data_hash, + phase_index=phase_index, + phase_val_fold_index=phase_val_fold_index, + phase_test_fold_index=phase_test_fold_index, + ) + atomic_save_json(split_manifest, split_payload) + upsert_split_manifest_row( + split_repeat_index=split_repeat_index, + split_seed=split_seed, + manifest_path=split_manifest, + train_count=len(base_splits["train"]), + val_count=len(base_splits["val"]), + test_count=len(base_splits["test"]), + config_hash=config_hash, + data_hash=data_hash, + ) + + if sampling_mode == "independent": + for spec in percent_specs(): + for subset_repeat_index in range(1, int(spec.repeat_count) + 1): + subset_seed = fold_seed( + f"subset::{split_repeat_index}::{spec.percent_int}::{subset_repeat_index}" + ) + subset_records = build_subset_for_repeat( + base_splits["train"], + percent_fraction=spec.fraction, + subset_seed=subset_seed, + ) + validate_subset_records( + base_splits["train"], + subset_records, + split_repeat_index=split_repeat_index, + percent_int=spec.percent_int, + subset_repeat_index=subset_repeat_index, + ) + + subset_manifest = subset_manifest_path( + split_repeat_index, + spec.percent_int, + subset_repeat_index, + ) + subset_payload = create_subset_manifest_payload( + split_repeat_index=split_repeat_index, + split_seed=split_seed, + percent_int=spec.percent_int, + percent_fraction=spec.fraction, + subset_repeat_index=subset_repeat_index, + subset_seed=subset_seed, + split_manifest=split_manifest, + base_splits=base_splits, + subset_records=subset_records, + subset_sampling_source="independent", + sampling_chain_dataset_percents=[spec.percent_int], + config_hash=config_hash, + data_hash=data_hash, + phase_index=phase_index, + phase_val_fold_index=phase_val_fold_index, + phase_test_fold_index=phase_test_fold_index, + ) + atomic_save_json(subset_manifest, subset_payload) + upsert_subset_manifest_row( + split_repeat_index=split_repeat_index, + percent_int=spec.percent_int, + subset_repeat_index=subset_repeat_index, + subset_seed=subset_seed, + manifest_path=subset_manifest, + subset_count=len(subset_records), + config_hash=config_hash, + data_hash=data_hash, + ) + + ctx = FoldRunContext( + split_repeat_index=split_repeat_index, + subset_repeat_index=subset_repeat_index, + percent_int=spec.percent_int, + percent_fraction=spec.fraction, + split_seed=split_seed, + subset_seed=subset_seed, + repeat_root=repeat_root(split_repeat_index, spec.percent_int, subset_repeat_index), + split_manifest_path=split_manifest, + subset_manifest_path=subset_manifest, + ) + for strategy in base.STRATEGIES: + upsert_run_plan_row( + key=RunKey( + split_repeat_index=ctx.split_repeat_index, + dataset_percent=ctx.percent_int, + subset_repeat_index=ctx.subset_repeat_index, + strategy=int(strategy), + ), + dataset_fraction=ctx.percent_fraction, + split_seed=ctx.split_seed, + subset_seed=ctx.subset_seed, + split_manifest=ctx.split_manifest_path, + subset_manifest=ctx.subset_manifest_path, + run_dir=run_dir_for(int(strategy), ctx, model_config), + ) + continue + + max_subset_repeat_index = max(spec.repeat_count for spec in percent_specs()) + for subset_repeat_index in range(1, max_subset_repeat_index + 1): + active_specs = active_specs_for_subset_repeat(subset_repeat_index) + if not active_specs: + continue + subset_seed = fold_seed(f"subset::{split_repeat_index}::repeat::{subset_repeat_index}") + subset_chain = build_incremental_subset_chain( + base_splits["train"], + active_specs=active_specs, + subset_seed=subset_seed, + ) + chain_dataset_percents = [spec.percent_int for spec in active_specs] + for spec in active_specs: + subset_records = subset_chain[base.percent_label(spec.fraction)] + validate_subset_records( + base_splits["train"], + subset_records, + split_repeat_index=split_repeat_index, + percent_int=spec.percent_int, + subset_repeat_index=subset_repeat_index, + ) + + subset_manifest = subset_manifest_path( + split_repeat_index, + spec.percent_int, + subset_repeat_index, + ) + subset_payload = create_subset_manifest_payload( + split_repeat_index=split_repeat_index, + split_seed=split_seed, + percent_int=spec.percent_int, + percent_fraction=spec.fraction, + subset_repeat_index=subset_repeat_index, + subset_seed=subset_seed, + split_manifest=split_manifest, + base_splits=base_splits, + subset_records=subset_records, + subset_sampling_source="incremental_chain", + sampling_chain_dataset_percents=chain_dataset_percents, + config_hash=config_hash, + data_hash=data_hash, + phase_index=phase_index, + phase_val_fold_index=phase_val_fold_index, + phase_test_fold_index=phase_test_fold_index, + ) + atomic_save_json(subset_manifest, subset_payload) + upsert_subset_manifest_row( + split_repeat_index=split_repeat_index, + percent_int=spec.percent_int, + subset_repeat_index=subset_repeat_index, + subset_seed=subset_seed, + manifest_path=subset_manifest, + subset_count=len(subset_records), + config_hash=config_hash, + data_hash=data_hash, + ) + + ctx = FoldRunContext( + split_repeat_index=split_repeat_index, + subset_repeat_index=subset_repeat_index, + percent_int=spec.percent_int, + percent_fraction=spec.fraction, + split_seed=split_seed, + subset_seed=subset_seed, + repeat_root=repeat_root(split_repeat_index, spec.percent_int, subset_repeat_index), + split_manifest_path=split_manifest, + subset_manifest_path=subset_manifest, + ) + for strategy in base.STRATEGIES: + upsert_run_plan_row( + key=RunKey( + split_repeat_index=ctx.split_repeat_index, + dataset_percent=ctx.percent_int, + subset_repeat_index=ctx.subset_repeat_index, + strategy=int(strategy), + ), + dataset_fraction=ctx.percent_fraction, + split_seed=ctx.split_seed, + subset_seed=ctx.subset_seed, + split_manifest=ctx.split_manifest_path, + subset_manifest=ctx.subset_manifest_path, + run_dir=run_dir_for(int(strategy), ctx, model_config), + ) + + if using_fixed_phase_mode(): + validate_phase_coverage(phase_splits_by_index, sample_records=sample_records) + validate_materialized_phase_manifests(sample_records=sample_records) + validate_materialized_subset_manifests() + + +def validate_or_create_experiment( + *, + sample_records: list[dict[str, str]], + model_config: base.RuntimeModelConfig, +) -> None: + meta = existing_experiment_meta() + ignore_resume_folds_gate = str(base.EXECUTION_MODE).strip().lower() == "eval_only" + + if not RESUME_FOLDS and not ignore_resume_folds_gate: + if meta is not None: + raise RuntimeError( + f"RESUME_FOLDS=False requires a fresh experiment root, but {EXPERIMENT_ROOT} already exists." + ) + materialize_experiment_plan(sample_records=sample_records, model_config=model_config) + return + + if meta is None: + if ledger_row_count("split_manifests") > 0 or ledger_row_count("run_status") > 0: + raise RuntimeError( + f"Experiment DB {EXPERIMENT_DB_PATH} contains run state but is missing experiment metadata." + ) + materialize_experiment_plan(sample_records=sample_records, model_config=model_config) + return + + current_snapshot = config_snapshot(model_config) + current_hash = config_fingerprint(current_snapshot) + current_data_hash = dataset_fingerprint(sample_records) + stored_config_hash = str(meta["config_fingerprint"]) + stored_portable_hash = "" + try: + stored_config_json = json.loads(str(meta["config_json"])) + stored_portable_hash = config_fingerprint(stored_config_json) + except Exception as exc: + print(f"[Resume] Could not recompute portable config fingerprint from stored metadata: {exc}") + if stored_config_hash != current_hash and stored_portable_hash != current_hash: + raise RuntimeError( + f"Existing experiment config fingerprint does not match current configuration for {EXPERIMENT_ROOT}." + ) + if stored_config_hash != current_hash and stored_portable_hash == current_hash: + print( + "[Resume] Accepted existing experiment metadata with a portable config fingerprint match " + "(machine-specific paths/runtime resume flag changed)." + ) + if str(meta["dataset_fingerprint"]) != current_data_hash: + raise RuntimeError( + f"Existing experiment dataset fingerprint does not match current dataset contents for {EXPERIMENT_ROOT}." + ) + if using_fixed_phase_mode(): + validate_materialized_phase_manifests(sample_records=sample_records) + validate_materialized_subset_manifests() + + +"""============================================================================= +RUNTIME BUNDLE CONSTRUCTION +============================================================================= +""" + + +def load_context(split_repeat_index: int, percent_int: int, subset_repeat_index: int) -> FoldRunContext: + split_payload = base.load_json(split_manifest_path(split_repeat_index)) + subset_payload = base.load_json(subset_manifest_path(split_repeat_index, percent_int, subset_repeat_index)) + validate_loaded_context_payloads( + split_payload, + subset_payload, + split_repeat_index=split_repeat_index, + percent_int=percent_int, + subset_repeat_index=subset_repeat_index, + ) + return FoldRunContext( + split_repeat_index=split_repeat_index, + subset_repeat_index=subset_repeat_index, + percent_int=percent_int, + percent_fraction=float(subset_payload["dataset_fraction"]), + split_seed=int(split_payload["split_seed"]), + subset_seed=int(subset_payload["subset_seed"]), + repeat_root=repeat_root(split_repeat_index, percent_int, subset_repeat_index), + split_manifest_path=split_manifest_path(split_repeat_index), + subset_manifest_path=subset_manifest_path(split_repeat_index, percent_int, subset_repeat_index), + ) + + +def build_fold_data_bundle(ctx: FoldRunContext) -> base.DataBundle: + split_payload = base.load_json(ctx.split_manifest_path) + subset_payload = base.load_json(ctx.subset_manifest_path) + dataset_root = Path(base.current_dataset_dirs()[0]).parent.resolve() + phase_index = ( + int(split_payload.get("phase_index", ctx.split_repeat_index)) + if str(split_payload.get("split_generation_mode", "")).strip().lower() == "fixed_stratified_phases_8_1_1" + else None + ) + cycle_token = f"phase{phase_index:03d}" if phase_index is not None else f"split{ctx.split_repeat_index:03d}" + normalization_cache_path = ( + ctx.repeat_root + / ( + f"norm_stats_{base.normalization_cache_tag()}_{base.SPLIT_TYPE}_{ctx.percent_int:03d}pct_" + f"{cycle_token}_repeat{ctx.subset_repeat_index:02d}.json" + ) + ) + + train_records = [dict(record) for record in subset_payload["train_records"]] + val_records = [dict(record) for record in subset_payload["val_records"]] + test_records = [dict(record) for record in subset_payload["test_records"]] + base_train_records = [dict(record) for record in subset_payload["base_train_records"]] + + base_train_class_distribution = base.compute_class_distribution(base_train_records) + train_class_distribution = base.compute_class_distribution(train_records) + val_class_distribution = base.compute_class_distribution(val_records) + test_class_distribution = base.compute_class_distribution(test_records) + + base.print_loaded_class_distribution( + split_type=base.SPLIT_TYPE, + train_subset_key=str(ctx.percent_int), + base_train_records=base_train_records, + train_records=train_records, + val_records=val_records, + test_records=test_records, + ) + + global_mean, global_std, normalization_source = base.compute_busi_statistics( + dataset_root=dataset_root, + sample_records=train_records, + cache_path=normalization_cache_path, + ) + + payload = { + "dataset_name": base.current_dataset_name(), + "dataset_split_policy": ( + base.current_busi_with_classes_split_policy() + if base.current_dataset_name() == "BUSI_with_classes" + else None + ), + "dataset_splits_path": str(ctx.split_manifest_path.resolve()), + "dataset_root": str(dataset_root), + "split_source": ( + "fixed_phase_manifest" + if phase_index is not None + else "repeated_holdout_manifest" + ), + "split_generation_mode": str(split_payload.get("split_generation_mode", current_split_generation_mode())), + "split_type": base.SPLIT_TYPE, + "percent_sampling_mode": str( + subset_payload.get("percent_sampling_mode", split_payload.get("percent_sampling_mode", "independent")) + ), + "dataset_percent": ctx.percent_fraction, + "train_subset_key": str(ctx.percent_int), + "train_subset_variant": int(ctx.subset_repeat_index), + "train_subset_source": str(subset_payload.get("subset_sampling_source", "repeated_holdout_repeat")), + "selected_split_manifest_path": str(ctx.subset_manifest_path.resolve()), + "sampling_chain_dataset_percents": [ + int(value) for value in subset_payload.get("sampling_chain_dataset_percents", [ctx.percent_int]) + ], + "base_train_count": len(base_train_records), + "train_count": len(train_records), + "val_count": len(val_records), + "test_count": len(test_records), + "base_train_class_distribution": base_train_class_distribution, + "train_class_distribution": train_class_distribution, + "val_class_distribution": val_class_distribution, + "test_class_distribution": test_class_distribution, + "val_test_frozen": True, + "leakage_check": "passed", + "global_mean": global_mean, + "global_std": global_std, + "normalization_cache_path": str(normalization_cache_path.resolve()), + "normalization_source": normalization_source, + "split_repeat_index": ctx.split_repeat_index, + "subset_repeat_index": ctx.subset_repeat_index, + "split_seed": ctx.split_seed, + "subset_seed": ctx.subset_seed, + "base_split_manifest_path": str(ctx.split_manifest_path.resolve()), + "subset_manifest_path": str(ctx.subset_manifest_path.resolve()), + "folds_experiment_name": FOLDS_EXPERIMENT_NAME, + "folds_experiment_root": str(EXPERIMENT_ROOT.resolve()), + } + if phase_index is not None: + payload["phase_index"] = phase_index + payload["phase_count"] = int(split_payload["phase_count"]) + payload["phase_val_fold_index"] = int(split_payload["phase_val_fold_index"]) + payload["phase_test_fold_index"] = int(split_payload["phase_test_fold_index"]) + + base.print_split_summary(payload) + base.print_normalization_summary(payload) + + train_split_name = ( + f"train {base.SPLIT_TYPE} {ctx.percent_int}% phase{phase_index:03d}" + if phase_index is not None + else f"train {base.SPLIT_TYPE} {ctx.percent_int}% split{ctx.split_repeat_index:03d}" + ) + val_split_name = ( + f"val {base.SPLIT_TYPE} phase{phase_index:03d}" + if phase_index is not None + else f"val {base.SPLIT_TYPE} split{ctx.split_repeat_index:03d}" + ) + test_split_name = ( + f"test {base.SPLIT_TYPE} phase{phase_index:03d}" + if phase_index is not None + else f"test {base.SPLIT_TYPE} split{ctx.split_repeat_index:03d}" + ) + loader_prefix = ( + f"{base.SPLIT_TYPE}:{ctx.percent_int}:phase{phase_index:03d}" + if phase_index is not None + else f"{base.SPLIT_TYPE}:{ctx.percent_int}:split{ctx.split_repeat_index:03d}" + ) + + train_ds = base.BUSIDataset( + train_records, + dataset_root, + global_mean, + global_std, + preload=base.PRELOAD_TO_RAM, + augment=True, + split_name=train_split_name, + ) + val_ds = base.BUSIDataset( + val_records, + dataset_root, + global_mean, + global_std, + preload=base.PRELOAD_TO_RAM, + augment=False, + split_name=val_split_name, + ) + test_ds = base.BUSIDataset( + test_records, + dataset_root, + global_mean, + global_std, + preload=base.PRELOAD_TO_RAM, + augment=False, + split_name=test_split_name, + ) + bundle = base.DataBundle( + percent=ctx.percent_fraction, + split_payload=payload, + train_ds=train_ds, + val_ds=val_ds, + test_ds=test_ds, + train_loader=base.make_loader( + train_ds, + shuffle=True, + loader_tag=f"{loader_prefix}:repeat{ctx.subset_repeat_index:02d}:train", + ), + val_loader=base.make_loader( + val_ds, + shuffle=False, + loader_tag=f"{loader_prefix}:repeat{ctx.subset_repeat_index:02d}:val", + ), + test_loader=base.make_loader( + test_ds, + shuffle=False, + loader_tag=f"{loader_prefix}:repeat{ctx.subset_repeat_index:02d}:test", + ), + ) + base.print_preload_summary(bundle) + return bundle + + +def release_bundle(bundle: base.DataBundle | None) -> None: + if bundle is None: + return + del bundle + gc.collect() + base.run_cuda_cleanup(context="bundle release") + + +def checkpoint_candidates(run_dir: Path) -> list[Path]: + return [ + run_dir / "checkpoints" / "latest.pt", + run_dir / "checkpoints" / "best.pt", + ] + + +def resolve_resume_checkpoint(run_dir: Path) -> Path | None: + for candidate in checkpoint_candidates(run_dir): + if candidate.exists(): + return candidate + return None + + +"""============================================================================= +RUN EXECUTION +============================================================================= +""" + + +def strategy_requires_strategy2_checkpoint(strategy: int) -> bool: + return ( + base.EXECUTION_MODE == "train_eval" and strategy == 3 and base.STRATEGY3_BOOTSTRAP_FROM_STRATEGY2 + ) + + +def fold_param_metadata(ctx: FoldRunContext) -> dict[str, Any]: + subset_payload = base.load_json(ctx.subset_manifest_path) + payload = { + "folds_experiment_name": FOLDS_EXPERIMENT_NAME, + "split_repeat_index": int(ctx.split_repeat_index), + "subset_repeat_index": int(ctx.subset_repeat_index), + "split_seed": int(ctx.split_seed), + "subset_seed": int(ctx.subset_seed), + "split_generation_mode": str(subset_payload.get("split_generation_mode", current_split_generation_mode())), + "percent_sampling_mode": str(subset_payload.get("percent_sampling_mode", current_percent_sampling_mode())), + "subset_sampling_source": str(subset_payload.get("subset_sampling_source", "independent")), + "base_split_manifest_path": str(ctx.split_manifest_path.resolve()), + "subset_manifest_path": str(ctx.subset_manifest_path.resolve()), + } + if subset_payload.get("phase_index") is not None: + payload["phase_index"] = int(subset_payload["phase_index"]) + payload["phase_count"] = int(subset_payload["phase_count"]) + payload["phase_val_fold_index"] = int(subset_payload["phase_val_fold_index"]) + payload["phase_test_fold_index"] = int(subset_payload["phase_test_fold_index"]) + return payload + + +def finalize_run_from_artifacts(key: RunKey, run_dir: Path) -> bool: + evaluation_path = run_dir / "evaluation.json" + if not evaluation_path.exists(): + return False + ingest_evaluation_into_db(key, evaluation_path, run_dir) + export_stats() + return True + + +def execute_final_run( + *, + strategy: int, + ctx: FoldRunContext, + bundle: base.DataBundle, + model_config: base.RuntimeModelConfig, +) -> None: + run_key = RunKey( + split_repeat_index=ctx.split_repeat_index, + dataset_percent=ctx.percent_int, + subset_repeat_index=ctx.subset_repeat_index, + strategy=int(strategy), + ) + row = load_run_status(run_key) + if row is None: + raise RuntimeError(f"Run plan row is missing for {run_key}.") + if str(row["status"]) == "completed": + return + if str(row["status"]) == "failed": + print( + f"[{split_generation_display_name()}] Skipping failed run " + f"{run_identity_label(strategy=strategy, percent=ctx.percent_fraction, split_payload=bundle.split_payload)}." + ) + return + + run_dir = run_dir_for(strategy, ctx, model_config) + if finalize_run_from_artifacts(run_key, run_dir): + return + + strategy2_checkpoint_path: str | Path | None = None + run_name = run_identity_label(strategy=strategy, percent=ctx.percent_fraction, split_payload=bundle.split_payload) + with activate_context(ctx): + banner_prefix = "PHASE RUN" if using_fixed_phase_mode() else "REPEATED HOLDOUT RUN" + base.banner(f"{banner_prefix} | {run_name}") + if strategy_requires_strategy2_checkpoint(strategy): + strategy2_checkpoint_path = base.resolve_strategy2_checkpoint_path( + strategy, + ctx.percent_fraction, + model_config, + ) + + if base.EXECUTION_MODE == "eval_only": + mark_run_running(run_key, stage="evaluating") + ORIGINAL_RUN_EVALUATION_FOR_RUN( + strategy=strategy, + percent=ctx.percent_fraction, + bundle=bundle, + run_dir=run_dir, + strategy2_checkpoint_path=strategy2_checkpoint_path, + ) + finalize_run_from_artifacts(run_key, run_dir) + return + + summary_path = run_dir / "summary.json" + if summary_path.exists() and not (run_dir / "evaluation.json").exists(): + mark_run_running(run_key, stage="evaluating") + ORIGINAL_RUN_EVALUATION_FOR_RUN( + strategy=strategy, + percent=ctx.percent_fraction, + bundle=bundle, + run_dir=run_dir, + strategy2_checkpoint_path=strategy2_checkpoint_path, + ) + finalize_run_from_artifacts(run_key, run_dir) + return + + if base.RUN_SMOKE_TEST: + base.maybe_run_strategy_smoke_test( + strategy=strategy, + model_config=model_config, + bundle=bundle, + strategy2_checkpoint_path=strategy2_checkpoint_path, + ) + + params = base.resolve_job_params( + strategy, + ctx.percent_fraction, + bundle, + model_config=model_config, + strategy2_checkpoint_path=strategy2_checkpoint_path, + ) + params = {**params, **fold_param_metadata(ctx)} + + resume_checkpoint_path = None + if str(row["status"]) in {"interrupted", "running"}: + resume_checkpoint_path = resolve_resume_checkpoint(run_dir) + + mark_run_running(run_key, stage="training") + base.run_single_job( + strategy=strategy, + model_config=model_config, + bundle=bundle, + run_dir=run_dir, + params=params, + max_epochs=base.strategy_epochs(strategy), + trial=None, + strategy2_checkpoint_path=strategy2_checkpoint_path, + resume_checkpoint_path=resume_checkpoint_path, + ) + finalize_run_from_artifacts(run_key, run_dir) + + +def reconcile_existing_artifacts(ctx: FoldRunContext, strategy: int, model_config: base.RuntimeModelConfig) -> None: + run_key = RunKey( + split_repeat_index=ctx.split_repeat_index, + dataset_percent=ctx.percent_int, + subset_repeat_index=ctx.subset_repeat_index, + strategy=int(strategy), + ) + row = load_run_status(run_key) + if row is None or str(row["status"]) == "completed": + return + run_dir = run_dir_for(strategy, ctx, model_config) + if finalize_run_from_artifacts(run_key, run_dir): + return + if (run_dir / "summary.json").exists(): + mark_run_interrupted(run_key) + mark_run_stage(run_key, stage="evaluating") + return + if resolve_resume_checkpoint(run_dir) is not None: + mark_run_interrupted(run_key) + + +def maybe_reset_study_artifacts(model_config: base.RuntimeModelConfig) -> None: + if not base.RESET_ALL_STUDIES_EACH_RUN or not base.RUN_OPTUNA: + return + if RESUME_FOLDS: + print( + f"[{split_generation_display_name()}] RESET_ALL_STUDIES_EACH_RUN ignored because RESUME_FOLDS=True." + ) + return + for ctx in iter_manifested_contexts(split_repeat_indices_to_run()): + with activate_context(ctx): + for strategy in base.STRATEGIES: + base.reset_study_artifacts(strategy, ctx.percent_fraction, model_config=model_config) + + +def run_overfit_mode(model_config: base.RuntimeModelConfig) -> int: + if using_fixed_phase_mode(): + base.banner("FIXED PHASE OVERFIT TEST MODE") + else: + base.banner("REPEATED HOLDOUT OVERFIT TEST MODE") + for ctx in iter_manifested_contexts(split_repeat_indices_to_run()): + bundle = build_fold_data_bundle(ctx) + try: + with activate_context(ctx): + for strategy in base.STRATEGIES: + strategy2_checkpoint_path = None + if strategy == 3 and base.STRATEGY3_BOOTSTRAP_FROM_STRATEGY2: + strategy2_checkpoint_path = base.resolve_strategy2_checkpoint_path( + strategy, + ctx.percent_fraction, + model_config, + ) + base.run_overfit_test( + strategy=strategy, + model_config=model_config, + bundle=bundle, + overfit_root=overfit_root_for(strategy, ctx, model_config), + strategy2_checkpoint_path=strategy2_checkpoint_path, + ) + finally: + release_bundle(bundle) + return 0 + + +def run_eval_only_without_ledger(model_config: base.RuntimeModelConfig) -> int: + if using_fixed_phase_mode(): + base.banner("FIXED PHASE EVAL ONLY | LEDGER BYPASSED") + else: + base.banner("REPEATED HOLDOUT EVAL ONLY | LEDGER BYPASSED") + print("[Eval Only] Skipping experiment ledger and evaluating directly from manifests and checkpoints.") + + for ctx in iter_manifested_contexts(split_repeat_indices_to_run()): + bundle = build_fold_data_bundle(ctx) + try: + with activate_context(ctx): + for strategy in base.STRATEGIES: + run_name = run_identity_label( + strategy=strategy, + percent=ctx.percent_fraction, + split_payload=bundle.split_payload, + ) + base.banner(f"EVAL ONLY | {run_name}") + base.run_evaluation_for_run( + strategy=strategy, + percent=ctx.percent_fraction, + bundle=bundle, + run_dir=run_dir_for(strategy, ctx, model_config), + strategy2_checkpoint_path=None, + ) + finally: + release_bundle(bundle) + return 0 + + +def run_pass_for_statuses( + statuses: set[str], + *, + model_config: base.RuntimeModelConfig, +) -> None: + for ctx in iter_manifested_contexts(split_repeat_indices_to_run()): + pending_strategies = [] + for strategy in base.STRATEGIES: + run_key = RunKey( + split_repeat_index=ctx.split_repeat_index, + dataset_percent=ctx.percent_int, + subset_repeat_index=ctx.subset_repeat_index, + strategy=int(strategy), + ) + row = load_run_status(run_key) + if row is not None and str(row["status"]) in statuses: + pending_strategies.append(int(strategy)) + if not pending_strategies: + continue + + bundle = build_fold_data_bundle(ctx) + phase_had_error = False + try: + for strategy in pending_strategies: + run_key = RunKey( + split_repeat_index=ctx.split_repeat_index, + dataset_percent=ctx.percent_int, + subset_repeat_index=ctx.subset_repeat_index, + strategy=int(strategy), + ) + row = load_run_status(run_key) + if row is None or str(row["status"]) == "completed": + continue + try: + execute_final_run( + strategy=strategy, + ctx=ctx, + bundle=bundle, + model_config=model_config, + ) + except KeyboardInterrupt: + phase_had_error = True + mark_run_interrupted(run_key) + raise + except Exception: + phase_had_error = True + error_text = traceback.format_exc() + mark_run_failed(run_key, error_text) + print(error_text) + finally: + if using_fixed_phase_mode(): + write_phase_timing_summary_after_phase(ctx.split_repeat_index) + if not phase_had_error: + threading.Thread( + target=run_repo_backup_after_phase, + args=(ctx.split_repeat_index,), + daemon=True, + ).start() + release_bundle(bundle) + + +"""============================================================================= +MAIN +============================================================================= +""" + + +def run_repeated_holdout_main() -> int: + global LEDGER_CONN + + validate_repeated_holdout_settings() + if not str(FOLDS_EXPERIMENT_NAME).strip(): + raise ValueError("FOLDS_EXPERIMENT_NAME must be non-empty.") + if base.SPLIT_TYPE != "80_10_10": + raise ValueError( + f"RUNNER_FOLDS.py currently requires SPLIT_TYPE='80_10_10', got {base.SPLIT_TYPE!r}." + ) + + install_base_patches() + base.SAVE_LATEST_EVERY_EPOCH = True + + base.set_global_seed(base.SEED) + model_config = base.current_model_config() + fold_experiment_summary(model_config) + + if str(base.EXECUTION_MODE).strip().lower() == "eval_only": + select_sample_records() + if base.RUN_OVERFIT_TEST: + return run_overfit_mode(model_config) + return run_eval_only_without_ledger(model_config) + + sample_records, _dataset_root = select_sample_records() + ignore_resume_folds_gate = str(base.EXECUTION_MODE).strip().lower() == "eval_only" + + if not ignore_resume_folds_gate and not RESUME_FOLDS and EXPERIMENT_ROOT.exists(): + raise RuntimeError( + f"RESUME_FOLDS=False requires a fresh experiment root, but {EXPERIMENT_ROOT} already exists." + ) + if ( + not ignore_resume_folds_gate + and RESUME_FOLDS + and not EXPERIMENT_DB_PATH.exists() + and EXPERIMENT_ROOT.exists() + and any(EXPERIMENT_ROOT.iterdir()) + ): + raise RuntimeError( + f"Experiment root {EXPERIMENT_ROOT} already exists without a valid SQLite ledger at {EXPERIMENT_DB_PATH}. " + "Refusing to attach to ambiguous state." + ) + + LEDGER_CONN = setup_ledger(EXPERIMENT_DB_PATH) + try: + validate_or_create_experiment(sample_records=sample_records, model_config=model_config) + mark_stale_running_as_interrupted() + + for ctx in iter_manifested_contexts(split_repeat_indices_to_run()): + for strategy in base.STRATEGIES: + reconcile_existing_artifacts(ctx, int(strategy), model_config) + + export_stats() + maybe_reset_study_artifacts(model_config) + + if base.RUN_OVERFIT_TEST: + return run_overfit_mode(model_config) + + run_pass_for_statuses({"interrupted", "running"}, model_config=model_config) + run_pass_for_statuses({"planned"}, model_config=model_config) + export_stats() + if using_fixed_phase_mode(): + base.banner("FIXED PHASE EXECUTION COMPLETE") + else: + base.banner("REPEATED HOLDOUT COMPLETE") + print(f"Experiment root : {EXPERIMENT_ROOT}") + print(f"Experiment DB : {EXPERIMENT_DB_PATH}") + print(f"Raw metrics export : {EXPORTS_DIR / 'raw_run_metrics.csv'}") + print(f"Aggregate export : {EXPORTS_DIR / 'aggregated_metrics_by_percent_strategy.csv'}") + return 0 + finally: + if LEDGER_CONN is not None: + LEDGER_CONN.close() + LEDGER_CONN = None + +def run_single_run_main() -> int: + global DATASET_PERCENTS + banner("MLR ALL STRATEGIES BAYES RUNNER") + DATASET_PERCENTS = normalize_dataset_percents(DATASET_PERCENTS) + set_global_seed(SEED) + model_config = current_model_config() + dataset_name = current_dataset_name() + images_dir, annotations_dir = current_dataset_dirs() + if EXECUTION_MODE not in {"train_eval", "eval_only"}: + raise ValueError(f"EXECUTION_MODE must be 'train_eval' or 'eval_only', got {EXECUTION_MODE!r}") + if SPLIT_TYPE not in SUPPORTED_SPLIT_TYPES: + raise ValueError(f"SPLIT_TYPE must be one of {SUPPORTED_SPLIT_TYPES}, got {SPLIT_TYPE!r}") + if not images_dir.exists() or not annotations_dir.exists(): + raise FileNotFoundError( + f"Expected dataset directories for {dataset_name} under {DATA_ROOT}: " + f"images={images_dir}, masks={annotations_dir}" + ) + ensure_specific_checkpoint_scope("EVAL_CHECKPOINT_MODE", EVAL_CHECKPOINT_MODE) + ensure_specific_checkpoint_scope("STRATEGY2_CHECKPOINT_MODE", STRATEGY2_CHECKPOINT_MODE) + ensure_specific_checkpoint_scope("TRAIN_RESUME_MODE", TRAIN_RESUME_MODE) + + print_environment_summary(model_config) + split_registry, split_source = load_or_create_dataset_splits( + images_dir=images_dir, + annotations_dir=annotations_dir, + split_json_path=current_dataset_splits_json_path(), + train_fractions=DATASET_PERCENTS, + seed=SEED, + ) + + bundles: dict[float, DataBundle] = {} + for percent in DATASET_PERCENTS: + bundles[percent] = build_data_bundle(percent, split_registry, split_source) + + if RUN_OVERFIT_TEST: + run_configured_overfit_tests(bundles, model_config=model_config) + banner("OVERFIT TESTS COMPLETE") + return 0 + + if RESET_ALL_STUDIES_EACH_RUN: + if RUN_OPTUNA: + banner("RESETTING OPTUNA STUDIES") + for strategy in STRATEGIES: + for percent in DATASET_PERCENTS: + reset_study_artifacts(strategy, percent, model_config=model_config) + else: + print("[Optuna Reset] Skipped because RUN_OPTUNA=False.") + + try: + for percent in DATASET_PERCENTS: + banner(f"PERCENT STAGE | {percent_text(percent)}") + bundle = bundles[percent] + for strategy in STRATEGIES: + strategy2_checkpoint_path = None + if strategy == 3 and EXECUTION_MODE == "train_eval" and STRATEGY3_BOOTSTRAP_FROM_STRATEGY2: + strategy2_checkpoint_path = resolve_strategy2_checkpoint_path(strategy, percent, model_config) + + if EXECUTION_MODE == "train_eval": + maybe_run_strategy_smoke_test( + strategy=strategy, + model_config=model_config, + bundle=bundle, + strategy2_checkpoint_path=strategy2_checkpoint_path, + ) + params = resolve_job_params( + strategy, + percent, + bundle, + model_config=model_config, + strategy2_checkpoint_path=strategy2_checkpoint_path, + ) + banner( + f"FINAL RETRAIN | {run_identity_label(strategy=strategy, percent=percent, split_payload=bundle.split_payload)}" + ) + run_final_training( + strategy, + bundle, + params, + model_config=model_config, + strategy2_checkpoint_path=strategy2_checkpoint_path, + ) + else: + banner( + f"EVAL ONLY | {run_identity_label(strategy=strategy, percent=percent, split_payload=bundle.split_payload)}" + ) + run_evaluation_for_run( + strategy=strategy, + percent=percent, + bundle=bundle, + run_dir=final_root_for_strategy(strategy, percent, model_config), + strategy2_checkpoint_path=strategy2_checkpoint_path, + ) + except Exception: + banner("RUN FAILED") + traceback.print_exc() + return 1 + + banner("ALL DONE") + return 0 + + +def main() -> int: + validate_hf_backup_settings() + run_initial_hf_backup() + if EXPERIMENT_MODE not in SUPPORTED_EXPERIMENT_MODES: + raise ValueError( + f"EXPERIMENT_MODE must be one of {SUPPORTED_EXPERIMENT_MODES}, got {EXPERIMENT_MODE!r}" + ) + if EXPERIMENT_MODE == "repeated_holdout": + return run_repeated_holdout_main() + return run_single_run_main() + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/model_stats_s2_vs_s3.py b/model_stats_s2_vs_s3.py new file mode 100644 index 0000000000000000000000000000000000000000..8786fe55ca9fb573f68128f984402ff63b59506a --- /dev/null +++ b/model_stats_s2_vs_s3.py @@ -0,0 +1,392 @@ +"""Paired S3-vs-S2 statistics for each model under runs/, at TWO levels: + + * per_image (Method 1) -- pool every test image across all phases, pair + S3 vs S2 by (phase, sample_id). + * phase_level (Method 2) -- one paired value per phase = the phase-mean of + the metric; pair S3-mean vs S2-mean across phases. + +Same paired machinery as ablation_stats.py: paired t-test, Wilcoxon signed-rank +(zero_method="wilcox"), sign-flip permutation, bootstrap CI for the mean delta, +Hodges-Lehmann estimate + CI, Cohen's dz, rank-biserial r, Shapiro-Wilk on the +diffs, Holm correction. HD95 is the only lower-is-better metric. + +Auto-discovers every model folder directly under runs/ (each distinct MODEL_NAME). +One .xlsx per model + a combined cross-model summary. + +Usage: + python model_stats_s2_vs_s3.py # scans ./runs + python model_stats_s2_vs_s3.py --runs-root X +""" +from __future__ import annotations + +import argparse +import json +import pathlib +import re +from collections import defaultdict + +import numpy as np +import pandas as pd +from scipy import stats + +# metric -> higher_is_better +METRICS = { + "biou_contour": True, # manuscript's reported "BIoU" (1-px contour) + "biou": True, # Cheng et al. CVPR 2021 d-pixel band Boundary IoU + "dice": True, + "iou": True, + "ppv": True, + "sen": True, + "hd95": False, # lower is better +} +PRIMARY = "biou_contour" +ALPHA = 0.05 +N_BOOT = 20000 +N_BOOT_HL = 4000 +N_PERM = 20000 +SEED = 20260709 + +# S3 is the first arm, S2 the second: Mean_delta = S3 - S2, positive favours S3 +LABEL = {2: "S2 (baseline)", 3: "S3 (refinement)"} + + +# ---------------------------------------------------------------- stats helpers +def holm(pvals): + pvals = np.asarray(pvals, dtype=float) + order = np.argsort(pvals) + m = len(pvals) + adj = np.empty(m) + running = 0.0 + for rank, idx in enumerate(order): + running = max(running, (m - rank) * pvals[idx]) + adj[idx] = min(running, 1.0) + return adj + + +def boot_ci_mean(d, rng): + idx = rng.integers(0, len(d), size=(N_BOOT, len(d))) + return np.percentile(d[idx].mean(axis=1), [2.5, 97.5]) + + +def hodges_lehmann(d): + i, j = np.triu_indices(len(d), k=0) + return float(np.median((d[i] + d[j]) / 2.0)) + + +def boot_ci_hl(d, rng): + idx = rng.integers(0, len(d), size=(N_BOOT_HL, len(d))) + return np.percentile([hodges_lehmann(d[r]) for r in idx], [2.5, 97.5]) + + +def sign_flip_perm_p(d, rng): + obs = abs(d.mean()) + signs = rng.choice([-1.0, 1.0], size=(N_PERM, len(d))) + null = np.abs((signs * d).mean(axis=1)) + return (np.sum(null >= obs - 1e-15) + 1) / (N_PERM + 1) + + +def rank_biserial(d): + nz = d[d != 0] + if len(nz) == 0: + return 0.0 + r = stats.rankdata(np.abs(nz)) + rp, rm = r[nz > 0].sum(), r[nz < 0].sum() + return float((rp - rm) / (rp + rm)) + + +def analyse(x, y, metric, higher_better, level, rng): + """x = S3 vector, y = S2 vector (paired). Returns (rows, delta).""" + d = np.asarray(x, float) - np.asarray(y, float) + n = len(d) + mean_d, sd_d = float(d.mean()), float(d.std(ddof=1)) if n > 1 else float("nan") + se = sd_d / np.sqrt(n) if n > 1 else float("nan") + + if n >= 2: + t_stat, p_t = stats.ttest_rel(x, y) + crit = stats.t.ppf(1 - ALPHA / 2, df=n - 1) + t_ci = (mean_d - crit * se, mean_d + crit * se) + else: + t_stat, p_t, t_ci = np.nan, 1.0, (np.nan, np.nan) + + if n >= 1 and not np.allclose(d, 0): + try: + w_stat, p_w = stats.wilcoxon(x, y, zero_method="wilcox", alternative="two-sided") + except ValueError: + w_stat, p_w = np.nan, 1.0 + else: + w_stat, p_w = np.nan, 1.0 + + p_perm = sign_flip_perm_p(d, rng) if n >= 1 else 1.0 + b_lo, b_hi = boot_ci_mean(d, rng) if n >= 2 else (np.nan, np.nan) + hl = hodges_lehmann(d) if n >= 1 else np.nan + hl_lo, hl_hi = boot_ci_hl(d, rng) if n >= 2 else (np.nan, np.nan) + shapiro_p = float(stats.shapiro(d).pvalue) if (n >= 3 and not np.allclose(d, 0)) else np.nan + p_holm_c = holm([p_t, p_w, p_perm]) + + better = (mean_d > 0) == higher_better + winner = LABEL[3] if better else LABEL[2] + + rows = [] + for name, stat, p_raw, p_adj in [ + ("Paired t-test", float(t_stat), float(p_t), p_holm_c[0]), + ("Wilcoxon signed-rank", float(w_stat), float(p_w), p_holm_c[1]), + ("Sign-flip permutation", mean_d, float(p_perm), p_holm_c[2]), + ]: + rows.append({ + "Level": level, "Metric": metric, "Higher_is_better": higher_better, + "Contrast": "S3 - S2", "Test": name, "n_pairs": n, + "n_zero_diff": int(np.sum(d == 0)), "Statistic": stat, + "Mean_delta": mean_d, "SD_delta": sd_d, "p_raw": p_raw, + "p_Holm_within_metric_level": p_adj, + "Sig_within_metric_level": "Yes" if p_adj < ALPHA else "No", + "Better_arm": winner if p_adj < ALPHA else "n.s.", + "t_CI_low": t_ci[0], "t_CI_high": t_ci[1], + "boot_CI_low": b_lo, "boot_CI_high": b_hi, + "CI_excludes_zero": "Yes" if (b_lo > 0) or (b_hi < 0) else "No", + "HodgesLehmann_delta": hl, "HL_CI_low": hl_lo, "HL_CI_high": hl_hi, + "Cohens_dz": mean_d / sd_d if (sd_d and sd_d > 0) else np.nan, + "Rank_biserial_r": rank_biserial(d), + "Shapiro_p_on_diffs": shapiro_p, + "Diffs_normal_at_0.05": "n/a" if np.isnan(shapiro_p) else ("No" if shapiro_p < ALPHA else "Yes"), + }) + return rows, d + + +# ---------------------------------------------------------------- discovery +def read_threshold(final_dir: pathlib.Path): + rc = final_dir / "run_config.json" + if rc.exists(): + try: + return json.loads(rc.read_text()).get("threshold") + except Exception: + return None + return None + + +def discover(runs_root: pathlib.Path): + """model -> phase -> strategy -> {'per_sample': {sid: row}, 'threshold': float}""" + data: dict[str, dict[int, dict[int, dict]]] = defaultdict(lambda: defaultdict(dict)) + for ev in runs_root.glob("*/**/strategy_*/final/evaluation.json"): + final_dir = ev.parent + ms = re.search(r"strategy_(\d+)", final_dir.parent.name) + if not ms: + continue + s = int(ms.group(1)) + if s not in (2, 3): + continue + try: + model = ev.relative_to(runs_root).parts[0] + except ValueError: + continue + pm = re.search(r"phase_(\d+)", str(ev)) + phase = int(pm.group(1)) if pm else 1 + try: + payload = json.loads(ev.read_text()) + except Exception: + continue + data[model][phase][s] = { + "per_sample": {row["sample_id"]: row for row in payload.get("per_sample", [])}, + "threshold": read_threshold(final_dir), + } + return data + + +# ---------------------------------------------------------------- per model +def analyse_model(model, phase_map, rng): + phases = sorted(p for p in phase_map if 2 in phase_map[p] and 3 in phase_map[p]) + if not phases: + return None + + # per-image pooled arrays + per-phase means + img = {m: {2: [], 3: []} for m in METRICS} + phase_mean = {m: {2: [], 3: []} for m in METRICS} + phase_used, n_img_per_phase, split_warnings = [], [], [] + thr = {2: None, 3: None} + + for p in phases: + s2, s3 = phase_map[p][2], phase_map[p][3] + thr[2] = thr[2] or s2.get("threshold") + thr[3] = thr[3] or s3.get("threshold") + set2, set3 = set(s2["per_sample"]), set(s3["per_sample"]) + if set2 != set3: + split_warnings.append(f"phase {p}: S2/S3 sample_id sets differ " + f"(|S2|={len(set2)}, |S3|={len(set3)}, common={len(set2 & set3)})") + ids = sorted(set2 & set3) + if not ids: + continue + phase_used.append(p) + n_img_per_phase.append(len(ids)) + for m in METRICS: + v2 = np.array([s2["per_sample"][i][m] for i in ids], float) + v3 = np.array([s3["per_sample"][i][m] for i in ids], float) + img[m][2].append(v2) + img[m][3].append(v3) + phase_mean[m][2].append(float(v2.mean())) + phase_mean[m][3].append(float(v3.mean())) + + test_rows, desc_rows = [], [] + per_image = {"phase": np.concatenate([[p] * n for p, n in zip(phase_used, n_img_per_phase)]).astype(int)} + per_phase = {"phase": np.array(phase_used, int)} + + for m, hib in METRICS.items(): + x_img = np.concatenate(img[m][3]) if img[m][3] else np.array([]) + y_img = np.concatenate(img[m][2]) if img[m][2] else np.array([]) + pm2 = np.array(phase_mean[m][2], float) + pm3 = np.array(phase_mean[m][3], float) + + # descriptives, both levels + for s, arr_img, arr_ph in [(2, y_img, pm2), (3, x_img, pm3)]: + desc_rows.append({ + "Metric": m, "Higher_is_better": hib, "Arm": LABEL[s], + "n_images": len(arr_img), "img_Mean": arr_img.mean() if len(arr_img) else np.nan, + "img_SD": arr_img.std(ddof=1) if len(arr_img) > 1 else np.nan, + "img_Median": np.median(arr_img) if len(arr_img) else np.nan, + "n_phases": len(arr_ph), "phase_Mean": arr_ph.mean() if len(arr_ph) else np.nan, + "phase_SD": arr_ph.std(ddof=1) if len(arr_ph) > 1 else np.nan, + }) + + # per_image tests + rows, d_img = analyse(x_img, y_img, m, hib, "per_image", rng) + test_rows.extend(rows) + per_image[f"{m}__S2"] = y_img + per_image[f"{m}__S3"] = x_img + per_image[f"{m}__delta_S3_minus_S2"] = d_img + + # phase_level tests + rows_ph, d_ph = analyse(pm3, pm2, m, hib, "phase_level", rng) + test_rows.extend(rows_ph) + per_phase[f"{m}__S2_phase_mean"] = pm2 + per_phase[f"{m}__S3_phase_mean"] = pm3 + per_phase[f"{m}__delta_S3_minus_S2"] = d_ph + + tests_df = pd.DataFrame(test_rows) + # global Holm across this model's whole workbook (metrics x 2 levels x 3 tests) + tests_df["p_Holm_global"] = holm(tests_df["p_raw"].values) + tests_df["Sig_global"] = np.where(tests_df["p_Holm_global"] < ALPHA, "Yes", "No") + + return { + "phases": phase_used, + "thr": thr, + "split_warnings": split_warnings, + "tests": tests_df, + "descriptives": pd.DataFrame(desc_rows), + "per_image": pd.DataFrame(per_image), + "per_phase": pd.DataFrame(per_phase), + } + + +def readme_frame(model, res): + return pd.DataFrame({"Field": [ + "Model", "Contrast", "Phases used", "n phases", "S2 threshold", "S3 threshold", + "per_image level", "phase_level level", "Metrics", "PRIMARY", "hd95 direction", + "Wilcoxon zero handling", "Bootstrap", "Permutation", "Holm scope", + "Split check", "Split warnings", "Seed", + ], "Value": [ + model, "S3 (refinement) - S2 (baseline); positive delta favours S3", + ", ".join(map(str, res["phases"])), len(res["phases"]), + str(res["thr"][2]), str(res["thr"][3]), + "pool all test images across phases, paired by (phase, sample_id) [manuscript Method 1]", + "one paired value per phase = phase-mean of the metric, paired across phases [manuscript Method 2]", + ", ".join(METRICS), PRIMARY, "LOWER is better; direction handled in Better_arm", + "zero_method='wilcox' (zero diffs dropped)", + f"{N_BOOT} resamples for mean-delta CI; {N_BOOT_HL} for Hodges-Lehmann", + f"{N_PERM} sign flips; p floor ~= 1/{N_PERM + 1}", + "Holm across every test in this workbook (metrics x 2 levels x 3 tests) = p_Holm_global", + "asserted S2 and S3 test sample_id sets identical within each phase", + "; ".join(res["split_warnings"]) if res["split_warnings"] else "none", + f"numpy default_rng({SEED})", + ]}) + + +def write_workbook(model, res, out_dir): + out = out_dir / f"{model}__s2_vs_s3_stats.xlsx" + try: + with pd.ExcelWriter(out, engine="openpyxl") as xl: + readme_frame(model, res).to_excel(xl, sheet_name="README", index=False) + res["descriptives"].to_excel(xl, sheet_name="Descriptives", index=False) + res["tests"].to_excel(xl, sheet_name="Tests", index=False) + res["per_phase"].to_excel(xl, sheet_name="PerPhase", index=False) + res["per_image"].to_excel(xl, sheet_name="PerImage", index=False) + for sh in xl.book.worksheets: + for col in sh.columns: + w = max((len(str(c.value)) if c.value is not None else 0) for c in col) + sh.column_dimensions[col[0].column_letter].width = min(max(w + 2, 12), 62) + sh.freeze_panes = "A2" + return out + except Exception as exc: # openpyxl missing -> CSV fallback + print(f"[stats] xlsx failed for {model} ({exc}); writing CSVs instead") + res["tests"].to_csv(out_dir / f"{model}__tests.csv", index=False) + res["descriptives"].to_csv(out_dir / f"{model}__descriptives.csv", index=False) + res["per_phase"].to_csv(out_dir / f"{model}__per_phase.csv", index=False) + return None + + +def main() -> int: + ap = argparse.ArgumentParser() + ap.add_argument("--runs-root", default="runs") + args = ap.parse_args() + + runs_root = pathlib.Path(args.runs_root).resolve() + if not runs_root.is_dir(): + print(f"[stats] runs root not found: {runs_root}") + return 1 + + data = discover(runs_root) + if not data: + print(f"[stats] no evaluation.json found under {runs_root}") + return 1 + + out_dir = runs_root / "_stats" + out_dir.mkdir(parents=True, exist_ok=True) + rng = np.random.default_rng(SEED) + + summary_rows = [] + for model in sorted(data): + res = analyse_model(model, data[model], rng) + if res is None: + print(f"[stats] {model}: no phase has both S2 and S3 -- skipped") + continue + wb = write_workbook(model, res, out_dir) + print(f"[stats] {model:28s} phases={len(res['phases'])} -> {wb.name if wb else '(csv)'}" + + (" [SPLIT WARNINGS]" if res["split_warnings"] else "")) + + # headline: Wilcoxon row per metric per level for the cross-model summary + t = res["tests"] + for m in METRICS: + for level in ("per_image", "phase_level"): + r = t[(t.Metric == m) & (t.Level == level) & (t.Test == "Wilcoxon signed-rank")] + if r.empty: + continue + r = r.iloc[0] + summary_rows.append({ + "Model": model, "Metric": m, "Level": level, "n_pairs": int(r.n_pairs), + "S3_minus_S2": r.Mean_delta, "Wilcoxon_p_raw": r.p_raw, + "p_Holm_global": r.p_Holm_global, "Sig_global": r.Sig_global, + "Better_arm": r.Better_arm, "Cohens_dz": r.Cohens_dz, + "boot_CI_low": r.boot_CI_low, "boot_CI_high": r.boot_CI_high, + }) + + summary_df = pd.DataFrame(summary_rows) + summary_df.to_csv(out_dir / "ALL_MODELS_summary.csv", index=False) + try: + with pd.ExcelWriter(out_dir / "ALL_MODELS_summary.xlsx", engine="openpyxl") as xl: + summary_df.to_excel(xl, sheet_name="Summary", index=False) + for sh in xl.book.worksheets: + for col in sh.columns: + w = max((len(str(c.value)) if c.value is not None else 0) for c in col) + sh.column_dimensions[col[0].column_letter].width = min(max(w + 2, 12), 40) + sh.freeze_panes = "A2" + except Exception: + pass + + print(f"\n[stats] wrote per-model workbooks + ALL_MODELS_summary to {out_dir}") + if not summary_df.empty: + pd.set_option("display.width", 240, "display.max_columns", 40) + prim = summary_df[summary_df.Metric == PRIMARY] + print(f"\n=== PRIMARY ({PRIMARY}) S3-vs-S2, both levels ===") + print(prim.to_string(index=False, float_format=lambda v: f"{v:.4g}")) + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/params/models_manifest.json b/params/models_manifest.json new file mode 100644 index 0000000000000000000000000000000000000000..82d68fa3473d1918e6db274b21c6f3766561c1f4 --- /dev/null +++ b/params/models_manifest.json @@ -0,0 +1,50 @@ +{ + "segformer_b0": { + "family": "transformer", + "model_name": "Segformer_B0", + "arch": "Segformer", + "encoder": "mit_b0", + "proj_dim": 192, + "params_dir": "params/segformer_b0" + }, + "unet_effb0": { + "family": "cnn", + "model_name": "Unet_EffB0", + "arch": "Unet", + "encoder": "efficientnet-b0", + "proj_dim": 256, + "params_dir": "params/unet_effb0" + }, + "deeplabv3plus_r34": { + "family": "cnn", + "model_name": "DeepLabV3Plus_ResNet34", + "arch": "DeepLabV3Plus", + "encoder": "resnet34", + "proj_dim": 256, + "params_dir": "params/deeplabv3plus_r34" + }, + "linknet_mbv3": { + "family": "cnn", + "model_name": "Linknet_MobileNetV3", + "arch": "Linknet", + "encoder": "timm-mobilenetv3_large_100", + "proj_dim": 256, + "params_dir": "params/linknet_mbv3" + }, + "upernet_pvtv2_b1": { + "family": "transformer", + "model_name": "UPerNet_PVTv2_b1", + "arch": "UPerNet", + "encoder": "tu-pvt_v2_b1", + "proj_dim": 192, + "params_dir": "params/upernet_pvtv2_b1" + }, + "upernet_pvtv2_b2": { + "family": "transformer", + "model_name": "UPerNet_PVTv2_b2", + "arch": "UPerNet", + "encoder": "tu-pvt_v2_b2", + "proj_dim": 192, + "params_dir": "params/upernet_pvtv2_b2" + } +} diff --git a/plot_s2_vs_s3.py b/plot_s2_vs_s3.py new file mode 100644 index 0000000000000000000000000000000000000000..585356c1f5e9fc6f9ebfd74264dc38dd633a3aac --- /dev/null +++ b/plot_s2_vs_s3.py @@ -0,0 +1,216 @@ +"""Scan runs/ and, for every model, plot Strategy 2 (supervised baseline) vs +Strategy 3 (refinement), AVERAGED ACROSS ALL PHASES found for that model. + +Six measures per model (mean across phases, error bars = std across phases): + + * BIoU (band, d-pixel) evaluation.json -> metrics.biou.mean + * BIoU (contour, 1-pixel) evaluation.json -> metrics.biou_contour.mean + * Total training time (min) summary.json -> elapsed_seconds + * Inference time (ms/image) evaluation.json -> timing.mean_per_image_inference_ms + * Time per epoch (s) summary.json -> seconds_per_epoch + * Time to best ckpt (min) best.pt.meta.json -> epoch x seconds_per_epoch + (falls back to argmax of selection_metric_value in history.json) + +Usage: + python plot_s2_vs_s3.py # scans ./runs + python plot_s2_vs_s3.py --runs-root X +""" +from __future__ import annotations + +import argparse +import json +import pathlib +import re +from collections import defaultdict + +import matplotlib +matplotlib.use("Agg") +import matplotlib.pyplot as plt +import numpy as np + +STRATEGY_LABEL = {2: "S2 (baseline)", 3: "S3 (refinement)"} +BAR_COLORS = {2: "#4C78A8", 3: "#F58518"} + +# key, title, ylabel, higher_is_better, value format +PANELS = [ + ("biou", "Boundary IoU (band)", "BIoU", True, "{:.4f}"), + ("biou_contour", "Boundary IoU (contour)", "BIoU contour", True, "{:.4f}"), + ("infer_ms", "Inference time", "ms / image", False, "{:.2f}"), + ("train_min", "Total training time", "minutes", False, "{:.1f}"), + ("epoch_sec", "Time per epoch", "seconds", False, "{:.1f}"), + ("time_to_best_min", "Time to best checkpoint", "minutes", False, "{:.1f}"), +] + + +def load_json(path: pathlib.Path): + try: + return json.loads(path.read_text(encoding="utf-8")) + except Exception: + return None + + +def best_epoch_for(final_dir: pathlib.Path) -> int | None: + """Epoch at which the best checkpoint was saved.""" + meta = load_json(final_dir / "checkpoints" / "best.pt.meta.json") + if meta and meta.get("epoch") is not None: + return int(meta["epoch"]) + + # fallback: argmax of the selection metric recorded in history + hist = load_json(final_dir / "history.json") + if isinstance(hist, list) and hist: + best_ep, best_val = None, None + for row in hist: + val = row.get("selection_metric_value") + if val is None: + continue + if best_val is None or float(val) > float(best_val): + best_val, best_ep = float(val), int(row.get("epoch", 0)) + return best_ep + return None + + +def collect(runs_root: pathlib.Path) -> dict[str, dict[int, dict[str, list[float]]]]: + """model -> strategy -> metric -> [one value per phase]""" + data: dict[str, dict[int, dict[str, list[float]]]] = defaultdict( + lambda: defaultdict(lambda: defaultdict(list)) + ) + for eval_path in runs_root.glob("*/**/strategy_*/final/evaluation.json"): + final_dir = eval_path.parent + m = re.search(r"strategy_(\d+)", final_dir.parent.name) + if not m: + continue + strategy = int(m.group(1)) + if strategy not in (2, 3): + continue + try: + model = eval_path.relative_to(runs_root).parts[0] + except ValueError: + continue + + ev = load_json(eval_path) + if not ev: + continue + bucket = data[model][strategy] + metrics = ev.get("metrics", {}) or {} + + for key in ("biou", "biou_contour"): + val = (metrics.get(key) or {}).get("mean") + if val is not None: + bucket[key].append(float(val)) + + infer = (ev.get("timing", {}) or {}).get("mean_per_image_inference_ms") + if infer is not None: + bucket["infer_ms"].append(float(infer)) + + summary = load_json(final_dir / "summary.json") + if summary: + if summary.get("elapsed_seconds") is not None: + bucket["train_min"].append(float(summary["elapsed_seconds"]) / 60.0) + spe = summary.get("seconds_per_epoch") + if spe is not None: + bucket["epoch_sec"].append(float(spe)) + be = best_epoch_for(final_dir) + if be: + bucket["time_to_best_min"].append(be * float(spe) / 60.0) + + return data + + +def plot_model(model: str, per_strategy: dict[int, dict[str, list[float]]], + out_dir: pathlib.Path) -> pathlib.Path | None: + strategies = [s for s in (2, 3) if per_strategy.get(s)] + if not strategies: + return None + + n_phases = max((len(v.get("biou", [])) for v in per_strategy.values()), default=0) + fig, axes = plt.subplots(2, 3, figsize=(16, 8.5)) + fig.suptitle(f"{model} — Strategy 2 vs Strategy 3\n" + f"mean across {n_phases} phase(s), error bars = std across phases", + fontsize=14, fontweight="bold") + + for ax, (key, title, ylabel, higher_better, fmt) in zip(axes.ravel(), PANELS): + xs, means, stds, labels, colors = [], [], [], [], [] + for i, s in enumerate(strategies): + vals = per_strategy[s].get(key, []) + if not vals: + continue + xs.append(i) + means.append(float(np.mean(vals))) + stds.append(float(np.std(vals)) if len(vals) > 1 else 0.0) + labels.append(STRATEGY_LABEL[s]) + colors.append(BAR_COLORS[s]) + + if not means: + ax.set_title(f"{title} (no data)") + ax.axis("off") + continue + + bars = ax.bar(xs, means, yerr=stds, capsize=5, color=colors, width=0.55) + ax.set_xticks(xs) + ax.set_xticklabels(labels, fontsize=9) + ax.set_ylabel(ylabel) + ax.set_title(f"{title} ({'higher' if higher_better else 'lower'} is better)", fontsize=11) + ax.grid(axis="y", alpha=0.3, linestyle="--") + ax.margins(y=0.18) + + for b, mval in zip(bars, means): + ax.annotate(fmt.format(mval), (b.get_x() + b.get_width() / 2, b.get_height()), + textcoords="offset points", xytext=(0, 4), ha="center", fontsize=9) + + if len(means) == 2: + delta = means[1] - means[0] + pct = (delta / means[0] * 100.0) if means[0] else 0.0 + good = (delta > 0) if higher_better else (delta < 0) + ax.text(0.5, 0.02, f"Δ(S3−S2) = {delta:+.4g} ({pct:+.1f}%)", + transform=ax.transAxes, ha="center", fontsize=9, + color=("green" if good else "red")) + + fig.tight_layout(rect=(0, 0, 1, 0.93)) + out_dir.mkdir(parents=True, exist_ok=True) + out_path = out_dir / f"{model}__s2_vs_s3.png" + fig.savefig(out_path, dpi=150) + plt.close(fig) + return out_path + + +def main() -> int: + ap = argparse.ArgumentParser() + ap.add_argument("--runs-root", default="runs") + args = ap.parse_args() + + runs_root = pathlib.Path(args.runs_root).resolve() + if not runs_root.is_dir(): + print(f"[plot] runs root not found: {runs_root}") + return 1 + + data = collect(runs_root) + if not data: + print(f"[plot] no evaluation.json found under {runs_root}") + return 1 + + out_dir = runs_root / "_plots" + csv_rows = ["model,strategy,metric,mean,std,n_phases"] + made = [] + + for model in sorted(data): + p = plot_model(model, data[model], out_dir) + if p: + made.append(p) + n = max((len(v.get("biou", [])) for v in data[model].values()), default=0) + print(f"[plot] {model:34s} n_phases={n:<3d} -> {p.name}") + for s in sorted(data[model]): + for key, *_ in PANELS: + vals = data[model][s].get(key, []) + if vals: + csv_rows.append( + f"{model},{s},{key},{np.mean(vals):.6f}," + f"{(np.std(vals) if len(vals) > 1 else 0.0):.6f},{len(vals)}" + ) + + (out_dir / "summary_s2_vs_s3.csv").write_text("\n".join(csv_rows) + "\n", encoding="utf-8") + print(f"\n[plot] {len(made)} figure(s) + summary_s2_vs_s3.csv written to {out_dir}") + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/requirements_runpod.txt b/requirements_runpod.txt new file mode 100644 index 0000000000000000000000000000000000000000..053ca365d696b8d9d7a7f7d5c5ea760979b647a1 --- /dev/null +++ b/requirements_runpod.txt @@ -0,0 +1,13 @@ +# Use this with a RunPod PyTorch image that already includes torch/torchvision + CUDA. +# This avoids wasting setup time reinstalling large GPU wheels. + +numpy>=1.24.0 +scipy>=1.10.0 +pillow>=10.0.0 +tqdm>=4.66.0 +matplotlib>=3.8.0 +pandas>=2.2.0 +openpyxl>=3.1.0 +optuna>=3.6.0 +segmentation-models-pytorch>=0.5.0 +timm>=1.0.0 \ No newline at end of file diff --git a/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/experiment_state.sqlite3 b/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/experiment_state.sqlite3 new file mode 100644 index 0000000000000000000000000000000000000000..84e5962084b4d73381766df031b655626fc2fae7 Binary files /dev/null and b/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/experiment_state.sqlite3 differ diff --git a/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/exports/aggregated_metrics_by_percent_strategy.csv b/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/exports/aggregated_metrics_by_percent_strategy.csv new file mode 100644 index 0000000000000000000000000000000000000000..553b3d0f8016e15cdae02b6d17e037d250c4c8ad --- /dev/null +++ b/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/exports/aggregated_metrics_by_percent_strategy.csv @@ -0,0 +1,3 @@ +biou_contour_mean,biou_contour_std,biou_contour_within_run_std_mean,biou_mean,biou_std,biou_within_run_std_mean,completed_phase_count,completed_phases,dataset_percent,dice_mean,dice_std,dice_within_run_std_mean,hd95_mean,hd95_std,hd95_within_run_std_mean,iou_mean,iou_std,iou_within_run_std_mean,n_runs,ppv_mean,ppv_std,ppv_within_run_std_mean,sen_mean,sen_std,sen_within_run_std_mean,split_generation_mode,strategy +0.10658753663301468,0.007339854717964752,0.08429641127586365,0.38765804171562196,0.018165690360599084,0.21831948757171632,5,"2,3,4,9,10",100,0.779808759689331,0.014647414633594986,0.243904447555542,12.895025062561036,1.796037401561253,21.965408325195312,0.6889553785324096,0.011983966508109928,0.25024294555187226,5,0.8218204975128174,0.009422276608595955,0.23497852087020873,0.7984434843063355,0.024920658867602998,0.25239624083042145,fixed_stratified_phases_8_1_1,2 +0.15978023707866668,0.021218451908610055,0.12744158655405044,0.45167040824890137,0.030927701615027236,0.24558151960372926,5,"2,3,4,9,10",100,0.8045141458511352,0.02037104769957007,0.2366455763578415,11.593777847290038,1.7023791352209379,18.272854232788085,0.7224233269691467,0.01810482451855519,0.2474461168050766,5,0.8372180461883545,0.008289385576892344,0.24025410711765288,0.8173958659172058,0.03127828085396388,0.23604983687400818,fixed_stratified_phases_8_1_1,3 diff --git a/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/exports/aggregated_metrics_by_percent_strategy.json b/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/exports/aggregated_metrics_by_percent_strategy.json new file mode 100644 index 0000000000000000000000000000000000000000..5b23d118510e52a9626c9fc2025975dda6d5c657 --- /dev/null +++ b/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/exports/aggregated_metrics_by_percent_strategy.json @@ -0,0 +1,60 @@ +[ + { + "biou_contour_mean": 0.10658753663301468, + "biou_contour_std": 0.007339854717964752, + "biou_contour_within_run_std_mean": 0.08429641127586365, + "biou_mean": 0.38765804171562196, + "biou_std": 0.018165690360599084, + "biou_within_run_std_mean": 0.21831948757171632, + "completed_phase_count": 5, + "completed_phases": "2,3,4,9,10", + "dataset_percent": 100, + "dice_mean": 0.779808759689331, + "dice_std": 0.014647414633594986, + "dice_within_run_std_mean": 0.243904447555542, + "hd95_mean": 12.895025062561036, + "hd95_std": 1.796037401561253, + "hd95_within_run_std_mean": 21.965408325195312, + "iou_mean": 0.6889553785324096, + "iou_std": 0.011983966508109928, + "iou_within_run_std_mean": 0.25024294555187226, + "n_runs": 5, + "ppv_mean": 0.8218204975128174, + "ppv_std": 0.009422276608595955, + "ppv_within_run_std_mean": 0.23497852087020873, + "sen_mean": 0.7984434843063355, + "sen_std": 0.024920658867602998, + "sen_within_run_std_mean": 0.25239624083042145, + "split_generation_mode": "fixed_stratified_phases_8_1_1", + "strategy": 2 + }, + { + "biou_contour_mean": 0.15978023707866668, + "biou_contour_std": 0.021218451908610055, + "biou_contour_within_run_std_mean": 0.12744158655405044, + "biou_mean": 0.45167040824890137, + "biou_std": 0.030927701615027236, + "biou_within_run_std_mean": 0.24558151960372926, + "completed_phase_count": 5, + "completed_phases": "2,3,4,9,10", + "dataset_percent": 100, + "dice_mean": 0.8045141458511352, + "dice_std": 0.02037104769957007, + "dice_within_run_std_mean": 0.2366455763578415, + "hd95_mean": 11.593777847290038, + "hd95_std": 1.7023791352209379, + "hd95_within_run_std_mean": 18.272854232788085, + "iou_mean": 0.7224233269691467, + "iou_std": 0.01810482451855519, + "iou_within_run_std_mean": 0.2474461168050766, + "n_runs": 5, + "ppv_mean": 0.8372180461883545, + "ppv_std": 0.008289385576892344, + "ppv_within_run_std_mean": 0.24025410711765288, + "sen_mean": 0.8173958659172058, + "sen_std": 0.03127828085396388, + "sen_within_run_std_mean": 0.23604983687400818, + "split_generation_mode": "fixed_stratified_phases_8_1_1", + "strategy": 3 + } +] \ No newline at end of file diff --git a/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/exports/raw_run_metrics.csv b/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/exports/raw_run_metrics.csv new file mode 100644 index 0000000000000000000000000000000000000000..d4395321ddbb28f427e0d4de3bda022a945dbff8 --- /dev/null +++ b/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/exports/raw_run_metrics.csv @@ -0,0 +1,11 @@ +biou_contour_mean,biou_contour_std,biou_mean,biou_std,dataset_percent,dice_mean,dice_std,evaluation_path,hd95_mean,hd95_std,iou_mean,iou_std,phase_index,phase_test_fold_index,phase_val_fold_index,ppv_mean,ppv_std,run_dir,sen_mean,sen_std,split_generation_mode,split_manifest_path,split_repeat_index,strategy,subset_manifest_path,subset_repeat_index +0.10553458333015442,0.07625986635684967,0.3781984746456146,0.2127406746149063,100,0.7896647453308105,0.2421818971633911,/workspace/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/phase_002/pct_100/repeat_01/strategy_2/final/evaluation.json,15.18199348449707,27.79026985168457,0.7016277313232422,0.2495580017566681,2,2,3,0.824587881565094,0.23476456105709076,/workspace/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/phase_002/pct_100/repeat_01/strategy_2/final,0.8144153952598572,0.24154168367385864,fixed_stratified_phases_8_1_1,/workspace/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/manifests/splits/phase_002.json,2,2,/workspace/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/manifests/subsets/phase_002_pct_100_repeat_01.json,1 +0.1427242010831833,0.11678919941186905,0.42219021916389465,0.24058061838150024,100,0.8018195033073425,0.24565258622169495,/workspace/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/phase_002/pct_100/repeat_01/strategy_3/final/evaluation.json,12.99763011932373,19.484420776367188,0.7207279205322266,0.25497370958328247,2,2,3,0.8248835206031799,0.26045703887939453,/workspace/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/phase_002/pct_100/repeat_01/strategy_3/final,0.8218875527381897,0.23904001712799072,fixed_stratified_phases_8_1_1,/workspace/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/manifests/splits/phase_002.json,2,3,/workspace/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/manifests/subsets/phase_002_pct_100_repeat_01.json,1 +0.10729717463254929,0.08857995271682739,0.3900618553161621,0.21769826114177704,100,0.7913828492164612,0.21163640916347504,/workspace/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/phase_003/pct_100/repeat_01/strategy_2/final/evaluation.json,10.56818962097168,14.067215919494629,0.6934124827384949,0.22467739880084991,3,3,4,0.8115997314453125,0.23191630840301514,/workspace/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/phase_003/pct_100/repeat_01/strategy_2/final,0.8230597376823425,0.22039473056793213,fixed_stratified_phases_8_1_1,/workspace/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/manifests/splits/phase_003.json,3,2,/workspace/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/manifests/subsets/phase_003_pct_100_repeat_01.json,1 +0.1609937846660614,0.13421352207660675,0.4667215049266815,0.2397007793188095,100,0.8267476558685303,0.18645723164081573,/workspace/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/phase_003/pct_100/repeat_01/strategy_3/final/evaluation.json,9.511301040649414,13.27614688873291,0.737328290939331,0.20944608747959137,3,3,4,0.8473854660987854,0.21131612360477448,/workspace/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/phase_003/pct_100/repeat_01/strategy_3/final,0.8498467803001404,0.1796499490737915,fixed_stratified_phases_8_1_1,/workspace/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/manifests/splits/phase_003.json,3,3,/workspace/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/manifests/subsets/phase_003_pct_100_repeat_01.json,1 +0.117262102663517,0.08725402504205704,0.4200691282749176,0.2263152003288269,100,0.7721100449562073,0.2689150869846344,/workspace/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/phase_004/pct_100/repeat_01/strategy_2/final/evaluation.json,12.817033767700195,27.383140563964844,0.6858046054840088,0.2633354365825653,4,4,5,0.8098906874656677,0.2543603479862213,/workspace/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/phase_004/pct_100/repeat_01/strategy_2/final,0.7863260507583618,0.2697471082210541,fixed_stratified_phases_8_1_1,/workspace/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/manifests/splits/phase_004.json,4,2,/workspace/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/manifests/subsets/phase_004_pct_100_repeat_01.json,1 +0.20023024082183838,0.14912749826908112,0.5050680637359619,0.26369938254356384,100,0.8024692535400391,0.27068495750427246,/workspace/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/phase_004/pct_100/repeat_01/strategy_3/final/evaluation.json,10.490487098693848,18.224517822265625,0.7308013439178467,0.2711138427257538,4,4,5,0.8311871290206909,0.2780493199825287,/workspace/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/phase_004/pct_100/repeat_01/strategy_3/final,0.8009200692176819,0.26087698340415955,fixed_stratified_phases_8_1_1,/workspace/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/manifests/splits/phase_004.json,4,3,/workspace/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/manifests/subsets/phase_004_pct_100_repeat_01.json,1 +0.10850856453180313,0.08922477811574936,0.38454005122184753,0.22500698268413544,100,0.7543946504592896,0.28128987550735474,/workspace/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/phase_009/pct_100/repeat_01/strategy_2/final/evaluation.json,14.607939720153809,27.255828857421875,0.6673032641410828,0.2768732011318207,9,9,10,0.8306177854537964,0.2499452531337738,/workspace/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/phase_009/pct_100/repeat_01/strategy_2/final,0.7551219463348389,0.29069170355796814,fixed_stratified_phases_8_1_1,/workspace/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/manifests/splits/phase_009.json,9,2,/workspace/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/manifests/subsets/phase_009_pct_100_repeat_01.json,1 +0.1443328559398651,0.11686944216489792,0.4260050058364868,0.24544110894203186,100,0.769157886505127,0.2825092673301697,/workspace/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/phase_009/pct_100/repeat_01/strategy_3/final/evaluation.json,14.124567985534668,27.15265655517578,0.6880638003349304,0.27892905473709106,9,9,10,0.844323456287384,0.250375360250473,/workspace/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/phase_009/pct_100/repeat_01/strategy_3/final,0.7663120031356812,0.2920166254043579,fixed_stratified_phases_8_1_1,/workspace/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/manifests/splits/phase_009.json,9,3,/workspace/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/manifests/subsets/phase_009_pct_100_repeat_01.json,1 +0.09433525800704956,0.08016343414783478,0.36542069911956787,0.20983631908893585,100,0.7914915084838867,0.21549896895885468,/workspace/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/phase_010/pct_100/repeat_01/strategy_2/final/evaluation.json,11.299968719482422,13.330586433410645,0.6966288089752197,0.23677068948745728,10,10,1,0.8324064016342163,0.2039061337709427,/workspace/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/phase_010/pct_100/repeat_01/strategy_2/final,0.8132942914962769,0.23960597813129425,fixed_stratified_phases_8_1_1,/workspace/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/manifests/splits/phase_010.json,10,2,/workspace/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/manifests/subsets/phase_010_pct_100_repeat_01.json,1 +0.15062010288238525,0.1202082708477974,0.43836724758148193,0.23848570883274078,100,0.8223764300346375,0.19792383909225464,/workspace/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/phase_010/pct_100/repeat_01/strategy_3/final/evaluation.json,10.844902992248535,13.226529121398926,0.7351952791213989,0.2227678894996643,10,10,1,0.8383106589317322,0.20107269287109375,/workspace/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/phase_010/pct_100/repeat_01/strategy_3/final,0.8480129241943359,0.2086656093597412,fixed_stratified_phases_8_1_1,/workspace/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/manifests/splits/phase_010.json,10,3,/workspace/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/manifests/subsets/phase_010_pct_100_repeat_01.json,1 diff --git a/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/exports/raw_run_metrics.json b/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/exports/raw_run_metrics.json new file mode 100644 index 0000000000000000000000000000000000000000..83ca963e3960a4675c312a7f392d8deea0022b99 --- /dev/null +++ b/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/exports/raw_run_metrics.json @@ -0,0 +1,282 @@ +[ + { + "biou_contour_mean": 0.10553458333015442, + "biou_contour_std": 0.07625986635684967, + "biou_mean": 0.3781984746456146, + "biou_std": 0.2127406746149063, + "dataset_percent": 100, + "dice_mean": 0.7896647453308105, + "dice_std": 0.2421818971633911, + "evaluation_path": "/workspace/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/phase_002/pct_100/repeat_01/strategy_2/final/evaluation.json", + "hd95_mean": 15.18199348449707, + "hd95_std": 27.79026985168457, + "iou_mean": 0.7016277313232422, + "iou_std": 0.2495580017566681, + "phase_index": 2, + "phase_test_fold_index": 2, + "phase_val_fold_index": 3, + "ppv_mean": 0.824587881565094, + "ppv_std": 0.23476456105709076, + "run_dir": "/workspace/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/phase_002/pct_100/repeat_01/strategy_2/final", + "sen_mean": 0.8144153952598572, + "sen_std": 0.24154168367385864, + "split_generation_mode": "fixed_stratified_phases_8_1_1", + "split_manifest_path": "/workspace/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/manifests/splits/phase_002.json", + "split_repeat_index": 2, + "strategy": 2, + "subset_manifest_path": "/workspace/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/manifests/subsets/phase_002_pct_100_repeat_01.json", + "subset_repeat_index": 1 + }, + { + "biou_contour_mean": 0.1427242010831833, + "biou_contour_std": 0.11678919941186905, + "biou_mean": 0.42219021916389465, + "biou_std": 0.24058061838150024, + "dataset_percent": 100, + "dice_mean": 0.8018195033073425, + "dice_std": 0.24565258622169495, + "evaluation_path": "/workspace/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/phase_002/pct_100/repeat_01/strategy_3/final/evaluation.json", + "hd95_mean": 12.99763011932373, + "hd95_std": 19.484420776367188, + "iou_mean": 0.7207279205322266, + "iou_std": 0.25497370958328247, + "phase_index": 2, + "phase_test_fold_index": 2, + "phase_val_fold_index": 3, + "ppv_mean": 0.8248835206031799, + "ppv_std": 0.26045703887939453, + "run_dir": "/workspace/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/phase_002/pct_100/repeat_01/strategy_3/final", + "sen_mean": 0.8218875527381897, + "sen_std": 0.23904001712799072, + "split_generation_mode": "fixed_stratified_phases_8_1_1", + "split_manifest_path": "/workspace/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/manifests/splits/phase_002.json", + "split_repeat_index": 2, + "strategy": 3, + "subset_manifest_path": "/workspace/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/manifests/subsets/phase_002_pct_100_repeat_01.json", + "subset_repeat_index": 1 + }, + { + "biou_contour_mean": 0.10729717463254929, + "biou_contour_std": 0.08857995271682739, + "biou_mean": 0.3900618553161621, + "biou_std": 0.21769826114177704, + "dataset_percent": 100, + "dice_mean": 0.7913828492164612, + "dice_std": 0.21163640916347504, + "evaluation_path": "/workspace/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/phase_003/pct_100/repeat_01/strategy_2/final/evaluation.json", + "hd95_mean": 10.56818962097168, + "hd95_std": 14.067215919494629, + "iou_mean": 0.6934124827384949, + "iou_std": 0.22467739880084991, + "phase_index": 3, + "phase_test_fold_index": 3, + "phase_val_fold_index": 4, + "ppv_mean": 0.8115997314453125, + "ppv_std": 0.23191630840301514, + "run_dir": "/workspace/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/phase_003/pct_100/repeat_01/strategy_2/final", + "sen_mean": 0.8230597376823425, + "sen_std": 0.22039473056793213, + "split_generation_mode": "fixed_stratified_phases_8_1_1", + "split_manifest_path": "/workspace/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/manifests/splits/phase_003.json", + "split_repeat_index": 3, + "strategy": 2, + "subset_manifest_path": "/workspace/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/manifests/subsets/phase_003_pct_100_repeat_01.json", + "subset_repeat_index": 1 + }, + { + "biou_contour_mean": 0.1609937846660614, + "biou_contour_std": 0.13421352207660675, + "biou_mean": 0.4667215049266815, + "biou_std": 0.2397007793188095, + "dataset_percent": 100, + "dice_mean": 0.8267476558685303, + "dice_std": 0.18645723164081573, + "evaluation_path": "/workspace/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/phase_003/pct_100/repeat_01/strategy_3/final/evaluation.json", + "hd95_mean": 9.511301040649414, + "hd95_std": 13.27614688873291, + "iou_mean": 0.737328290939331, + "iou_std": 0.20944608747959137, + "phase_index": 3, + "phase_test_fold_index": 3, + "phase_val_fold_index": 4, + "ppv_mean": 0.8473854660987854, + "ppv_std": 0.21131612360477448, + "run_dir": "/workspace/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/phase_003/pct_100/repeat_01/strategy_3/final", + "sen_mean": 0.8498467803001404, + "sen_std": 0.1796499490737915, + "split_generation_mode": "fixed_stratified_phases_8_1_1", + "split_manifest_path": "/workspace/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/manifests/splits/phase_003.json", + "split_repeat_index": 3, + "strategy": 3, + "subset_manifest_path": "/workspace/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/manifests/subsets/phase_003_pct_100_repeat_01.json", + "subset_repeat_index": 1 + }, + { + "biou_contour_mean": 0.117262102663517, + "biou_contour_std": 0.08725402504205704, + "biou_mean": 0.4200691282749176, + "biou_std": 0.2263152003288269, + "dataset_percent": 100, + "dice_mean": 0.7721100449562073, + "dice_std": 0.2689150869846344, + "evaluation_path": "/workspace/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/phase_004/pct_100/repeat_01/strategy_2/final/evaluation.json", + "hd95_mean": 12.817033767700195, + "hd95_std": 27.383140563964844, + "iou_mean": 0.6858046054840088, + "iou_std": 0.2633354365825653, + "phase_index": 4, + "phase_test_fold_index": 4, + "phase_val_fold_index": 5, + "ppv_mean": 0.8098906874656677, + "ppv_std": 0.2543603479862213, + "run_dir": "/workspace/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/phase_004/pct_100/repeat_01/strategy_2/final", + "sen_mean": 0.7863260507583618, + "sen_std": 0.2697471082210541, + "split_generation_mode": "fixed_stratified_phases_8_1_1", + "split_manifest_path": "/workspace/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/manifests/splits/phase_004.json", + "split_repeat_index": 4, + "strategy": 2, + "subset_manifest_path": "/workspace/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/manifests/subsets/phase_004_pct_100_repeat_01.json", + "subset_repeat_index": 1 + }, + { + "biou_contour_mean": 0.20023024082183838, + "biou_contour_std": 0.14912749826908112, + "biou_mean": 0.5050680637359619, + "biou_std": 0.26369938254356384, + "dataset_percent": 100, + "dice_mean": 0.8024692535400391, + "dice_std": 0.27068495750427246, + "evaluation_path": "/workspace/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/phase_004/pct_100/repeat_01/strategy_3/final/evaluation.json", + "hd95_mean": 10.490487098693848, + "hd95_std": 18.224517822265625, + "iou_mean": 0.7308013439178467, + "iou_std": 0.2711138427257538, + "phase_index": 4, + "phase_test_fold_index": 4, + "phase_val_fold_index": 5, + "ppv_mean": 0.8311871290206909, + "ppv_std": 0.2780493199825287, + "run_dir": "/workspace/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/phase_004/pct_100/repeat_01/strategy_3/final", + "sen_mean": 0.8009200692176819, + "sen_std": 0.26087698340415955, + "split_generation_mode": "fixed_stratified_phases_8_1_1", + "split_manifest_path": "/workspace/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/manifests/splits/phase_004.json", + "split_repeat_index": 4, + "strategy": 3, + "subset_manifest_path": "/workspace/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/manifests/subsets/phase_004_pct_100_repeat_01.json", + "subset_repeat_index": 1 + }, + { + "biou_contour_mean": 0.10850856453180313, + "biou_contour_std": 0.08922477811574936, + "biou_mean": 0.38454005122184753, + "biou_std": 0.22500698268413544, + "dataset_percent": 100, + "dice_mean": 0.7543946504592896, + "dice_std": 0.28128987550735474, + "evaluation_path": "/workspace/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/phase_009/pct_100/repeat_01/strategy_2/final/evaluation.json", + "hd95_mean": 14.607939720153809, + "hd95_std": 27.255828857421875, + "iou_mean": 0.6673032641410828, + "iou_std": 0.2768732011318207, + "phase_index": 9, + "phase_test_fold_index": 9, + "phase_val_fold_index": 10, + "ppv_mean": 0.8306177854537964, + "ppv_std": 0.2499452531337738, + "run_dir": "/workspace/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/phase_009/pct_100/repeat_01/strategy_2/final", + "sen_mean": 0.7551219463348389, + "sen_std": 0.29069170355796814, + "split_generation_mode": "fixed_stratified_phases_8_1_1", + "split_manifest_path": "/workspace/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/manifests/splits/phase_009.json", + "split_repeat_index": 9, + "strategy": 2, + "subset_manifest_path": "/workspace/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/manifests/subsets/phase_009_pct_100_repeat_01.json", + "subset_repeat_index": 1 + }, + { + "biou_contour_mean": 0.1443328559398651, + "biou_contour_std": 0.11686944216489792, + "biou_mean": 0.4260050058364868, + "biou_std": 0.24544110894203186, + "dataset_percent": 100, + "dice_mean": 0.769157886505127, + "dice_std": 0.2825092673301697, + "evaluation_path": "/workspace/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/phase_009/pct_100/repeat_01/strategy_3/final/evaluation.json", + "hd95_mean": 14.124567985534668, + "hd95_std": 27.15265655517578, + "iou_mean": 0.6880638003349304, + "iou_std": 0.27892905473709106, + "phase_index": 9, + "phase_test_fold_index": 9, + "phase_val_fold_index": 10, + "ppv_mean": 0.844323456287384, + "ppv_std": 0.250375360250473, + "run_dir": "/workspace/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/phase_009/pct_100/repeat_01/strategy_3/final", + "sen_mean": 0.7663120031356812, + "sen_std": 0.2920166254043579, + "split_generation_mode": "fixed_stratified_phases_8_1_1", + "split_manifest_path": "/workspace/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/manifests/splits/phase_009.json", + "split_repeat_index": 9, + "strategy": 3, + "subset_manifest_path": "/workspace/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/manifests/subsets/phase_009_pct_100_repeat_01.json", + "subset_repeat_index": 1 + }, + { + "biou_contour_mean": 0.09433525800704956, + "biou_contour_std": 0.08016343414783478, + "biou_mean": 0.36542069911956787, + "biou_std": 0.20983631908893585, + "dataset_percent": 100, + "dice_mean": 0.7914915084838867, + "dice_std": 0.21549896895885468, + "evaluation_path": "/workspace/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/phase_010/pct_100/repeat_01/strategy_2/final/evaluation.json", + "hd95_mean": 11.299968719482422, + "hd95_std": 13.330586433410645, + "iou_mean": 0.6966288089752197, + "iou_std": 0.23677068948745728, + "phase_index": 10, + "phase_test_fold_index": 10, + "phase_val_fold_index": 1, + "ppv_mean": 0.8324064016342163, + "ppv_std": 0.2039061337709427, + "run_dir": "/workspace/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/phase_010/pct_100/repeat_01/strategy_2/final", + "sen_mean": 0.8132942914962769, + "sen_std": 0.23960597813129425, + "split_generation_mode": "fixed_stratified_phases_8_1_1", + "split_manifest_path": "/workspace/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/manifests/splits/phase_010.json", + "split_repeat_index": 10, + "strategy": 2, + "subset_manifest_path": "/workspace/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/manifests/subsets/phase_010_pct_100_repeat_01.json", + "subset_repeat_index": 1 + }, + { + "biou_contour_mean": 0.15062010288238525, + "biou_contour_std": 0.1202082708477974, + "biou_mean": 0.43836724758148193, + "biou_std": 0.23848570883274078, + "dataset_percent": 100, + "dice_mean": 0.8223764300346375, + "dice_std": 0.19792383909225464, + "evaluation_path": "/workspace/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/phase_010/pct_100/repeat_01/strategy_3/final/evaluation.json", + "hd95_mean": 10.844902992248535, + "hd95_std": 13.226529121398926, + "iou_mean": 0.7351952791213989, + "iou_std": 0.2227678894996643, + "phase_index": 10, + "phase_test_fold_index": 10, + "phase_val_fold_index": 1, + "ppv_mean": 0.8383106589317322, + "ppv_std": 0.20107269287109375, + "run_dir": "/workspace/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/phase_010/pct_100/repeat_01/strategy_3/final", + "sen_mean": 0.8480129241943359, + "sen_std": 0.2086656093597412, + "split_generation_mode": "fixed_stratified_phases_8_1_1", + "split_manifest_path": "/workspace/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/manifests/splits/phase_010.json", + "split_repeat_index": 10, + "strategy": 3, + "subset_manifest_path": "/workspace/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/manifests/subsets/phase_010_pct_100_repeat_01.json", + "subset_repeat_index": 1 + } +] \ No newline at end of file diff --git a/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/phase_010/pct_100/repeat_01/norm_stats_BUSI_with_classes_stratified_80_10_10_100pct_phase010_repeat01.json b/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/phase_010/pct_100/repeat_01/norm_stats_BUSI_with_classes_stratified_80_10_10_100pct_phase010_repeat01.json new file mode 100644 index 0000000000000000000000000000000000000000..fc847988bd861f600ed99e5e669efd8e49f00f47 --- /dev/null +++ b/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/phase_010/pct_100/repeat_01/norm_stats_BUSI_with_classes_stratified_80_10_10_100pct_phase010_repeat01.json @@ -0,0 +1,526 @@ +{ + "filenames": [ + "BUSI_0358_B.png", + "BUSI_0140_M.png", + "BUSI_0420_B.png", + "BUSI_0101_B.png", + "BUSI_0052_B.png", + "BUSI_0068_M.png", + "BUSI_0029_B.png", + "BUSI_0024_M.png", + "BUSI_0094_B.png", + "BUSI_0011_B.png", + "BUSI_0047_M.png", + "BUSI_0153_M.png", + "BUSI_0045_M.png", + "BUSI_0090_M.png", + "BUSI_0341_B.png", + "BUSI_0437_B.png", + "BUSI_0009_B.png", + "BUSI_0320_B.png", + "BUSI_0075_M.png", + "BUSI_0099_M.png", + "BUSI_0254_B.png", + "BUSI_0310_B.png", + "BUSI_0122_M.png", + "BUSI_0032_B.png", + "BUSI_0101_M.png", + "BUSI_0148_M.png", + "BUSI_0209_M.png", + "BUSI_0145_M.png", + "BUSI_0106_M.png", + "BUSI_0187_B.png", + "BUSI_0304_B.png", + "BUSI_0055_M.png", + "BUSI_0197_M.png", + "BUSI_0109_B.png", + "BUSI_0124_M.png", + "BUSI_0183_B.png", + "BUSI_0154_B.png", + "BUSI_0139_M.png", + "BUSI_0088_B.png", + "BUSI_0030_B.png", + "BUSI_0250_B.png", + "BUSI_0061_B.png", + "BUSI_0193_B.png", + "BUSI_0036_M.png", + "BUSI_0184_B.png", + "BUSI_0155_B.png", + "BUSI_0188_M.png", + "BUSI_0005_M.png", + "BUSI_0396_B.png", + "BUSI_0010_B.png", + "BUSI_0150_B.png", + "BUSI_0300_B.png", + "BUSI_0019_M.png", + "BUSI_0086_M.png", + "BUSI_0181_M.png", + "BUSI_0138_M.png", + "BUSI_0087_M.png", + "BUSI_0180_M.png", + "BUSI_0078_M.png", + "BUSI_0113_M.png", + "BUSI_0137_M.png", + "BUSI_0428_B.png", + "BUSI_0171_B.png", + "BUSI_0169_B.png", + "BUSI_0035_M.png", + "BUSI_0201_B.png", + "BUSI_0159_M.png", + "BUSI_0104_M.png", + "BUSI_0209_B.png", + "BUSI_0274_B.png", + "BUSI_0178_B.png", + "BUSI_0340_B.png", + "BUSI_0346_B.png", + "BUSI_0008_B.png", + "BUSI_0282_B.png", + "BUSI_0352_B.png", + "BUSI_0098_B.png", + "BUSI_0280_B.png", + "BUSI_0006_M.png", + "BUSI_0323_B.png", + "BUSI_0365_B.png", + "BUSI_0205_M.png", + "BUSI_0148_B.png", + "BUSI_0066_M.png", + "BUSI_0134_M.png", + "BUSI_0144_B.png", + "BUSI_0127_M.png", + "BUSI_0240_B.png", + "BUSI_0013_B.png", + "BUSI_0226_B.png", + "BUSI_0347_B.png", + "BUSI_0175_B.png", + "BUSI_0120_B.png", + "BUSI_0028_B.png", + "BUSI_0168_M.png", + "BUSI_0237_B.png", + "BUSI_0172_B.png", + "BUSI_0362_B.png", + "BUSI_0009_M.png", + "BUSI_0285_B.png", + "BUSI_0245_B.png", + "BUSI_0387_B.png", + "BUSI_0279_B.png", + "BUSI_0039_B.png", + "BUSI_0212_B.png", + "BUSI_0092_B.png", + "BUSI_0060_M.png", + "BUSI_0271_B.png", + "BUSI_0286_B.png", + "BUSI_0404_B.png", + "BUSI_0224_B.png", + "BUSI_0063_B.png", + "BUSI_0050_M.png", + "BUSI_0264_B.png", + "BUSI_0160_B.png", + "BUSI_0125_M.png", + "BUSI_0417_B.png", + "BUSI_0384_B.png", + "BUSI_0332_B.png", + "BUSI_0291_B.png", + "BUSI_0152_B.png", + "BUSI_0027_B.png", + "BUSI_0423_B.png", + "BUSI_0144_M.png", + "BUSI_0057_B.png", + "BUSI_0126_M.png", + "BUSI_0267_B.png", + "BUSI_0121_M.png", + "BUSI_0147_M.png", + "BUSI_0383_B.png", + "BUSI_0149_M.png", + "BUSI_0201_M.png", + "BUSI_0074_B.png", + "BUSI_0074_M.png", + "BUSI_0181_B.png", + "BUSI_0166_B.png", + "BUSI_0014_M.png", + "BUSI_0082_M.png", + "BUSI_0119_B.png", + "BUSI_0073_M.png", + "BUSI_0316_B.png", + "BUSI_0424_B.png", + "BUSI_0155_M.png", + "BUSI_0016_B.png", + "BUSI_0322_B.png", + "BUSI_0145_B.png", + "BUSI_0163_B.png", + "BUSI_0017_M.png", + "BUSI_0311_B.png", + "BUSI_0162_M.png", + "BUSI_0122_B.png", + "BUSI_0167_B.png", + "BUSI_0027_M.png", + "BUSI_0041_M.png", + "BUSI_0296_B.png", + "BUSI_0431_B.png", + "BUSI_0160_M.png", + "BUSI_0326_B.png", + "BUSI_0021_B.png", + "BUSI_0060_B.png", + "BUSI_0229_B.png", + "BUSI_0023_M.png", + "BUSI_0223_B.png", + "BUSI_0044_M.png", + "BUSI_0319_B.png", + "BUSI_0004_M.png", + "BUSI_0081_M.png", + "BUSI_0051_B.png", + "BUSI_0094_M.png", + "BUSI_0190_B.png", + "BUSI_0075_B.png", + "BUSI_0116_M.png", + "BUSI_0381_B.png", + "BUSI_0102_B.png", + "BUSI_0378_B.png", + "BUSI_0412_B.png", + "BUSI_0150_M.png", + "BUSI_0401_B.png", + "BUSI_0142_B.png", + "BUSI_0114_B.png", + "BUSI_0142_M.png", + "BUSI_0368_B.png", + "BUSI_0113_B.png", + "BUSI_0161_B.png", + "BUSI_0203_B.png", + "BUSI_0154_M.png", + "BUSI_0121_B.png", + "BUSI_0111_M.png", + "BUSI_0003_M.png", + "BUSI_0199_B.png", + "BUSI_0080_B.png", + "BUSI_0072_B.png", + "BUSI_0092_M.png", + "BUSI_0262_B.png", + "BUSI_0164_B.png", + "BUSI_0344_B.png", + "BUSI_0395_B.png", + "BUSI_0100_M.png", + "BUSI_0292_B.png", + "BUSI_0244_B.png", + "BUSI_0408_B.png", + "BUSI_0219_B.png", + "BUSI_0137_B.png", + "BUSI_0186_B.png", + "BUSI_0008_M.png", + "BUSI_0299_B.png", + "BUSI_0376_B.png", + "BUSI_0343_B.png", + "BUSI_0235_B.png", + "BUSI_0139_B.png", + "BUSI_0049_B.png", + "BUSI_0239_B.png", + "BUSI_0255_B.png", + "BUSI_0164_M.png", + "BUSI_0165_M.png", + "BUSI_0309_B.png", + "BUSI_0183_M.png", + "BUSI_0349_B.png", + "BUSI_0078_B.png", + "BUSI_0025_M.png", + "BUSI_0093_M.png", + "BUSI_0277_B.png", + "BUSI_0189_B.png", + "BUSI_0138_B.png", + "BUSI_0012_B.png", + "BUSI_0202_B.png", + "BUSI_0351_B.png", + "BUSI_0372_B.png", + "BUSI_0096_M.png", + "BUSI_0103_B.png", + "BUSI_0298_B.png", + "BUSI_0411_B.png", + "BUSI_0210_M.png", + "BUSI_0169_M.png", + "BUSI_0318_B.png", + "BUSI_0073_B.png", + "BUSI_0265_B.png", + "BUSI_0400_B.png", + "BUSI_0221_B.png", + "BUSI_0103_M.png", + "BUSI_0399_B.png", + "BUSI_0281_B.png", + "BUSI_0037_M.png", + "BUSI_0126_B.png", + "BUSI_0059_B.png", + "BUSI_0161_M.png", + "BUSI_0288_B.png", + "BUSI_0179_M.png", + "BUSI_0132_M.png", + "BUSI_0422_B.png", + "BUSI_0196_B.png", + "BUSI_0131_M.png", + "BUSI_0056_M.png", + "BUSI_0129_M.png", + "BUSI_0236_B.png", + "BUSI_0045_B.png", + "BUSI_0356_B.png", + "BUSI_0065_M.png", + "BUSI_0116_B.png", + "BUSI_0110_M.png", + "BUSI_0386_B.png", + "BUSI_0228_B.png", + "BUSI_0231_B.png", + "BUSI_0055_B.png", + "BUSI_0012_M.png", + "BUSI_0118_B.png", + "BUSI_0198_M.png", + "BUSI_0194_B.png", + "BUSI_0380_B.png", + "BUSI_0361_B.png", + "BUSI_0089_M.png", + "BUSI_0104_B.png", + "BUSI_0427_B.png", + "BUSI_0135_B.png", + "BUSI_0258_B.png", + "BUSI_0188_B.png", + "BUSI_0426_B.png", + "BUSI_0243_B.png", + "BUSI_0405_B.png", + "BUSI_0173_M.png", + "BUSI_0194_M.png", + "BUSI_0159_B.png", + "BUSI_0124_B.png", + "BUSI_0022_B.png", + "BUSI_0058_B.png", + "BUSI_0335_B.png", + "BUSI_0086_B.png", + "BUSI_0266_B.png", + "BUSI_0111_B.png", + "BUSI_0042_B.png", + "BUSI_0136_M.png", + "BUSI_0353_B.png", + "BUSI_0371_B.png", + "BUSI_0202_M.png", + "BUSI_0402_B.png", + "BUSI_0204_B.png", + "BUSI_0059_M.png", + "BUSI_0084_M.png", + "BUSI_0208_M.png", + "BUSI_0397_B.png", + "BUSI_0112_B.png", + "BUSI_0026_M.png", + "BUSI_0044_B.png", + "BUSI_0222_B.png", + "BUSI_0093_B.png", + "BUSI_0225_B.png", + "BUSI_0207_M.png", + "BUSI_0035_B.png", + "BUSI_0043_M.png", + "BUSI_0275_B.png", + "BUSI_0315_B.png", + "BUSI_0095_B.png", + "BUSI_0257_B.png", + "BUSI_0430_B.png", + "BUSI_0146_B.png", + "BUSI_0290_B.png", + "BUSI_0377_B.png", + "BUSI_0418_B.png", + "BUSI_0091_M.png", + "BUSI_0118_M.png", + "BUSI_0151_M.png", + "BUSI_0293_B.png", + "BUSI_0269_B.png", + "BUSI_0071_M.png", + "BUSI_0185_M.png", + "BUSI_0076_M.png", + "BUSI_0216_B.png", + "BUSI_0355_B.png", + "BUSI_0359_B.png", + "BUSI_0007_M.png", + "BUSI_0415_B.png", + "BUSI_0063_M.png", + "BUSI_0390_B.png", + "BUSI_0394_B.png", + "BUSI_0196_M.png", + "BUSI_0350_B.png", + "BUSI_0256_B.png", + "BUSI_0133_M.png", + "BUSI_0197_B.png", + "BUSI_0214_B.png", + "BUSI_0198_B.png", + "BUSI_0170_M.png", + "BUSI_0130_M.png", + "BUSI_0036_B.png", + "BUSI_0083_B.png", + "BUSI_0206_B.png", + "BUSI_0069_B.png", + "BUSI_0208_B.png", + "BUSI_0367_B.png", + "BUSI_0128_B.png", + "BUSI_0165_B.png", + "BUSI_0096_B.png", + "BUSI_0136_B.png", + "BUSI_0069_M.png", + "BUSI_0084_B.png", + "BUSI_0131_B.png", + "BUSI_0052_M.png", + "BUSI_0048_M.png", + "BUSI_0062_B.png", + "BUSI_0253_B.png", + "BUSI_0263_B.png", + "BUSI_0295_B.png", + "BUSI_0242_B.png", + "BUSI_0308_B.png", + "BUSI_0252_B.png", + "BUSI_0414_B.png", + "BUSI_0031_B.png", + "BUSI_0043_B.png", + "BUSI_0109_M.png", + "BUSI_0099_B.png", + "BUSI_0294_B.png", + "BUSI_0028_M.png", + "BUSI_0143_M.png", + "BUSI_0374_B.png", + "BUSI_0162_B.png", + "BUSI_0057_M.png", + "BUSI_0034_B.png", + "BUSI_0098_M.png", + "BUSI_0024_B.png", + "BUSI_0001_B.png", + "BUSI_0259_B.png", + "BUSI_0127_B.png", + "BUSI_0354_B.png", + "BUSI_0153_B.png", + "BUSI_0157_B.png", + "BUSI_0364_B.png", + "BUSI_0177_M.png", + "BUSI_0413_B.png", + "BUSI_0247_B.png", + "BUSI_0174_M.png", + "BUSI_0230_B.png", + "BUSI_0115_M.png", + "BUSI_0058_M.png", + "BUSI_0046_M.png", + "BUSI_0082_B.png", + "BUSI_0076_B.png", + "BUSI_0001_M.png", + "BUSI_0284_B.png", + "BUSI_0360_B.png", + "BUSI_0031_M.png", + "BUSI_0002_B.png", + "BUSI_0020_M.png", + "BUSI_0133_B.png", + "BUSI_0097_M.png", + "BUSI_0334_B.png", + "BUSI_0053_M.png", + "BUSI_0156_B.png", + "BUSI_0010_M.png", + "BUSI_0432_B.png", + "BUSI_0040_M.png", + "BUSI_0066_B.png", + "BUSI_0081_B.png", + "BUSI_0207_B.png", + "BUSI_0218_B.png", + "BUSI_0433_B.png", + "BUSI_0170_B.png", + "BUSI_0132_B.png", + "BUSI_0085_B.png", + "BUSI_0079_B.png", + "BUSI_0192_M.png", + "BUSI_0195_M.png", + "BUSI_0248_B.png", + "BUSI_0056_B.png", + "BUSI_0206_M.png", + "BUSI_0268_B.png", + "BUSI_0014_B.png", + "BUSI_0272_B.png", + "BUSI_0305_B.png", + "BUSI_0429_B.png", + "BUSI_0330_B.png", + "BUSI_0110_B.png", + "BUSI_0143_B.png", + "BUSI_0029_M.png", + "BUSI_0382_B.png", + "BUSI_0039_M.png", + "BUSI_0038_B.png", + "BUSI_0251_B.png", + "BUSI_0050_B.png", + "BUSI_0004_B.png", + "BUSI_0425_B.png", + "BUSI_0070_B.png", + "BUSI_0033_M.png", + "BUSI_0283_B.png", + "BUSI_0260_B.png", + "BUSI_0151_B.png", + "BUSI_0342_B.png", + "BUSI_0321_B.png", + "BUSI_0200_B.png", + "BUSI_0157_M.png", + "BUSI_0297_B.png", + "BUSI_0123_M.png", + "BUSI_0016_M.png", + "BUSI_0210_B.png", + "BUSI_0022_M.png", + "BUSI_0141_M.png", + "BUSI_0166_M.png", + "BUSI_0105_M.png", + "BUSI_0363_B.png", + "BUSI_0034_M.png", + "BUSI_0061_M.png", + "BUSI_0211_B.png", + "BUSI_0067_M.png", + "BUSI_0125_B.png", + "BUSI_0193_M.png", + "BUSI_0015_B.png", + "BUSI_0107_B.png", + "BUSI_0025_B.png", + "BUSI_0108_M.png", + "BUSI_0062_M.png", + "BUSI_0140_B.png", + "BUSI_0191_B.png", + "BUSI_0175_M.png", + "BUSI_0174_B.png", + "BUSI_0389_B.png", + "BUSI_0278_B.png", + "BUSI_0213_B.png", + "BUSI_0393_B.png", + "BUSI_0033_B.png", + "BUSI_0054_M.png", + "BUSI_0080_M.png", + "BUSI_0220_B.png", + "BUSI_0019_B.png", + "BUSI_0095_M.png", + "BUSI_0195_B.png", + "BUSI_0312_B.png", + "BUSI_0168_B.png", + "BUSI_0345_B.png", + "BUSI_0329_B.png", + "BUSI_0325_B.png", + "BUSI_0077_B.png", + "BUSI_0032_M.png", + "BUSI_0234_B.png", + "BUSI_0178_M.png", + "BUSI_0156_M.png", + "BUSI_0017_B.png", + "BUSI_0180_B.png", + "BUSI_0003_B.png", + "BUSI_0007_B.png", + "BUSI_0117_M.png", + "BUSI_0369_B.png", + "BUSI_0331_B.png", + "BUSI_0375_B.png", + "BUSI_0385_B.png", + "BUSI_0324_B.png", + "BUSI_0083_M.png", + "BUSI_0040_B.png", + "BUSI_0026_B.png", + "BUSI_0190_M.png", + "BUSI_0123_B.png", + "BUSI_0203_M.png", + "BUSI_0021_M.png", + "BUSI_0416_B.png", + "BUSI_0215_B.png", + "BUSI_0246_B.png", + "BUSI_0041_B.png", + "BUSI_0105_B.png", + "BUSI_0182_B.png", + "BUSI_0129_B.png" + ], + "global_mean": 84.33389124297284, + "global_std": 56.715290540672065, + "num_images": 518, + "total_pixels": 477165084 +} \ No newline at end of file diff --git a/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/phase_010/pct_100/repeat_01/strategy_3/final/evaluation.json b/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/phase_010/pct_100/repeat_01/strategy_3/final/evaluation.json new file mode 100644 index 0000000000000000000000000000000000000000..d77f4dfec7eafcb9a449a1d74ee427383aee99f5 --- /dev/null +++ b/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/phase_010/pct_100/repeat_01/strategy_3/final/evaluation.json @@ -0,0 +1,824 @@ +{ + "best_metric_name": "val_refine_score", + "best_metric_value": 0.5724109242210832, + "checkpoint_mode": "best", + "checkpoint_path": "/workspace/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/phase_010/pct_100/repeat_01/strategy_3/final/checkpoints/best.pt", + "metrics": { + "biou": { + "mean": 0.43836724758148193, + "std": 0.23848570883274078 + }, + "biou_contour": { + "mean": 0.15062010288238525, + "std": 0.1202082708477974 + }, + "dice": { + "mean": 0.8223764300346375, + "std": 0.19792383909225464 + }, + "hd95": { + "mean": 10.844902992248535, + "std": 13.226529121398926 + }, + "iou": { + "mean": 0.7351952791213989, + "std": 0.2227678894996643 + }, + "ppv": { + "mean": 0.8383106589317322, + "std": 0.20107269287109375 + }, + "sen": { + "mean": 0.8480129241943359, + "std": 0.2086656093597412 + } + }, + "per_sample": [ + { + "biou": 0.7423729686871293, + "biou_contour": 0.30275293325418967, + "dice": 0.9531737821879519, + "hd95": 1.4142135381698608, + "inference_time_ms": 9.397693705977872, + "inference_time_seconds": 0.009397693705977872, + "iou": 0.9105367971099807, + "ppv": 0.9252525403530222, + "sample_id": "BUSI_0006_B", + "sen": 0.9828326217097378 + }, + { + "biou": 0.3491865645573761, + "biou_contour": 0.1309527258124104, + "dice": 0.9028815394108447, + "hd95": 6.324555397033691, + "inference_time_ms": 9.397693705977872, + "inference_time_seconds": 0.009397693705977872, + "iou": 0.8229572070546105, + "ppv": 0.8840125452449036, + "sample_id": "BUSI_0077_M", + "sen": 0.9225736138182327 + }, + { + "biou": 0.6187053102839495, + "biou_contour": 0.2000013333311111, + "dice": 0.8503937596874962, + "hd95": 2.2360680103302, + "inference_time_ms": 9.397693705977872, + "inference_time_seconds": 0.009397693705977872, + "iou": 0.7397262056669824, + "ppv": 0.9818181983470924, + "sample_id": "BUSI_0071_B", + "sen": 0.7500001736109906 + }, + { + "biou": 0.8209877648223673, + "biou_contour": 0.4126993449216747, + "dice": 0.942779307144603, + "hd95": 1.0, + "inference_time_ms": 9.397693705977872, + "inference_time_seconds": 0.009397693705977872, + "iou": 0.8917526331171994, + "ppv": 0.8917526331171994, + "sample_id": "BUSI_0338_B", + "sen": 1.0 + }, + { + "biou": 0.851063909008559, + "biou_contour": 0.47826162570778885, + "dice": 0.9639468759114087, + "hd95": 1.0, + "inference_time_ms": 9.397693705977872, + "inference_time_seconds": 0.009397693705977872, + "iou": 0.9304029558963532, + "ppv": 0.9513108796588466, + "sample_id": "BUSI_0089_B", + "sen": 0.9769230857988133 + }, + { + "biou": 0.4732621025050665, + "biou_contour": 0.13779561504109644, + "dice": 0.9453244776360634, + "hd95": 3.0, + "inference_time_ms": 9.397693705977872, + "inference_time_seconds": 0.009397693705977872, + "iou": 0.896317834480725, + "ppv": 0.9259259296333369, + "sample_id": "BUSI_0276_B", + "sen": 0.9655532377059897 + }, + { + "biou": 0.6546276174655491, + "biou_contour": 0.1939398824606773, + "dice": 0.942701231739343, + "hd95": 2.0, + "inference_time_ms": 9.397693705977872, + "inference_time_seconds": 0.009397693705977872, + "iou": 0.8916129172112365, + "ppv": 0.9531034547443511, + "sample_id": "BUSI_0241_B", + "sen": 0.9325236258402664 + }, + { + "biou": 0.34142125798591716, + "biou_contour": 0.06632700697601684, + "dice": 0.8681842314354562, + "hd95": 5.932379245758057, + "inference_time_ms": 9.397693705977872, + "inference_time_seconds": 0.009397693705977872, + "iou": 0.7670720517238492, + "ppv": 0.7735849270202899, + "sample_id": "BUSI_0303_B", + "sen": 0.9891435477510799 + }, + { + "biou": 0.21366381690128486, + "biou_contour": 0.07517105349178738, + "dice": 0.8375499355852206, + "hd95": 15.078046798706055, + "inference_time_ms": 9.397693705977872, + "inference_time_seconds": 0.009397693705977872, + "iou": 0.7205040155669183, + "ppv": 0.9794456561991387, + "sample_id": "BUSI_0015_M", + "sen": 0.7315654865883814 + }, + { + "biou": 0.7098215581153758, + "biou_contour": 0.23595591465627566, + "dice": 0.9290780267592151, + "hd95": 1.4142135381698608, + "inference_time_ms": 9.397693705977872, + "inference_time_seconds": 0.009397693705977872, + "iou": 0.8675497127318832, + "ppv": 0.8972603091574284, + "sample_id": "BUSI_0115_B", + "sen": 0.963235307634078 + }, + { + "biou": 0.0830357961575182, + "biou_contour": 0.023952388038207175, + "dice": 0.4373688090493768, + "hd95": 19.40743064880371, + "inference_time_ms": 9.397693705977872, + "inference_time_seconds": 0.009397693705977872, + "iou": 0.27989255352026177, + "ppv": 0.7284382600887809, + "sample_id": "BUSI_0187_M", + "sen": 0.3125000343749983 + }, + { + "biou": 0.7351779702853872, + "biou_contour": 0.33695724243777997, + "dice": 0.9445843898508325, + "hd95": 2.0, + "inference_time_ms": 9.397693705977872, + "inference_time_seconds": 0.009397693705977872, + "iou": 0.8949880918882835, + "ppv": 0.9640102920282025, + "sample_id": "BUSI_0117_B", + "sen": 0.9259259442158162 + }, + { + "biou": 0.5608466382986529, + "biou_contour": 0.14077711612761354, + "dice": 0.943476415491865, + "hd95": 2.0, + "inference_time_ms": 9.397693705977872, + "inference_time_seconds": 0.009397693705977872, + "iou": 0.8930008131133699, + "ppv": 0.9351305867623768, + "sample_id": "BUSI_0366_B", + "sen": 0.9519725598651321 + }, + { + "biou": 0.386571781630541, + "biou_contour": 0.10979254902298251, + "dice": 0.8315757809106423, + "hd95": 30.668222427368164, + "inference_time_ms": 9.397693705977872, + "inference_time_seconds": 0.009397693705977872, + "iou": 0.711707080365803, + "ppv": 0.7528641706020638, + "sample_id": "BUSI_0171_M", + "sen": 0.9286675687303116 + }, + { + "biou": 0.07697418201896603, + "biou_contour": 0.0364965847940183, + "dice": 0.4015067047780873, + "hd95": 49.91731262207031, + "inference_time_ms": 9.397693705977872, + "inference_time_seconds": 0.009397693705977872, + "iou": 0.25117822916428295, + "ppv": 0.2653023734273161, + "sample_id": "BUSI_0176_M", + "sen": 0.8251146889269101 + }, + { + "biou": 0.1461001661175689, + "biou_contour": 0.038306645502692444, + "dice": 0.7579896597534855, + "hd95": 18.812192916870117, + "inference_time_ms": 9.397693705977872, + "inference_time_seconds": 0.009397693705977872, + "iou": 0.6102925558340262, + "ppv": 0.8834621365235815, + "sample_id": "BUSI_0030_M", + "sen": 0.6637250426445648 + }, + { + "biou": 0.44420834811813514, + "biou_contour": 0.10802496665896093, + "dice": 0.9427007309726144, + "hd95": 4.265591621398926, + "inference_time_ms": 9.397693705977872, + "inference_time_seconds": 0.009397693705977872, + "iou": 0.8916120161680353, + "ppv": 0.9612951261148074, + "sample_id": "BUSI_0120_M", + "sen": 0.9248120327672026 + }, + { + "biou": 0.3795067002365559, + "biou_contour": 0.12427770974632668, + "dice": 0.8685331750294225, + "hd95": 6.227839946746826, + "inference_time_ms": 9.397693705977872, + "inference_time_seconds": 0.009397693705977872, + "iou": 0.7676170108866589, + "ppv": 0.807126707741702, + "sample_id": "BUSI_0204_M", + "sen": 0.9400527048713633 + }, + { + "biou": 0.5719426000206476, + "biou_contour": 0.12844116656773708, + "dice": 0.8965517396474153, + "hd95": 2.0, + "inference_time_ms": 9.397693705977872, + "inference_time_seconds": 0.009397693705977872, + "iou": 0.8125000509510731, + "ppv": 0.8147139469444286, + "sample_id": "BUSI_0388_B", + "sen": 0.9966666677777775 + }, + { + "biou": 0.17371942239869584, + "biou_contour": 0.03984837953541186, + "dice": 0.8872085706435451, + "hd95": 10.1461763381958, + "inference_time_ms": 9.397693705977872, + "inference_time_seconds": 0.009397693705977872, + "iou": 0.7972819964846789, + "ppv": 0.9649500692196971, + "sample_id": "BUSI_0409_B", + "sen": 0.8210596497657506 + }, + { + "biou": 0.19631910058086907, + "biou_contour": 0.05387237243354464, + "dice": 0.5136087251486159, + "hd95": 37.96839904785156, + "inference_time_ms": 9.397693705977872, + "inference_time_seconds": 0.009397693705977872, + "iou": 0.34554074340625834, + "ppv": 0.3923679357941323, + "sample_id": "BUSI_0172_M", + "sen": 0.7432808393622947 + }, + { + "biou": 0.7187502197263909, + "biou_contour": 0.34615510354787776, + "dice": 0.8906883033650593, + "hd95": 2.4556310176849365, + "inference_time_ms": 9.397693705977872, + "inference_time_seconds": 0.009397693705977872, + "iou": 0.8029198518833198, + "ppv": 0.8661418376835924, + "sample_id": "BUSI_0185_B", + "sen": 0.9166667361110532 + }, + { + "biou": 0.7216497714950809, + "biou_contour": 0.2391320888432851, + "dice": 0.8914286334693523, + "hd95": 1.0, + "inference_time_ms": 9.397693705977872, + "inference_time_seconds": 0.009397693705977872, + "iou": 0.8041239132743162, + "ppv": 0.876404633253221, + "sample_id": "BUSI_0301_B", + "sen": 0.9069768523524973 + }, + { + "biou": 0.25207992911148674, + "biou_contour": 0.034301046358562966, + "dice": 0.9223482141187281, + "hd95": 6.324555397033691, + "inference_time_ms": 9.397693705977872, + "inference_time_seconds": 0.009397693705977872, + "iou": 0.8558870576481871, + "ppv": 0.8660377394598993, + "sample_id": "BUSI_0018_B", + "sen": 0.9864906359689704 + }, + { + "biou": 0.032660995901921626, + "biou_contour": 0.003533921012748759, + "dice": 0.2672811258530462, + "hd95": 38.8508415222168, + "inference_time_ms": 9.397693705977872, + "inference_time_seconds": 0.009397693705977872, + "iou": 0.15425534561153484, + "ppv": 0.5005076649230797, + "sample_id": "BUSI_0233_B", + "sen": 0.1823225154466525 + }, + { + "biou": 0.7258065400624065, + "biou_contour": 0.26890817738808626, + "dice": 0.9356435723213401, + "hd95": 1.4142135381698608, + "inference_time_ms": 9.397693705977872, + "inference_time_seconds": 0.009397693705977872, + "iou": 0.8790697955651638, + "ppv": 0.908653868112051, + "sample_id": "BUSI_0419_B", + "sen": 0.9642857233964991 + }, + { + "biou": 0.29379574930734503, + "biou_contour": 0.037433669821566935, + "dice": 0.8280442931332624, + "hd95": 5.099019527435303, + "inference_time_ms": 9.397693705977872, + "inference_time_seconds": 0.009397693705977872, + "iou": 0.706549155346454, + "ppv": 0.7946175928303693, + "sample_id": "BUSI_0336_B", + "sen": 0.8644068005536517 + }, + { + "biou": 0.794029912229877, + "biou_contour": 0.36666719444400464, + "dice": 0.9697908621385855, + "hd95": 1.0, + "inference_time_ms": 9.397693705977872, + "inference_time_seconds": 0.009397693705977872, + "iou": 0.9413533922776853, + "ppv": 0.9952305254005523, + "sample_id": "BUSI_0373_B", + "sen": 0.9456193435620327 + }, + { + "biou": 0.1683850226142573, + "biou_contour": 0.056180305516682294, + "dice": 0.2592087817729344, + "hd95": 30.12056541442871, + "inference_time_ms": 9.397693705977872, + "inference_time_seconds": 0.009397693705977872, + "iou": 0.14890288801701504, + "ppv": 0.8370044770905387, + "sample_id": "BUSI_0018_M", + "sen": 0.15334954371674386 + }, + { + "biou": 0.2668681503657452, + "biou_contour": 0.05405433812182039, + "dice": 0.851167847605436, + "hd95": 7.713011741638184, + "inference_time_ms": 9.397693705977872, + "inference_time_seconds": 0.009397693705977872, + "iou": 0.7408983574043329, + "ppv": 0.9738968319517196, + "sample_id": "BUSI_0102_M", + "sen": 0.7559093219532406 + }, + { + "biou": 0.5462557064952835, + "biou_contour": 0.1428580847713354, + "dice": 0.8616071737483987, + "hd95": 2.2360680103302, + "inference_time_ms": 9.397693705977872, + "inference_time_seconds": 0.009397693705977872, + "iou": 0.7568628404459449, + "ppv": 0.9146919835583016, + "sample_id": "BUSI_0176_B", + "sen": 0.8143460698961731 + }, + { + "biou": 0.3086681491894134, + "biou_contour": 0.06885276431056908, + "dice": 0.9060092474060286, + "hd95": 4.8680338859558105, + "inference_time_ms": 9.397693705977872, + "inference_time_seconds": 0.009397693705977872, + "iou": 0.828169022151689, + "ppv": 0.9323467266201518, + "sample_id": "BUSI_0410_B", + "sen": 0.8811188870569987 + }, + { + "biou": 0.2802850926140069, + "biou_contour": 0.06716441115313156, + "dice": 0.7682753767161927, + "hd95": 21.123292922973633, + "inference_time_ms": 9.397693705977872, + "inference_time_seconds": 0.009397693705977872, + "iou": 0.6237395671639422, + "ppv": 0.6339677998838126, + "sample_id": "BUSI_0184_M", + "sen": 0.9747861335080534 + }, + { + "biou": 0.45420565848545247, + "biou_contour": 0.1906160731331164, + "dice": 0.9346557769157559, + "hd95": 8.485280990600586, + "inference_time_ms": 9.397693705977872, + "inference_time_seconds": 0.009397693705977872, + "iou": 0.8773274951443731, + "ppv": 0.9981308411797246, + "sample_id": "BUSI_0167_M", + "sen": 0.8787712594961257 + }, + { + "biou": 0.5055556929011965, + "biou_contour": 0.06206961236578457, + "dice": 0.8650065707724023, + "hd95": 2.2360680103302, + "inference_time_ms": 9.397693705977872, + "inference_time_seconds": 0.009397693705977872, + "iou": 0.7621247662529408, + "ppv": 0.7621247662529408, + "sample_id": "BUSI_0087_B", + "sen": 1.0 + }, + { + "biou": 0.6502347828362931, + "biou_contour": 0.22818817846034284, + "dice": 0.9763876115242623, + "hd95": 2.0, + "inference_time_ms": 9.397693705977872, + "inference_time_seconds": 0.009397693705977872, + "iou": 0.9538645909567228, + "ppv": 0.9686644366089311, + "sample_id": "BUSI_0068_B", + "sen": 0.9842349309355508 + }, + { + "biou": 0.38957073939547876, + "biou_contour": 0.14285790816258198, + "dice": 0.7811271584368076, + "hd95": 7.071067810058594, + "inference_time_ms": 9.397693705977872, + "inference_time_seconds": 0.009397693705977872, + "iou": 0.6408602922881091, + "ppv": 0.677272800619818, + "sample_id": "BUSI_0112_M", + "sen": 0.9226006431576956 + }, + { + "biou": 0.3316953864295343, + "biou_contour": 0.09487202695589055, + "dice": 0.8961695208448326, + "hd95": 7.943071365356445, + "inference_time_ms": 9.397693705977872, + "inference_time_seconds": 0.009397693705977872, + "iou": 0.8118724213859296, + "ppv": 0.8980725286483983, + "sample_id": "BUSI_0114_M", + "sen": 0.8942745642721351 + }, + { + "biou": 0.05033565013962667, + "biou_contour": 0.006116511890974958, + "dice": 0.5626535760855781, + "hd95": 17.481412887573242, + "inference_time_ms": 9.397693705977872, + "inference_time_seconds": 0.009397693705977872, + "iou": 0.3914530174592727, + "ppv": 0.3914530174592727, + "sample_id": "BUSI_0306_B", + "sen": 1.0 + }, + { + "biou": 0.3650486053350868, + "biou_contour": 0.09467482406070296, + "dice": 0.9284951987105088, + "hd95": 5.0, + "inference_time_ms": 9.397693705977872, + "inference_time_seconds": 0.009397693705977872, + "iou": 0.8665338689729791, + "ppv": 0.9371633774806687, + "sample_id": "BUSI_0097_B", + "sen": 0.9199859034196016 + }, + { + "biou": 0.8500000937499415, + "biou_contour": 0.466667555554074, + "dice": 0.9554455555827833, + "hd95": 1.0, + "inference_time_ms": 9.397693705977872, + "inference_time_seconds": 0.009397693705977872, + "iou": 0.9146919835583016, + "ppv": 0.9747474875012689, + "sample_id": "BUSI_0005_B", + "sen": 0.9368932345178473 + }, + { + "biou": 0.48387130072819307, + "biou_contour": 0.07246511236940235, + "dice": 0.7649403326930946, + "hd95": 2.888477325439453, + "inference_time_ms": 9.397693705977872, + "inference_time_seconds": 0.009397693705977872, + "iou": 0.6193550842870424, + "ppv": 0.6193550842870424, + "sample_id": "BUSI_0091_B", + "sen": 1.0 + }, + { + "biou": 0.1424017458872611, + "biou_contour": 0.040892371581343574, + "dice": 0.7673977816824823, + "hd95": 28.28603744506836, + "inference_time_ms": 9.397693705977872, + "inference_time_seconds": 0.009397693705977872, + "iou": 0.6225834853165864, + "ppv": 0.8966462793367164, + "sample_id": "BUSI_0072_M", + "sen": 0.670716319490118 + }, + { + "biou": 0.5909094628095792, + "biou_contour": 0.14492877546554278, + "dice": 0.7428572897958344, + "hd95": 28.0585994720459, + "inference_time_ms": 9.397693705977872, + "inference_time_seconds": 0.009397693705977872, + "iou": 0.5909094628095792, + "ppv": 0.6914896899045853, + "sample_id": "BUSI_0179_B", + "sen": 0.8024693796674325 + }, + { + "biou": 0.28957063931648597, + "biou_contour": 0.06666701234555099, + "dice": 0.7122785759145647, + "hd95": 26.309659957885742, + "inference_time_ms": 9.397693705977872, + "inference_time_seconds": 0.009397693705977872, + "iou": 0.5531309721887123, + "ppv": 0.9526143868277146, + "sample_id": "BUSI_0200_M", + "sen": 0.5687805298750702 + }, + { + "biou": 0.3143382983144946, + "biou_contour": 0.09117673788919474, + "dice": 0.891268834792724, + "hd95": 10.0, + "inference_time_ms": 9.397693705977872, + "inference_time_seconds": 0.009397693705977872, + "iou": 0.8038637916220107, + "ppv": 0.9835737186068222, + "sample_id": "BUSI_0067_B", + "sen": 0.8148025285495344 + }, + { + "biou": 0.34362947034180114, + "biou_contour": 0.13772506723049865, + "dice": 0.7608163460558085, + "hd95": 10.131365776062012, + "inference_time_ms": 9.397693705977872, + "inference_time_seconds": 0.009397693705977872, + "iou": 0.6139657952614236, + "ppv": 0.6436464580598815, + "sample_id": "BUSI_0379_B", + "sen": 0.930139734503047 + }, + { + "biou": 0.5395189530906125, + "biou_contour": 0.23674938630763737, + "dice": 0.9532275142174071, + "hd95": 3.822493314743042, + "inference_time_ms": 9.397693705977872, + "inference_time_seconds": 0.009397693705977872, + "iou": 0.9106348600632891, + "ppv": 0.9352159495342214, + "sample_id": "BUSI_0158_B", + "sen": 0.9719464837312696 + }, + { + "biou": 0.3329533257749913, + "biou_contour": 0.08965548632569438, + "dice": 0.888097663069744, + "hd95": 9.054885864257812, + "inference_time_ms": 10.765331448055804, + "inference_time_seconds": 0.010765331448055804, + "iou": 0.798719130891165, + "ppv": 0.8151260590510709, + "sample_id": "BUSI_0119_M", + "sen": 0.9754189957866483 + }, + { + "biou": 0.0617783451629131, + "biou_contour": 0.010593429959019077, + "dice": 0.6281086056569861, + "hd95": 32.0, + "inference_time_ms": 10.765331448055804, + "inference_time_seconds": 0.010765331448055804, + "iou": 0.4578413527716389, + "ppv": 0.9542461021058544, + "sample_id": "BUSI_0407_B", + "sen": 0.46811767610750427 + }, + { + "biou": 0.7490842950395064, + "biou_contour": 0.28934046226372473, + "dice": 0.9722116493257842, + "hd95": 1.0, + "inference_time_ms": 10.765331448055804, + "inference_time_seconds": 0.010765331448055804, + "iou": 0.9459259299314126, + "ppv": 0.9845798007263068, + "sample_id": "BUSI_0173_B", + "sen": 0.9601503789360617 + }, + { + "biou": 0.463959445283305, + "biou_contour": 0.14024416455970595, + "dice": 0.9335612062900832, + "hd95": 4.4721360206604, + "inference_time_ms": 10.765331448055804, + "inference_time_seconds": 0.010765331448055804, + "iou": 0.8754006460176024, + "ppv": 0.9771914142579868, + "sample_id": "BUSI_0421_B", + "sen": 0.8936605360466039 + }, + { + "biou": 0.7783784981737848, + "biou_contour": 0.31506943141173777, + "dice": 0.9333333481481448, + "hd95": 1.4142135381698608, + "inference_time_ms": 10.765331448055804, + "inference_time_seconds": 0.010765331448055804, + "iou": 0.8750000520833117, + "ppv": 0.9502262668659426, + "sample_id": "BUSI_0348_B", + "sen": 0.9170306039167668 + }, + { + "biou": 0.7138729150656316, + "biou_contour": 0.4051729265750633, + "dice": 0.9563909807224826, + "hd95": 2.2124598026275635, + "inference_time_ms": 10.765331448055804, + "inference_time_seconds": 0.010765331448055804, + "iou": 0.9164265250105872, + "ppv": 0.9891135320196685, + "sample_id": "BUSI_0023_B", + "sen": 0.9257642029455309 + }, + { + "biou": 0.525266020576327, + "biou_contour": 0.16731549909902763, + "dice": 0.9496611822444051, + "hd95": 4.123105525970459, + "inference_time_ms": 10.765331448055804, + "inference_time_seconds": 0.010765331448055804, + "iou": 0.9041474698549552, + "ppv": 0.9129827867388186, + "sample_id": "BUSI_0261_B", + "sen": 0.989409985405447 + }, + { + "biou": 1.5772868174626472e-07, + "biou_contour": 5.208330620661135e-07, + "dice": 1.1587484172945056e-07, + "hd95": 58.1602668762207, + "inference_time_ms": 10.765331448055804, + "inference_time_seconds": 0.010765331448055804, + "iou": 1.1587484172945056e-07, + "ppv": 1.626015995769757e-07, + "sample_id": "BUSI_0302_B", + "sen": 4.0322564386062747e-07 + }, + { + "biou": 0.1505263604986126, + "biou_contour": 0.03963981267751123, + "dice": 0.8559771536518038, + "hd95": 12.008319854736328, + "inference_time_ms": 10.765331448055804, + "inference_time_seconds": 0.010765331448055804, + "iou": 0.7482168375852918, + "ppv": 0.9945484713309203, + "sample_id": "BUSI_0002_M", + "sen": 0.7512981244172224 + }, + { + "biou": 0.7492113960234391, + "biou_contour": 0.32876742978656176, + "dice": 0.973445987524261, + "hd95": 1.4142135381698608, + "inference_time_ms": 10.765331448055804, + "inference_time_seconds": 0.010765331448055804, + "iou": 0.9482657290849071, + "ppv": 0.9877526033219471, + "sample_id": "BUSI_0289_B", + "sen": 0.9595478905682397 + }, + { + "biou": 0.6188437647015493, + "biou_contour": 0.190751912860166, + "dice": 0.9331568541921341, + "hd95": 2.177051067352295, + "inference_time_ms": 10.765331448055804, + "inference_time_seconds": 0.010765331448055804, + "iou": 0.8746898418498955, + "ppv": 0.8801498276966507, + "sample_id": "BUSI_0020_B", + "sen": 0.9929577474707398 + }, + { + "biou": 0.22093029295114006, + "biou_contour": 0.07329867191134244, + "dice": 0.9058869611553718, + "hd95": 8.377696990966797, + "inference_time_ms": 10.765331448055804, + "inference_time_seconds": 0.010765331448055804, + "iou": 0.8279646903372777, + "ppv": 0.9954102124093456, + "sample_id": "BUSI_0392_B", + "sen": 0.8311377285955035 + }, + { + "biou": 0.44683264176101334, + "biou_contour": 0.10963484729739295, + "dice": 0.9374375387280124, + "hd95": 5.656854152679443, + "inference_time_ms": 10.765331448055804, + "inference_time_seconds": 0.010765331448055804, + "iou": 0.8822422918644736, + "ppv": 0.9606718574079534, + "sample_id": "BUSI_0370_B", + "sen": 0.9153005497540769 + }, + { + "biou": 0.6372203018586217, + "biou_contour": 0.16774220395412778, + "dice": 0.9702609018379693, + "hd95": 2.0, + "inference_time_ms": 10.765331448055804, + "inference_time_seconds": 0.010765331448055804, + "iou": 0.9422395484677694, + "ppv": 0.9479500909821714, + "sample_id": "BUSI_0434_B", + "sen": 0.9936472349160226 + }, + { + "biou": 0.06320354431138145, + "biou_contour": 0.006135274191633685, + "dice": 0.43993392872471254, + "hd95": 42.035099029541016, + "inference_time_ms": 10.765331448055804, + "inference_time_seconds": 0.010765331448055804, + "iou": 0.2819969960061423, + "ppv": 0.29634342459957314, + "sample_id": "BUSI_0199_M", + "sen": 0.853479866897448 + }, + { + "biou": 0.6038062969193257, + "biou_contour": 0.16981171235296588, + "dice": 0.9492900629091252, + "hd95": 2.2360680103302, + "inference_time_ms": 10.765331448055804, + "inference_time_seconds": 0.010765331448055804, + "iou": 0.9034749109285783, + "ppv": 0.9427880787439098, + "sample_id": "BUSI_0088_M", + "sen": 0.9558823565455591 + } + ], + "strategy": 3, + "timing": { + "avg_batch_inference_ms": 311.66730052791536, + "avg_sample_inference_ms": 9.739603141497355, + "device": "cuda", + "mean_per_image_inference_ms": 9.739603141497355, + "mean_per_image_inference_seconds": 0.009739603141497355, + "num_batches": 2, + "num_samples": 64, + "scope": "test_set_evaluation", + "std_batch_inference_ms": 139.4219973590225, + "std_per_image_inference_ms": 0.5922045139069394, + "std_per_image_inference_seconds": 0.0005922045139069394, + "std_sample_inference_ms": 0.5922045139069394, + "strategy": 3, + "tmax": 8, + "total_inference_ms": 623.3346010558307 + } +} \ No newline at end of file diff --git a/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/phase_010/pct_100/repeat_01/strategy_3/final/evaluation_results.xlsx b/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/phase_010/pct_100/repeat_01/strategy_3/final/evaluation_results.xlsx new file mode 100644 index 0000000000000000000000000000000000000000..04329cbdbce60c4e382d0f7ac370fed5b26369ff Binary files /dev/null and b/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/phase_010/pct_100/repeat_01/strategy_3/final/evaluation_results.xlsx differ diff --git a/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/phase_010/pct_100/repeat_01/strategy_3/final/evaluation_summary.json b/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/phase_010/pct_100/repeat_01/strategy_3/final/evaluation_summary.json new file mode 100644 index 0000000000000000000000000000000000000000..eb496954852b9ad7ae03e79c51c2b500f3fbd931 --- /dev/null +++ b/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/phase_010/pct_100/repeat_01/strategy_3/final/evaluation_summary.json @@ -0,0 +1,4 @@ +{ + "mean_dice": 0.8223764300346375, + "mean_iou": 0.7351952791213989 +} \ No newline at end of file diff --git a/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/phase_010/pct_100/repeat_01/strategy_3/final/history.json b/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/phase_010/pct_100/repeat_01/strategy_3/final/history.json new file mode 100644 index 0000000000000000000000000000000000000000..01f3f9cd40f5e2fe4b0bc30e26d10225cc74fdb8 --- /dev/null +++ b/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/phase_010/pct_100/repeat_01/strategy_3/final/history.json @@ -0,0 +1,7958 @@ +[ + { + "alpha": null, + "early_stopping_active": false, + "early_stopping_best_value": null, + "early_stopping_improved": false, + "early_stopping_min_delta": 0.0, + "early_stopping_monitor_mode": "max", + "early_stopping_monitor_name": "val_refine_score", + "early_stopping_monitor_value": 0.5323830756660874, + "early_stopping_patience": 30, + "early_stopping_start_epoch": 30, + "early_stopping_wait": 0, + "encoder_lr": 0.000197150808455324, + "epoch": 1, + "epoch_seconds": 20.857935928739607, + "grad_norm": 1.2470211007378318, + "lr": 0.000197150808455324, + "selection_metric_name": "val_refine_score", + "selection_metric_value": 0.5323830756660874, + "strategy3_bootstrap_loaded": true, + "strategy3_decoder_state": "frozen", + "strategy3_encoder_state": "frozen", + "strategy3_freeze_active": true, + "strategy3_freeze_requested": true, + "strategy3_segmentation_head_state": "frozen", + "train_action_distribution": { + "max_abs_delta": 0.00118576396595348, + "mean_abs_delta": 0.0004358621504665776, + "mean_delta": 0.0004320821155323012, + "near_zero_pct": 9.128132429920946, + "negative_pct": 1.9626474929199587, + "positive_pct": 88.90922130508856 + }, + "train_actor_loss": 0.00014573485405187304, + "train_advantage_mean": 0.0, + "train_advantage_std": 0.0, + "train_alpha": 0.0, + "train_annealed_aux_ce_weight": 0.0, + "train_biou_delta_mean": -0.00014573485405187304, + "train_ce_loss": 0.0, + "train_critic_loss": 0.0, + "train_dice": 0.8564677874174916, + "train_dice_loss": 0.0, + "train_effective_steps": 8.0, + "train_entropy": 0.0, + "train_entropy_bonus_used": 0.0, + "train_entropy_loss": 0.0, + "train_iou": 0.774537076779147, + "train_loss": 0.0014573485161897472, + "train_mask_delta_mean": 0.00043591586026278407, + "train_mean_reward": -0.00014573485405187304, + "train_mean_value_pred": 0.0, + "train_reinforce_loss": 0.0, + "train_reward_zeros_pct": 9.090909090909092, + "train_rl_loss_scale": 10.0, + "train_value_pred_error": 0.0, + "val_actor_loss": -0.0003161297727274359, + "val_binary_flips_correct_pct": 0.004338283164828432, + "val_binary_flips_total_pct": 0.007808909696691176, + "val_binary_flips_wrong_pct": 0.003470626531862745, + "val_biou": 0.38451820211176385, + "val_biou_gain": -0.00014118571908583455, + "val_ce_loss": 0.0, + "val_critic_loss": 0.0, + "val_decoder_biou": 0.3846593878308497, + "val_decoder_dice": 0.770921132483555, + "val_decoder_iou": 0.6801783568719756, + "val_dice": 0.7710345013630495, + "val_dice_gain": 0.00011336887949453534, + "val_dice_loss": 0.0, + "val_entropy": 0.0, + "val_iou": 0.6802479492204111, + "val_iou_gain": 6.959234843550988e-05, + "val_loss": -0.003161297727274359, + "val_refine_score": 0.5323830756660874, + "val_reward": 0.0003161297727274359, + "validated_this_epoch": true + }, + { + "alpha": null, + "early_stopping_active": false, + "early_stopping_best_value": null, + "early_stopping_improved": false, + "early_stopping_min_delta": 0.0, + "early_stopping_monitor_mode": "max", + "early_stopping_monitor_name": "val_refine_score", + "early_stopping_monitor_value": 0.5329871943651605, + "early_stopping_patience": 30, + "early_stopping_start_epoch": 30, + "early_stopping_wait": 0, + "encoder_lr": 0.00019704999023999762, + "epoch": 2, + "epoch_seconds": 12.253615047316998, + "grad_norm": 3.6825139739296655, + "lr": 0.00019704999023999762, + "selection_metric_name": "val_refine_score", + "selection_metric_value": 0.5329871943651605, + "strategy3_bootstrap_loaded": true, + "strategy3_decoder_state": "frozen", + "strategy3_encoder_state": "frozen", + "strategy3_freeze_active": true, + "strategy3_freeze_requested": true, + "strategy3_segmentation_head_state": "frozen", + "train_action_distribution": { + "max_abs_delta": 0.0054895227605646305, + "mean_abs_delta": 0.0006112990071084245, + "mean_delta": -0.00016603624937322985, + "near_zero_pct": 0.10864541073632691, + "negative_pct": 44.129886613650754, + "positive_pct": 55.76147045516832 + }, + "train_actor_loss": -0.0012639207575582325, + "train_advantage_mean": 0.0, + "train_advantage_std": 0.0, + "train_alpha": 0.0, + "train_annealed_aux_ce_weight": 0.0, + "train_biou_delta_mean": 0.0012639207575582325, + "train_ce_loss": 0.0, + "train_critic_loss": 0.0, + "train_dice": 0.8596735475865291, + "train_dice_loss": 0.0, + "train_effective_steps": 8.0, + "train_entropy": 0.0, + "train_entropy_bonus_used": 0.0, + "train_entropy_loss": 0.0, + "train_iou": 0.7775828389724143, + "train_loss": -0.012639207746939395, + "train_mask_delta_mean": 0.0006112077019431374, + "train_mean_reward": 0.0012639207575582325, + "train_mean_value_pred": 0.0, + "train_reinforce_loss": 0.0, + "train_reward_zeros_pct": 0.0, + "train_rl_loss_scale": 10.0, + "train_value_pred_error": 0.0, + "val_actor_loss": -0.0036684239639726, + "val_binary_flips_correct_pct": 0.01830680697571998, + "val_binary_flips_total_pct": 0.04113889208026961, + "val_binary_flips_wrong_pct": 0.02283208510454963, + "val_biou": 0.3856027050125447, + "val_biou_gain": 0.0009433171816949915, + "val_ce_loss": 0.0, + "val_critic_loss": 0.0, + "val_decoder_biou": 0.3846593878308497, + "val_decoder_dice": 0.770921132483555, + "val_decoder_iou": 0.6801783568719756, + "val_dice": 0.7708045752396656, + "val_dice_gain": -0.00011655724388937028, + "val_dice_loss": 0.0, + "val_entropy": 0.0, + "val_iou": 0.6803716837177762, + "val_iou_gain": 0.0001933268458006454, + "val_loss": -0.036684239639726, + "val_refine_score": 0.5329871943651605, + "val_reward": 0.0036684239639726, + "validated_this_epoch": true + }, + { + "alpha": null, + "early_stopping_active": false, + "early_stopping_best_value": null, + "early_stopping_improved": false, + "early_stopping_min_delta": 0.0, + "early_stopping_monitor_mode": "max", + "early_stopping_monitor_name": "val_refine_score", + "early_stopping_monitor_value": 0.5392920596404744, + "early_stopping_patience": 30, + "early_stopping_start_epoch": 30, + "early_stopping_wait": 0, + "encoder_lr": 0.00019688203665595106, + "epoch": 3, + "epoch_seconds": 12.25770170520991, + "grad_norm": 4.343270301818848, + "lr": 0.00019688203665595106, + "selection_metric_name": "val_refine_score", + "selection_metric_value": 0.5392920596404744, + "strategy3_bootstrap_loaded": true, + "strategy3_decoder_state": "frozen", + "strategy3_encoder_state": "frozen", + "strategy3_freeze_active": true, + "strategy3_freeze_requested": true, + "strategy3_segmentation_head_state": "frozen", + "train_action_distribution": { + "max_abs_delta": 0.022838939319957386, + "mean_abs_delta": 0.004591274464143102, + "mean_delta": -0.003867683299838311, + "near_zero_pct": 0.002191777873215208, + "negative_pct": 93.45962073315273, + "positive_pct": 6.538189405744726 + }, + "train_actor_loss": -0.005299722203000618, + "train_advantage_mean": 0.0, + "train_advantage_std": 0.0, + "train_alpha": 0.0, + "train_annealed_aux_ce_weight": 0.0, + "train_biou_delta_mean": 0.0052997222453334625, + "train_ce_loss": 0.0, + "train_critic_loss": 0.0, + "train_dice": 0.8614730028000362, + "train_dice_loss": 0.0, + "train_effective_steps": 8.0, + "train_entropy": 0.0, + "train_entropy_bonus_used": 0.0, + "train_entropy_loss": 0.0, + "train_iou": 0.7797411389848355, + "train_loss": -0.05299722267822786, + "train_mask_delta_mean": 0.004591161554509943, + "train_mean_reward": 0.005299722203000618, + "train_mean_value_pred": 0.0, + "train_reinforce_loss": 0.0, + "train_reward_zeros_pct": 0.18939394503831863, + "train_rl_loss_scale": 10.0, + "train_value_pred_error": 0.0, + "val_actor_loss": -0.004999919343390502, + "val_binary_flips_correct_pct": 0.06367178524241728, + "val_binary_flips_total_pct": 0.12051451439950982, + "val_binary_flips_wrong_pct": 0.05684272915709252, + "val_biou": 0.39098109167217526, + "val_biou_gain": 0.006321703841325577, + "val_ce_loss": 0.0, + "val_critic_loss": 0.0, + "val_decoder_biou": 0.3846593878308497, + "val_decoder_dice": 0.770921132483555, + "val_decoder_iou": 0.6801783568719756, + "val_dice": 0.776796127761454, + "val_dice_gain": 0.005874995277899031, + "val_dice_loss": 0.0, + "val_entropy": 0.0, + "val_iou": 0.6876030276087736, + "val_iou_gain": 0.007424670736797978, + "val_loss": -0.04999919343390502, + "val_refine_score": 0.5392920596404744, + "val_reward": 0.004999919343390502, + "validated_this_epoch": true + }, + { + "alpha": null, + "early_stopping_active": false, + "early_stopping_best_value": null, + "early_stopping_improved": false, + "early_stopping_min_delta": 0.0, + "early_stopping_monitor_mode": "max", + "early_stopping_monitor_name": "val_refine_score", + "early_stopping_monitor_value": 0.5399993188333105, + "early_stopping_patience": 30, + "early_stopping_start_epoch": 30, + "early_stopping_wait": 0, + "encoder_lr": 0.0001966470628101813, + "epoch": 4, + "epoch_seconds": 12.290663342922926, + "grad_norm": 3.234005169434981, + "lr": 0.0001966470628101813, + "selection_metric_name": "val_refine_score", + "selection_metric_value": 0.5399993188333105, + "strategy3_bootstrap_loaded": true, + "strategy3_decoder_state": "frozen", + "strategy3_encoder_state": "frozen", + "strategy3_freeze_active": true, + "strategy3_freeze_requested": true, + "strategy3_segmentation_head_state": "frozen", + "train_action_distribution": { + "max_abs_delta": 0.07196877219460228, + "mean_abs_delta": 0.007909947498278185, + "mean_delta": -0.005628062060250985, + "near_zero_pct": 0.0006055147586246014, + "negative_pct": 91.9309708882462, + "positive_pct": 8.06842572055757 + }, + "train_actor_loss": -0.008496558069799159, + "train_advantage_mean": 0.0, + "train_advantage_std": 0.0, + "train_alpha": 0.0, + "train_annealed_aux_ce_weight": 0.0, + "train_biou_delta_mean": 0.008496558069799159, + "train_ce_loss": 0.0, + "train_critic_loss": 0.0, + "train_dice": 0.8723926764326723, + "train_dice_loss": 0.0, + "train_effective_steps": 8.0, + "train_entropy": 0.0, + "train_entropy_bonus_used": 0.0, + "train_entropy_loss": 0.0, + "train_iou": 0.7914604994982537, + "train_loss": -0.08496557921171188, + "train_mask_delta_mean": 0.007907520640980114, + "train_mean_reward": 0.008496558069799159, + "train_mean_value_pred": 0.0, + "train_reinforce_loss": 0.0, + "train_reward_zeros_pct": 0.4398425130850889, + "train_rl_loss_scale": 10.0, + "train_value_pred_error": 0.0, + "val_actor_loss": -0.008989232090243604, + "val_binary_flips_correct_pct": 0.0884074790804994, + "val_binary_flips_total_pct": 0.17676259957107843, + "val_binary_flips_wrong_pct": 0.08835512049057904, + "val_biou": 0.3935581023678467, + "val_biou_gain": 0.008898714536997032, + "val_ce_loss": 0.0, + "val_critic_loss": 0.0, + "val_decoder_biou": 0.3846593878308497, + "val_decoder_dice": 0.770921132483555, + "val_decoder_iou": 0.6801783568719756, + "val_dice": 0.7757685529290304, + "val_dice_gain": 0.00484742044547537, + "val_dice_loss": 0.0, + "val_entropy": 0.0, + "val_iou": 0.6864405352987742, + "val_iou_gain": 0.006262178426798659, + "val_loss": -0.08989232090243604, + "val_refine_score": 0.5399993188333105, + "val_reward": 0.008989232090243604, + "validated_this_epoch": true + }, + { + "alpha": null, + "early_stopping_active": false, + "early_stopping_best_value": null, + "early_stopping_improved": false, + "early_stopping_min_delta": 0.0, + "early_stopping_monitor_mode": "max", + "early_stopping_monitor_name": "val_refine_score", + "early_stopping_monitor_value": 0.5458989670397439, + "early_stopping_patience": 30, + "early_stopping_start_epoch": 30, + "early_stopping_wait": 0, + "encoder_lr": 0.0001963452297420251, + "epoch": 5, + "epoch_seconds": 12.291189740411937, + "grad_norm": 2.2165682966058906, + "lr": 0.0001963452297420251, + "selection_metric_name": "val_refine_score", + "selection_metric_value": 0.5458989670397439, + "strategy3_bootstrap_loaded": true, + "strategy3_decoder_state": "frozen", + "strategy3_encoder_state": "frozen", + "strategy3_freeze_active": true, + "strategy3_freeze_requested": true, + "strategy3_segmentation_head_state": "frozen", + "train_action_distribution": { + "max_abs_delta": 0.095947265625, + "mean_abs_delta": 0.009829189755361189, + "mean_delta": -0.006006908841134811, + "near_zero_pct": 0.000463604367372351, + "negative_pct": 91.65063500404358, + "positive_pct": 8.348903381689029 + }, + "train_actor_loss": -0.011929053875395435, + "train_advantage_mean": 0.0, + "train_advantage_std": 0.0, + "train_alpha": 0.0, + "train_annealed_aux_ce_weight": 0.0, + "train_biou_delta_mean": 0.011929053917728279, + "train_ce_loss": 0.0, + "train_critic_loss": 0.0, + "train_dice": 0.8741900763780592, + "train_dice_loss": 0.0, + "train_effective_steps": 8.0, + "train_entropy": 0.0, + "train_entropy_bonus_used": 0.0, + "train_entropy_loss": 0.0, + "train_iou": 0.7950611072337673, + "train_loss": -0.11929053677753969, + "train_mask_delta_mean": 0.009828740900213068, + "train_mean_reward": 0.011929053875395435, + "train_mean_value_pred": 0.0, + "train_reinforce_loss": 0.0, + "train_reward_zeros_pct": 0.18939394503831863, + "train_rl_loss_scale": 10.0, + "train_value_pred_error": 0.0, + "val_actor_loss": -0.009191884513711557, + "val_binary_flips_correct_pct": 0.17233829872280942, + "val_binary_flips_total_pct": 0.32914479573567706, + "val_binary_flips_wrong_pct": 0.15680649701286764, + "val_biou": 0.3960624443972492, + "val_biou_gain": 0.011403056566399505, + "val_ce_loss": 0.0, + "val_critic_loss": 0.0, + "val_decoder_biou": 0.3846593878308497, + "val_decoder_dice": 0.770921132483555, + "val_decoder_iou": 0.6801783568719756, + "val_dice": 0.7842319827718962, + "val_dice_gain": 0.013310850288341225, + "val_dice_loss": 0.0, + "val_entropy": 0.0, + "val_iou": 0.6957354896822388, + "val_iou_gain": 0.015557132810263163, + "val_loss": -0.09191884513711557, + "val_refine_score": 0.5458989670397439, + "val_reward": 0.009191884513711557, + "validated_this_epoch": true + }, + { + "alpha": null, + "early_stopping_active": false, + "early_stopping_best_value": null, + "early_stopping_improved": false, + "early_stopping_min_delta": 0.0, + "early_stopping_monitor_mode": "max", + "early_stopping_monitor_name": "val_refine_score", + "early_stopping_monitor_value": 0.5437339765444751, + "early_stopping_patience": 30, + "early_stopping_start_epoch": 30, + "early_stopping_wait": 0, + "encoder_lr": 0.00019597674431279043, + "epoch": 6, + "epoch_seconds": 12.353693992830813, + "grad_norm": 1.8024428757754238, + "lr": 0.00019597674431279043, + "selection_metric_name": "val_refine_score", + "selection_metric_value": 0.5437339765444751, + "strategy3_bootstrap_loaded": true, + "strategy3_decoder_state": "frozen", + "strategy3_encoder_state": "frozen", + "strategy3_freeze_active": true, + "strategy3_freeze_requested": true, + "strategy3_segmentation_head_state": "frozen", + "train_action_distribution": { + "max_abs_delta": 0.09954833984375, + "mean_abs_delta": 0.012235825690864162, + "mean_delta": -0.007086258672643453, + "near_zero_pct": 0.0003138607646426615, + "negative_pct": 91.42331203276461, + "positive_pct": 8.576376431367613 + }, + "train_actor_loss": -0.012876987986932032, + "train_advantage_mean": 0.0, + "train_advantage_std": 0.0, + "train_alpha": 0.0, + "train_annealed_aux_ce_weight": 0.0, + "train_biou_delta_mean": 0.012876988071597721, + "train_ce_loss": 0.0, + "train_critic_loss": 0.0, + "train_dice": 0.8793686495124308, + "train_dice_loss": 0.0, + "train_effective_steps": 8.0, + "train_entropy": 0.0, + "train_entropy_bonus_used": 0.0, + "train_entropy_loss": 0.0, + "train_iou": 0.8013525955984425, + "train_loss": -0.12876987931403247, + "train_mask_delta_mean": 0.012235468084161932, + "train_mean_reward": 0.012876987986932032, + "train_mean_value_pred": 0.0, + "train_reinforce_loss": 0.0, + "train_reward_zeros_pct": 0.4934210626577789, + "train_rl_loss_scale": 10.0, + "train_value_pred_error": 0.0, + "val_actor_loss": -0.010951879059575731, + "val_binary_flips_correct_pct": 0.15387441597732843, + "val_binary_flips_total_pct": 0.3011516496246936, + "val_binary_flips_wrong_pct": 0.14727723364736517, + "val_biou": 0.39920500188937263, + "val_biou_gain": 0.014545614058522949, + "val_ce_loss": 0.0, + "val_critic_loss": 0.0, + "val_decoder_biou": 0.3846593878308497, + "val_decoder_dice": 0.770921132483555, + "val_decoder_iou": 0.6801783568719756, + "val_dice": 0.7764527665569049, + "val_dice_gain": 0.005531634073349889, + "val_dice_loss": 0.0, + "val_entropy": 0.0, + "val_iou": 0.6882629511995775, + "val_iou_gain": 0.00808459432760189, + "val_loss": -0.10951879059575731, + "val_refine_score": 0.5437339765444751, + "val_reward": 0.010951879059575731, + "validated_this_epoch": true + }, + { + "alpha": null, + "early_stopping_active": false, + "early_stopping_best_value": null, + "early_stopping_improved": false, + "early_stopping_min_delta": 0.0, + "early_stopping_monitor_mode": "max", + "early_stopping_monitor_name": "val_refine_score", + "early_stopping_monitor_value": 0.5488487948001641, + "early_stopping_patience": 30, + "early_stopping_start_epoch": 30, + "early_stopping_wait": 0, + "encoder_lr": 0.00019554185906398426, + "epoch": 7, + "epoch_seconds": 12.296839237678796, + "grad_norm": 1.3619365746324712, + "lr": 0.00019554185906398426, + "selection_metric_name": "val_refine_score", + "selection_metric_value": 0.5488487948001641, + "strategy3_bootstrap_loaded": true, + "strategy3_decoder_state": "frozen", + "strategy3_encoder_state": "frozen", + "strategy3_freeze_active": true, + "strategy3_freeze_requested": true, + "strategy3_segmentation_head_state": "frozen", + "train_action_distribution": { + "max_abs_delta": 0.10003662109375, + "mean_abs_delta": 0.014392873515713622, + "mean_delta": -0.00800208011324602, + "near_zero_pct": 0.0002558341710761686, + "negative_pct": 91.40178886326876, + "positive_pct": 8.5979572835971 + }, + "train_actor_loss": -0.013540513309697582, + "train_advantage_mean": 0.0, + "train_advantage_std": 0.0, + "train_alpha": 0.0, + "train_annealed_aux_ce_weight": 0.0, + "train_biou_delta_mean": 0.01354051339436327, + "train_ce_loss": 0.0, + "train_critic_loss": 0.0, + "train_dice": 0.883738906704013, + "train_dice_loss": 0.0, + "train_effective_steps": 8.0, + "train_entropy": 0.0, + "train_entropy_bonus_used": 0.0, + "train_entropy_loss": 0.0, + "train_iou": 0.8059517016593007, + "train_loss": -0.13540513068437576, + "train_mask_delta_mean": 0.01439389315518466, + "train_mean_reward": 0.013540513309697582, + "train_mean_value_pred": 0.0, + "train_reinforce_loss": 0.0, + "train_reward_zeros_pct": 0.28409091755747795, + "train_rl_loss_scale": 10.0, + "train_value_pred_error": 0.0, + "val_actor_loss": -0.011212667734071147, + "val_binary_flips_correct_pct": 0.15258415072571996, + "val_binary_flips_total_pct": 0.2820781632965686, + "val_binary_flips_wrong_pct": 0.12949401257084864, + "val_biou": 0.4031288981390491, + "val_biou_gain": 0.018469510308199433, + "val_ce_loss": 0.0, + "val_critic_loss": 0.0, + "val_decoder_biou": 0.3846593878308497, + "val_decoder_dice": 0.770921132483555, + "val_decoder_iou": 0.6801783568719756, + "val_dice": 0.7826768147270591, + "val_dice_gain": 0.011755682243504095, + "val_dice_loss": 0.0, + "val_entropy": 0.0, + "val_iou": 0.6945686914612792, + "val_iou_gain": 0.01439033458930361, + "val_loss": -0.11212667734071147, + "val_refine_score": 0.5488487948001641, + "val_reward": 0.011212667734071147, + "validated_this_epoch": true + }, + { + "alpha": null, + "early_stopping_active": false, + "early_stopping_best_value": null, + "early_stopping_improved": false, + "early_stopping_min_delta": 0.0, + "early_stopping_monitor_mode": "max", + "early_stopping_monitor_name": "val_refine_score", + "early_stopping_monitor_value": 0.5504193133731917, + "early_stopping_patience": 30, + "early_stopping_start_epoch": 30, + "early_stopping_wait": 0, + "encoder_lr": 0.00019504087204423308, + "epoch": 8, + "epoch_seconds": 12.300445227418095, + "grad_norm": 1.020984254100106, + "lr": 0.00019504087204423308, + "selection_metric_name": "val_refine_score", + "selection_metric_value": 0.5504193133731917, + "strategy3_bootstrap_loaded": true, + "strategy3_decoder_state": "frozen", + "strategy3_encoder_state": "frozen", + "strategy3_freeze_active": true, + "strategy3_freeze_requested": true, + "strategy3_segmentation_head_state": "frozen", + "train_action_distribution": { + "max_abs_delta": 0.10009765625, + "mean_abs_delta": 0.016005652184090155, + "mean_delta": -0.009576954688368873, + "near_zero_pct": 0.0003394137613874839, + "negative_pct": 91.27052561803298, + "positive_pct": 8.729137073863637 + }, + "train_actor_loss": -0.014631731815329245, + "train_advantage_mean": 0.0, + "train_advantage_std": 0.0, + "train_alpha": 0.0, + "train_annealed_aux_ce_weight": 0.0, + "train_biou_delta_mean": 0.014631731688330712, + "train_ce_loss": 0.0, + "train_critic_loss": 0.0, + "train_dice": 0.8881651188951264, + "train_dice_loss": 0.0, + "train_effective_steps": 8.0, + "train_entropy": 0.0, + "train_entropy_bonus_used": 0.0, + "train_entropy_loss": 0.0, + "train_iou": 0.8116729872757467, + "train_loss": -0.14631731672720474, + "train_mask_delta_mean": 0.016005776145241478, + "train_mean_reward": 0.014631731815329245, + "train_mean_value_pred": 0.0, + "train_reinforce_loss": 0.0, + "train_reward_zeros_pct": 0.4261363763362169, + "train_rl_loss_scale": 10.0, + "train_value_pred_error": 0.0, + "val_actor_loss": -0.011314602052152622, + "val_binary_flips_correct_pct": 0.18113080193014705, + "val_binary_flips_total_pct": 0.3388872333601409, + "val_binary_flips_wrong_pct": 0.15775643142999385, + "val_biou": 0.40494047899258406, + "val_biou_gain": 0.020281091161734377, + "val_ce_loss": 0.0, + "val_critic_loss": 0.0, + "val_decoder_biou": 0.3846593878308497, + "val_decoder_dice": 0.770921132483555, + "val_decoder_iou": 0.6801783568719756, + "val_dice": 0.7838355268664099, + "val_dice_gain": 0.01291439438285491, + "val_dice_loss": 0.0, + "val_entropy": 0.0, + "val_iou": 0.6958981477537994, + "val_iou_gain": 0.015719790881823847, + "val_loss": -0.11314602052152622, + "val_refine_score": 0.5504193133731917, + "val_reward": 0.011314602052152622, + "validated_this_epoch": true + }, + { + "alpha": null, + "early_stopping_active": false, + "early_stopping_best_value": null, + "early_stopping_improved": false, + "early_stopping_min_delta": 0.0, + "early_stopping_monitor_mode": "max", + "early_stopping_monitor_name": "val_refine_score", + "early_stopping_monitor_value": 0.5474015201221043, + "early_stopping_patience": 30, + "early_stopping_start_epoch": 30, + "early_stopping_wait": 0, + "encoder_lr": 0.00019447412660501538, + "epoch": 9, + "epoch_seconds": 12.347886855248362, + "grad_norm": 0.9574723081155256, + "lr": 0.00019447412660501538, + "selection_metric_name": "val_refine_score", + "selection_metric_value": 0.5474015201221043, + "strategy3_bootstrap_loaded": true, + "strategy3_decoder_state": "frozen", + "strategy3_encoder_state": "frozen", + "strategy3_freeze_active": true, + "strategy3_freeze_requested": true, + "strategy3_segmentation_head_state": "frozen", + "train_action_distribution": { + "max_abs_delta": 0.10009765625, + "mean_abs_delta": 0.01665422931017185, + "mean_delta": -0.009307725386778739, + "near_zero_pct": 0.00029515232233217665, + "negative_pct": 91.28680269826542, + "positive_pct": 8.712903977456419 + }, + "train_actor_loss": -0.014496535035008988, + "train_advantage_mean": 0.0, + "train_advantage_std": 0.0, + "train_alpha": 0.0, + "train_annealed_aux_ce_weight": 0.0, + "train_biou_delta_mean": 0.014496534908010455, + "train_ce_loss": 0.0, + "train_critic_loss": 0.0, + "train_dice": 0.8828031661872582, + "train_dice_loss": 0.0, + "train_effective_steps": 8.0, + "train_entropy": 0.0, + "train_entropy_bonus_used": 0.0, + "train_entropy_loss": 0.0, + "train_iou": 0.806751416725622, + "train_loss": -0.14496534724127164, + "train_mask_delta_mean": 0.016655661843039772, + "train_mean_reward": 0.014496535035008988, + "train_mean_value_pred": 0.0, + "train_reinforce_loss": 0.0, + "train_reward_zeros_pct": 0.2604166744276881, + "train_rl_loss_scale": 10.0, + "train_value_pred_error": 0.0, + "val_actor_loss": -0.010835837334582266, + "val_binary_flips_correct_pct": 0.19273944929534315, + "val_binary_flips_total_pct": 0.37470798866421573, + "val_binary_flips_wrong_pct": 0.18196853936887253, + "val_biou": 0.4017224607336417, + "val_biou_gain": 0.01706307290279202, + "val_ce_loss": 0.0, + "val_critic_loss": 0.0, + "val_decoder_biou": 0.3846593878308497, + "val_decoder_dice": 0.770921132483555, + "val_decoder_iou": 0.6801783568719756, + "val_dice": 0.7821155409611252, + "val_dice_gain": 0.01119440847757025, + "val_dice_loss": 0.0, + "val_entropy": 0.0, + "val_iou": 0.6930805795105668, + "val_iou_gain": 0.012902222638591199, + "val_loss": -0.10835837334582266, + "val_refine_score": 0.5474015201221043, + "val_reward": 0.010835837334582266, + "validated_this_epoch": true + }, + { + "alpha": null, + "early_stopping_active": false, + "early_stopping_best_value": null, + "early_stopping_improved": false, + "early_stopping_min_delta": 0.0, + "early_stopping_monitor_mode": "max", + "early_stopping_monitor_name": "val_refine_score", + "early_stopping_monitor_value": 0.548845755044025, + "early_stopping_patience": 30, + "early_stopping_start_epoch": 30, + "early_stopping_wait": 0, + "encoder_lr": 0.00019384201116534564, + "epoch": 10, + "epoch_seconds": 12.350794611964375, + "grad_norm": 1.221558847210624, + "lr": 0.00019384201116534564, + "selection_metric_name": "val_refine_score", + "selection_metric_value": 0.548845755044025, + "strategy3_bootstrap_loaded": true, + "strategy3_decoder_state": "frozen", + "strategy3_encoder_state": "frozen", + "strategy3_freeze_active": true, + "strategy3_freeze_requested": true, + "strategy3_segmentation_head_state": "frozen", + "train_action_distribution": { + "max_abs_delta": 0.10009765625, + "mean_abs_delta": 0.01812802038197829, + "mean_delta": -0.010716243509457192, + "near_zero_pct": 4.236017603757732e-05, + "negative_pct": 91.3002261383967, + "positive_pct": 8.699733247472482 + }, + "train_actor_loss": -0.014575577170200466, + "train_advantage_mean": 0.0, + "train_advantage_std": 0.0, + "train_alpha": 0.0, + "train_annealed_aux_ce_weight": 0.0, + "train_biou_delta_mean": 0.014575577170200466, + "train_ce_loss": 0.0, + "train_critic_loss": 0.0, + "train_dice": 0.8828751181635395, + "train_dice_loss": 0.0, + "train_effective_steps": 8.0, + "train_entropy": 0.0, + "train_entropy_bonus_used": 0.0, + "train_entropy_loss": 0.0, + "train_iou": 0.8071588781268677, + "train_loss": -0.14575576917691666, + "train_mask_delta_mean": 0.01812536066228693, + "train_mean_reward": 0.014575577170200466, + "train_mean_value_pred": 0.0, + "train_reinforce_loss": 0.0, + "train_reward_zeros_pct": 0.4734848625957966, + "train_rl_loss_scale": 10.0, + "train_value_pred_error": 0.0, + "val_actor_loss": -0.011629480286501348, + "val_binary_flips_correct_pct": 0.1978930305032169, + "val_binary_flips_total_pct": 0.38920383827359073, + "val_binary_flips_wrong_pct": 0.1913108077703738, + "val_biou": 0.40360623494380155, + "val_biou_gain": 0.01894684711295186, + "val_ce_loss": 0.0, + "val_critic_loss": 0.0, + "val_decoder_biou": 0.3846593878308497, + "val_decoder_dice": 0.770921132483555, + "val_decoder_iou": 0.6801783568719756, + "val_dice": 0.782072945618576, + "val_dice_gain": 0.011151813135021005, + "val_dice_loss": 0.0, + "val_entropy": 0.0, + "val_iou": 0.6940852751442484, + "val_iou_gain": 0.013906918272272861, + "val_loss": -0.11629480286501348, + "val_refine_score": 0.548845755044025, + "val_reward": 0.011629480286501348, + "validated_this_epoch": true + }, + { + "alpha": null, + "early_stopping_active": false, + "early_stopping_best_value": null, + "early_stopping_improved": false, + "early_stopping_min_delta": 0.0, + "early_stopping_monitor_mode": "max", + "early_stopping_monitor_name": "val_refine_score", + "early_stopping_monitor_value": 0.5515401039821703, + "early_stopping_patience": 30, + "early_stopping_start_epoch": 30, + "early_stopping_wait": 0, + "encoder_lr": 0.00019314495894557135, + "epoch": 11, + "epoch_seconds": 12.336989048868418, + "grad_norm": 0.5716894458640706, + "lr": 0.00019314495894557135, + "selection_metric_name": "val_refine_score", + "selection_metric_value": 0.5515401039821703, + "strategy3_bootstrap_loaded": true, + "strategy3_decoder_state": "frozen", + "strategy3_encoder_state": "frozen", + "strategy3_freeze_active": true, + "strategy3_freeze_requested": true, + "strategy3_segmentation_head_state": "frozen", + "train_action_distribution": { + "max_abs_delta": 0.10009765625, + "mean_abs_delta": 0.018724207067862153, + "mean_delta": -0.011395153324966404, + "near_zero_pct": 8.137412663700161e-05, + "negative_pct": 91.33457446640188, + "positive_pct": 8.66534636271271 + }, + "train_actor_loss": -0.015223940945402732, + "train_advantage_mean": 0.0, + "train_advantage_std": 0.0, + "train_alpha": 0.0, + "train_annealed_aux_ce_weight": 0.0, + "train_biou_delta_mean": 0.015223941030068421, + "train_ce_loss": 0.0, + "train_critic_loss": 0.0, + "train_dice": 0.8868702254308858, + "train_dice_loss": 0.0, + "train_effective_steps": 8.0, + "train_entropy": 0.0, + "train_entropy_bonus_used": 0.0, + "train_entropy_loss": 0.0, + "train_iou": 0.8106436665637774, + "train_loss": -0.15223940800536762, + "train_mask_delta_mean": 0.01871698552911932, + "train_mean_reward": 0.015223940945402732, + "train_mean_value_pred": 0.0, + "train_reinforce_loss": 0.0, + "train_reward_zeros_pct": 0.5108652424744584, + "train_rl_loss_scale": 10.0, + "train_value_pred_error": 0.0, + "val_actor_loss": -0.011743333623599028, + "val_binary_flips_correct_pct": 0.23697497797947303, + "val_binary_flips_total_pct": 0.44449076933019305, + "val_binary_flips_wrong_pct": 0.20751579135071996, + "val_biou": 0.4052743502145183, + "val_biou_gain": 0.02061496238366861, + "val_ce_loss": 0.0, + "val_critic_loss": 0.0, + "val_decoder_biou": 0.3846593878308497, + "val_decoder_dice": 0.770921132483555, + "val_decoder_iou": 0.6801783568719756, + "val_dice": 0.7849915511960827, + "val_dice_gain": 0.014070418712527677, + "val_dice_loss": 0.0, + "val_entropy": 0.0, + "val_iou": 0.6978058577498225, + "val_iou_gain": 0.017627500877846924, + "val_loss": -0.11743333623599028, + "val_refine_score": 0.5515401039821703, + "val_reward": 0.011743333623599028, + "validated_this_epoch": true + }, + { + "alpha": null, + "early_stopping_active": false, + "early_stopping_best_value": null, + "early_stopping_improved": false, + "early_stopping_min_delta": 0.0, + "early_stopping_monitor_mode": "max", + "early_stopping_monitor_name": "val_refine_score", + "early_stopping_monitor_value": 0.5494988520700765, + "early_stopping_patience": 30, + "early_stopping_start_epoch": 30, + "early_stopping_wait": 0, + "encoder_lr": 0.0001923834476704654, + "epoch": 12, + "epoch_seconds": 12.347542142029852, + "grad_norm": 0.840914634141055, + "lr": 0.0001923834476704654, + "selection_metric_name": "val_refine_score", + "selection_metric_value": 0.5494988520700765, + "strategy3_bootstrap_loaded": true, + "strategy3_decoder_state": "frozen", + "strategy3_encoder_state": "frozen", + "strategy3_freeze_active": true, + "strategy3_freeze_requested": true, + "strategy3_segmentation_head_state": "frozen", + "train_action_distribution": { + "max_abs_delta": 0.10009765625, + "mean_abs_delta": 0.020495104349472305, + "mean_delta": -0.012462727778421884, + "near_zero_pct": 8.715397089273128e-05, + "negative_pct": 91.16780507293615, + "positive_pct": 8.83210955018347 + }, + "train_actor_loss": -0.015221707545027708, + "train_advantage_mean": 0.0, + "train_advantage_std": 0.0, + "train_alpha": 0.0, + "train_annealed_aux_ce_weight": 0.0, + "train_biou_delta_mean": 0.015221707545027708, + "train_ce_loss": 0.0, + "train_critic_loss": 0.0, + "train_dice": 0.8852217208578045, + "train_dice_loss": 0.0, + "train_effective_steps": 8.0, + "train_entropy": 0.0, + "train_entropy_bonus_used": 0.0, + "train_entropy_loss": 0.0, + "train_iou": 0.8109940756700399, + "train_loss": -0.15221707387404007, + "train_mask_delta_mean": 0.020489779385653408, + "train_mean_reward": 0.015221707545027708, + "train_mean_value_pred": 0.0, + "train_reinforce_loss": 0.0, + "train_reward_zeros_pct": 0.5918560782447457, + "train_rl_loss_scale": 10.0, + "train_value_pred_error": 0.0, + "val_actor_loss": -0.011469599216070492, + "val_binary_flips_correct_pct": 0.2164616304285386, + "val_binary_flips_total_pct": 0.41904449462890625, + "val_binary_flips_wrong_pct": 0.20258286420036764, + "val_biou": 0.4052744330310891, + "val_biou_gain": 0.020615045200239435, + "val_ce_loss": 0.0, + "val_critic_loss": 0.0, + "val_decoder_biou": 0.3846593878308497, + "val_decoder_dice": 0.770921132483555, + "val_decoder_iou": 0.6801783568719756, + "val_dice": 0.7820860655931474, + "val_dice_gain": 0.011164933109592434, + "val_dice_loss": 0.0, + "val_entropy": 0.0, + "val_iou": 0.693723271109064, + "val_iou_gain": 0.013544914237088368, + "val_loss": -0.11469599216070492, + "val_refine_score": 0.5494988520700765, + "val_reward": 0.011469599216070492, + "validated_this_epoch": true + }, + { + "alpha": null, + "early_stopping_active": false, + "early_stopping_best_value": null, + "early_stopping_improved": false, + "early_stopping_min_delta": 0.0, + "early_stopping_monitor_mode": "max", + "early_stopping_monitor_name": "val_refine_score", + "early_stopping_monitor_value": 0.5529424633094959, + "early_stopping_patience": 30, + "early_stopping_start_epoch": 30, + "early_stopping_wait": 0, + "encoder_lr": 0.00019155799924181743, + "epoch": 13, + "epoch_seconds": 12.33644250407815, + "grad_norm": 1.170908047394319, + "lr": 0.00019155799924181743, + "selection_metric_name": "val_refine_score", + "selection_metric_value": 0.5529424633094959, + "strategy3_bootstrap_loaded": true, + "strategy3_decoder_state": "frozen", + "strategy3_encoder_state": "frozen", + "strategy3_freeze_active": true, + "strategy3_freeze_requested": true, + "strategy3_segmentation_head_state": "frozen", + "train_action_distribution": { + "max_abs_delta": 0.10009765625, + "mean_abs_delta": 0.02016523891043934, + "mean_delta": -0.01194404475179247, + "near_zero_pct": 5.962365902818915e-05, + "negative_pct": 91.1668914285573, + "positive_pct": 8.833050998774441 + }, + "train_actor_loss": -0.014743389936318801, + "train_advantage_mean": 0.0, + "train_advantage_std": 0.0, + "train_alpha": 0.0, + "train_annealed_aux_ce_weight": 0.0, + "train_biou_delta_mean": 0.014743390020984489, + "train_ce_loss": 0.0, + "train_critic_loss": 0.0, + "train_dice": 0.8868589668729884, + "train_dice_loss": 0.0, + "train_effective_steps": 8.0, + "train_entropy": 0.0, + "train_entropy_bonus_used": 0.0, + "train_entropy_loss": 0.0, + "train_iou": 0.8109574922850527, + "train_loss": -0.14743389866568826, + "train_mask_delta_mean": 0.020170731977982956, + "train_mean_reward": 0.014743389936318801, + "train_mean_value_pred": 0.0, + "train_reinforce_loss": 0.0, + "train_reward_zeros_pct": 0.4971591057255864, + "train_rl_loss_scale": 10.0, + "train_value_pred_error": 0.0, + "val_actor_loss": -0.011515664467879105, + "val_binary_flips_correct_pct": 0.28725044400084254, + "val_binary_flips_total_pct": 0.5699494305778952, + "val_binary_flips_wrong_pct": 0.2826989865770527, + "val_biou": 0.406093103689072, + "val_biou_gain": 0.02143371585822229, + "val_ce_loss": 0.0, + "val_critic_loss": 0.0, + "val_decoder_biou": 0.3846593878308497, + "val_decoder_dice": 0.770921132483555, + "val_decoder_iou": 0.6801783568719756, + "val_dice": 0.7874349981582038, + "val_dice_gain": 0.016513865674648853, + "val_dice_loss": 0.0, + "val_entropy": 0.0, + "val_iou": 0.6997918229299199, + "val_iou_gain": 0.01961346605794434, + "val_loss": -0.11515664467879105, + "val_refine_score": 0.5529424633094959, + "val_reward": 0.011515664467879105, + "validated_this_epoch": true + }, + { + "alpha": null, + "early_stopping_active": false, + "early_stopping_best_value": null, + "early_stopping_improved": false, + "early_stopping_min_delta": 0.0, + "early_stopping_monitor_mode": "max", + "early_stopping_monitor_name": "val_refine_score", + "early_stopping_monitor_value": 0.5508206364718675, + "early_stopping_patience": 30, + "early_stopping_start_epoch": 30, + "early_stopping_wait": 0, + "encoder_lr": 0.00019066917938074832, + "epoch": 14, + "epoch_seconds": 12.292165097314864, + "grad_norm": 0.851284837180918, + "lr": 0.00019066917938074832, + "selection_metric_name": "val_refine_score", + "selection_metric_value": 0.5508206364718675, + "strategy3_bootstrap_loaded": true, + "strategy3_decoder_state": "frozen", + "strategy3_encoder_state": "frozen", + "strategy3_freeze_active": true, + "strategy3_freeze_requested": true, + "strategy3_segmentation_head_state": "frozen", + "train_action_distribution": { + "max_abs_delta": 0.10009765625, + "mean_abs_delta": 0.022616291778500785, + "mean_delta": -0.014304801017384638, + "near_zero_pct": 3.650428110094336e-05, + "negative_pct": 91.28001698038794, + "positive_pct": 8.719948577609928 + }, + "train_actor_loss": -0.01562241553388462, + "train_advantage_mean": 0.0, + "train_advantage_std": 0.0, + "train_alpha": 0.0, + "train_annealed_aux_ce_weight": 0.0, + "train_biou_delta_mean": 0.01562241544921893, + "train_ce_loss": 0.0, + "train_critic_loss": 0.0, + "train_dice": 0.8874258683287489, + "train_dice_loss": 0.0, + "train_effective_steps": 8.0, + "train_entropy": 0.0, + "train_entropy_bonus_used": 0.0, + "train_entropy_loss": 0.0, + "train_iou": 0.8119938714388044, + "train_loss": -0.15622415190393274, + "train_mask_delta_mean": 0.022612138227982956, + "train_mean_reward": 0.01562241553388462, + "train_mean_value_pred": 0.0, + "train_reinforce_loss": 0.0, + "train_reward_zeros_pct": 0.3314394038170576, + "train_rl_loss_scale": 10.0, + "train_value_pred_error": 0.0, + "val_actor_loss": -0.011560950642888201, + "val_binary_flips_correct_pct": 0.2198163200827206, + "val_binary_flips_total_pct": 0.4044214884440104, + "val_binary_flips_wrong_pct": 0.18460516836128982, + "val_biou": 0.4063251176668069, + "val_biou_gain": 0.021665729835957215, + "val_ce_loss": 0.0, + "val_critic_loss": 0.0, + "val_decoder_biou": 0.3846593878308497, + "val_decoder_dice": 0.770921132483555, + "val_decoder_iou": 0.6801783568719756, + "val_dice": 0.7832819680975829, + "val_dice_gain": 0.012360835614027899, + "val_dice_loss": 0.0, + "val_entropy": 0.0, + "val_iou": 0.6953161552769282, + "val_iou_gain": 0.015137798404952663, + "val_loss": -0.11560950642888201, + "val_refine_score": 0.5508206364718675, + "val_reward": 0.011560950642888201, + "validated_this_epoch": true + }, + { + "alpha": null, + "early_stopping_active": false, + "early_stopping_best_value": null, + "early_stopping_improved": false, + "early_stopping_min_delta": 0.0, + "early_stopping_monitor_mode": "max", + "early_stopping_monitor_name": "val_refine_score", + "early_stopping_monitor_value": 0.5545643152471649, + "early_stopping_patience": 30, + "early_stopping_start_epoch": 30, + "early_stopping_wait": 0, + "encoder_lr": 0.00018971759723999335, + "epoch": 15, + "epoch_seconds": 12.370781539008021, + "grad_norm": 0.6274243972518228, + "lr": 0.00018971759723999335, + "selection_metric_name": "val_refine_score", + "selection_metric_value": 0.5545643152471649, + "strategy3_bootstrap_loaded": true, + "strategy3_decoder_state": "frozen", + "strategy3_encoder_state": "frozen", + "strategy3_freeze_active": true, + "strategy3_freeze_requested": true, + "strategy3_segmentation_head_state": "frozen", + "train_action_distribution": { + "max_abs_delta": 0.10009765625, + "mean_abs_delta": 0.020765618907965043, + "mean_delta": -0.011946029431948607, + "near_zero_pct": 3.475511750717818e-05, + "negative_pct": 91.26868667927656, + "positive_pct": 8.731280876831574 + }, + "train_actor_loss": -0.01589351370983588, + "train_advantage_mean": 0.0, + "train_advantage_std": 0.0, + "train_alpha": 0.0, + "train_annealed_aux_ce_weight": 0.0, + "train_biou_delta_mean": 0.01589351370983588, + "train_ce_loss": 0.0, + "train_critic_loss": 0.0, + "train_dice": 0.888495119979087, + "train_dice_loss": 0.0, + "train_effective_steps": 8.0, + "train_entropy": 0.0, + "train_entropy_bonus_used": 0.0, + "train_entropy_loss": 0.0, + "train_iou": 0.8148262158655937, + "train_loss": -0.1589351404796947, + "train_mask_delta_mean": 0.02076166326349432, + "train_mean_reward": 0.01589351370983588, + "train_mean_value_pred": 0.0, + "train_reinforce_loss": 0.0, + "train_reward_zeros_pct": 0.4024621332064271, + "train_rl_loss_scale": 10.0, + "train_value_pred_error": 0.0, + "val_actor_loss": -0.011847180262066104, + "val_binary_flips_correct_pct": 0.25901420443665746, + "val_binary_flips_total_pct": 0.47271952909581805, + "val_binary_flips_wrong_pct": 0.21370532465916053, + "val_biou": 0.4095707282824041, + "val_biou_gain": 0.02491134045155441, + "val_ce_loss": 0.0, + "val_critic_loss": 0.0, + "val_decoder_biou": 0.3846593878308497, + "val_decoder_dice": 0.770921132483555, + "val_decoder_iou": 0.6801783568719756, + "val_dice": 0.7870169272854357, + "val_dice_gain": 0.016095794801880725, + "val_dice_loss": 0.0, + "val_entropy": 0.0, + "val_iou": 0.6995579022119257, + "val_iou_gain": 0.01937954533995012, + "val_loss": -0.11847180262066104, + "val_refine_score": 0.5545643152471649, + "val_reward": 0.011847180262066104, + "validated_this_epoch": true + }, + { + "alpha": null, + "early_stopping_active": false, + "early_stopping_best_value": null, + "early_stopping_improved": false, + "early_stopping_min_delta": 0.0, + "early_stopping_monitor_mode": "max", + "early_stopping_monitor_name": "val_refine_score", + "early_stopping_monitor_value": 0.5536366872428466, + "early_stopping_patience": 30, + "early_stopping_start_epoch": 30, + "early_stopping_wait": 0, + "encoder_lr": 0.00018870390498641916, + "epoch": 16, + "epoch_seconds": 12.3054045480676, + "grad_norm": 0.7084004039114172, + "lr": 0.00018870390498641916, + "selection_metric_name": "val_refine_score", + "selection_metric_value": 0.5536366872428466, + "strategy3_bootstrap_loaded": true, + "strategy3_decoder_state": "frozen", + "strategy3_encoder_state": "frozen", + "strategy3_freeze_active": true, + "strategy3_freeze_requested": true, + "strategy3_segmentation_head_state": "frozen", + "train_action_distribution": { + "max_abs_delta": 0.10009765625, + "mean_abs_delta": 0.02365192792124369, + "mean_delta": -0.015402937561950901, + "near_zero_pct": 0.00014746208475716313, + "negative_pct": 91.30407714030959, + "positive_pct": 8.695777746933429 + }, + "train_actor_loss": -0.015597302516136386, + "train_advantage_mean": 0.0, + "train_advantage_std": 0.0, + "train_alpha": 0.0, + "train_annealed_aux_ce_weight": 0.0, + "train_biou_delta_mean": 0.015597302770133452, + "train_ce_loss": 0.0, + "train_critic_loss": 0.0, + "train_dice": 0.8877105635406226, + "train_dice_loss": 0.0, + "train_effective_steps": 8.0, + "train_entropy": 0.0, + "train_entropy_bonus_used": 0.0, + "train_entropy_loss": 0.0, + "train_iou": 0.8130332222645836, + "train_loss": -0.1559730280529369, + "train_mask_delta_mean": 0.023644187233664772, + "train_mean_reward": 0.015597302516136386, + "train_mean_value_pred": 0.0, + "train_reinforce_loss": 0.0, + "train_reward_zeros_pct": 0.5108652424744584, + "train_rl_loss_scale": 10.0, + "train_value_pred_error": 0.0, + "val_actor_loss": -0.011522948732817895, + "val_binary_flips_correct_pct": 0.2761915618298101, + "val_binary_flips_total_pct": 0.5483851713292739, + "val_binary_flips_wrong_pct": 0.2721936094994638, + "val_biou": 0.4073065016831763, + "val_biou_gain": 0.022647113852326595, + "val_ce_loss": 0.0, + "val_critic_loss": 0.0, + "val_decoder_biou": 0.3846593878308497, + "val_decoder_dice": 0.770921132483555, + "val_decoder_iou": 0.6801783568719756, + "val_dice": 0.7872061165231036, + "val_dice_gain": 0.01628498403954859, + "val_dice_loss": 0.0, + "val_entropy": 0.0, + "val_iou": 0.699966872802517, + "val_iou_gain": 0.019788515930541428, + "val_loss": -0.11522948732817895, + "val_refine_score": 0.5536366872428466, + "val_reward": 0.011522948732817895, + "validated_this_epoch": true + }, + { + "alpha": null, + "early_stopping_active": false, + "early_stopping_best_value": null, + "early_stopping_improved": false, + "early_stopping_min_delta": 0.0, + "early_stopping_monitor_mode": "max", + "early_stopping_monitor_name": "val_refine_score", + "early_stopping_monitor_value": 0.5579392602651567, + "early_stopping_patience": 30, + "early_stopping_start_epoch": 30, + "early_stopping_wait": 0, + "encoder_lr": 0.00018762879735406137, + "epoch": 17, + "epoch_seconds": 12.359288967680186, + "grad_norm": 0.6993737843903628, + "lr": 0.00018762879735406137, + "selection_metric_name": "val_refine_score", + "selection_metric_value": 0.5579392602651567, + "strategy3_bootstrap_loaded": true, + "strategy3_decoder_state": "frozen", + "strategy3_encoder_state": "frozen", + "strategy3_freeze_active": true, + "strategy3_freeze_requested": true, + "strategy3_segmentation_head_state": "frozen", + "train_action_distribution": { + "max_abs_delta": 0.10009765625, + "mean_abs_delta": 0.02387011557055468, + "mean_delta": -0.01605516255155883, + "near_zero_pct": 6.798922333411446e-05, + "negative_pct": 91.41343581405553, + "positive_pct": 8.586498366838152 + }, + "train_actor_loss": -0.015697362836156324, + "train_advantage_mean": 0.0, + "train_advantage_std": 0.0, + "train_alpha": 0.0, + "train_annealed_aux_ce_weight": 0.0, + "train_biou_delta_mean": 0.0156973630054877, + "train_ce_loss": 0.0, + "train_critic_loss": 0.0, + "train_dice": 0.8820910275021747, + "train_dice_loss": 0.0, + "train_effective_steps": 8.0, + "train_entropy": 0.0, + "train_entropy_bonus_used": 0.0, + "train_entropy_loss": 0.0, + "train_iou": 0.8065769970715218, + "train_loss": -0.15697363086722113, + "train_mask_delta_mean": 0.023868907581676136, + "train_mean_reward": 0.015697362836156324, + "train_mean_value_pred": 0.0, + "train_reinforce_loss": 0.0, + "train_reward_zeros_pct": 0.37878789007663727, + "train_rl_loss_scale": 10.0, + "train_value_pred_error": 0.0, + "val_actor_loss": -0.012083478419299354, + "val_binary_flips_correct_pct": 0.26787402583103553, + "val_binary_flips_total_pct": 0.51422493130553, + "val_binary_flips_wrong_pct": 0.2463509054744945, + "val_biou": 0.41375400071786683, + "val_biou_gain": 0.029094612887017146, + "val_ce_loss": 0.0, + "val_critic_loss": 0.0, + "val_decoder_biou": 0.3846593878308497, + "val_decoder_dice": 0.770921132483555, + "val_decoder_iou": 0.6801783568719756, + "val_dice": 0.7884220023511282, + "val_dice_gain": 0.017500869867573265, + "val_dice_loss": 0.0, + "val_entropy": 0.0, + "val_iou": 0.7021245198124465, + "val_iou_gain": 0.021946162940470915, + "val_loss": -0.12083478419299354, + "val_refine_score": 0.5579392602651567, + "val_reward": 0.012083478419299354, + "validated_this_epoch": true + }, + { + "alpha": null, + "early_stopping_active": false, + "early_stopping_best_value": null, + "early_stopping_improved": false, + "early_stopping_min_delta": 0.0, + "early_stopping_monitor_mode": "max", + "early_stopping_monitor_name": "val_refine_score", + "early_stopping_monitor_value": 0.5550300297387011, + "early_stopping_patience": 30, + "early_stopping_start_epoch": 30, + "early_stopping_wait": 0, + "encoder_lr": 0.00018649301116798828, + "epoch": 18, + "epoch_seconds": 12.308698125183582, + "grad_norm": 0.5267056362195448, + "lr": 0.00018649301116798828, + "selection_metric_name": "val_refine_score", + "selection_metric_value": 0.5550300297387011, + "strategy3_bootstrap_loaded": true, + "strategy3_decoder_state": "frozen", + "strategy3_encoder_state": "frozen", + "strategy3_freeze_active": true, + "strategy3_freeze_requested": true, + "strategy3_segmentation_head_state": "frozen", + "train_action_distribution": { + "max_abs_delta": 0.10009765625, + "mean_abs_delta": 0.02711943786760623, + "mean_delta": -0.01794850630474023, + "near_zero_pct": 2.8214767217543173e-05, + "negative_pct": 91.1623477935791, + "positive_pct": 8.83762590079145 + }, + "train_actor_loss": -0.016602951265337073, + "train_advantage_mean": 0.0, + "train_advantage_std": 0.0, + "train_alpha": 0.0, + "train_annealed_aux_ce_weight": 0.0, + "train_biou_delta_mean": 0.016602951096005694, + "train_ce_loss": 0.0, + "train_critic_loss": 0.0, + "train_dice": 0.890637951608925, + "train_dice_loss": 0.0, + "train_effective_steps": 8.0, + "train_entropy": 0.0, + "train_entropy_bonus_used": 0.0, + "train_entropy_loss": 0.0, + "train_iou": 0.8172241467019041, + "train_loss": -0.1660295155915347, + "train_mask_delta_mean": 0.0271148681640625, + "train_mean_reward": 0.016602951265337073, + "train_mean_value_pred": 0.0, + "train_reinforce_loss": 0.0, + "train_reward_zeros_pct": 0.3314394038170576, + "train_rl_loss_scale": 10.0, + "train_value_pred_error": 0.0, + "val_actor_loss": -0.012373147019388853, + "val_binary_flips_correct_pct": 0.2449447033452053, + "val_binary_flips_total_pct": 0.4477332620059743, + "val_binary_flips_wrong_pct": 0.202788558660769, + "val_biou": 0.4122092277196728, + "val_biou_gain": 0.02754983988882309, + "val_ce_loss": 0.0, + "val_critic_loss": 0.0, + "val_decoder_biou": 0.3846593878308497, + "val_decoder_dice": 0.770921132483555, + "val_decoder_iou": 0.6801783568719756, + "val_dice": 0.7847442361475325, + "val_dice_gain": 0.013823103663977543, + "val_dice_loss": 0.0, + "val_entropy": 0.0, + "val_iou": 0.6978508317577293, + "val_iou_gain": 0.01767247488575374, + "val_loss": -0.12373147019388853, + "val_refine_score": 0.5550300297387011, + "val_reward": 0.012373147019388853, + "validated_this_epoch": true + }, + { + "alpha": null, + "early_stopping_active": false, + "early_stopping_best_value": null, + "early_stopping_improved": false, + "early_stopping_min_delta": 0.0, + "early_stopping_monitor_mode": "max", + "early_stopping_monitor_name": "val_refine_score", + "early_stopping_monitor_value": 0.5513777235695809, + "early_stopping_patience": 30, + "early_stopping_start_epoch": 30, + "early_stopping_wait": 0, + "encoder_lr": 0.00018529732483931808, + "epoch": 19, + "epoch_seconds": 12.329483265988529, + "grad_norm": 0.5087953264063055, + "lr": 0.00018529732483931808, + "selection_metric_name": "val_refine_score", + "selection_metric_value": 0.5513777235695809, + "strategy3_bootstrap_loaded": true, + "strategy3_decoder_state": "frozen", + "strategy3_encoder_state": "frozen", + "strategy3_freeze_active": true, + "strategy3_freeze_requested": true, + "strategy3_segmentation_head_state": "frozen", + "train_action_distribution": { + "max_abs_delta": 0.10009765625, + "mean_abs_delta": 0.025293496204540133, + "mean_delta": -0.016872607795944947, + "near_zero_pct": 2.7834514329780095e-05, + "negative_pct": 91.18311669338833, + "positive_pct": 8.81685777567327 + }, + "train_actor_loss": -0.016643966989332428, + "train_advantage_mean": 0.0, + "train_advantage_std": 0.0, + "train_alpha": 0.0, + "train_annealed_aux_ce_weight": 0.0, + "train_biou_delta_mean": 0.016643967243329495, + "train_ce_loss": 0.0, + "train_critic_loss": 0.0, + "train_dice": 0.8904931060094479, + "train_dice_loss": 0.0, + "train_effective_steps": 8.0, + "train_entropy": 0.0, + "train_entropy_bonus_used": 0.0, + "train_entropy_loss": 0.0, + "train_iou": 0.8177625820977655, + "train_loss": -0.16643966734409332, + "train_mask_delta_mean": 0.025296297940340908, + "train_mean_reward": 0.016643966989332428, + "train_mean_value_pred": 0.0, + "train_reinforce_loss": 0.0, + "train_reward_zeros_pct": 0.4734848625957966, + "train_rl_loss_scale": 10.0, + "train_value_pred_error": 0.0, + "val_actor_loss": -0.011366302299393283, + "val_binary_flips_correct_pct": 0.24585723876953125, + "val_binary_flips_total_pct": 0.4555085126091452, + "val_binary_flips_wrong_pct": 0.20965127383961396, + "val_biou": 0.40571507936834184, + "val_biou_gain": 0.02105569153749215, + "val_ce_loss": 0.0, + "val_critic_loss": 0.0, + "val_decoder_biou": 0.3846593878308497, + "val_decoder_dice": 0.770921132483555, + "val_decoder_iou": 0.6801783568719756, + "val_dice": 0.7842059700674109, + "val_dice_gain": 0.013284837583855902, + "val_dice_loss": 0.0, + "val_entropy": 0.0, + "val_iou": 0.6970403677708201, + "val_iou_gain": 0.016862010898844537, + "val_loss": -0.11366302299393283, + "val_refine_score": 0.5513777235695809, + "val_reward": 0.011366302299393283, + "validated_this_epoch": true + }, + { + "alpha": null, + "early_stopping_active": false, + "early_stopping_best_value": null, + "early_stopping_improved": false, + "early_stopping_min_delta": 0.0, + "early_stopping_monitor_mode": "max", + "early_stopping_monitor_name": "val_refine_score", + "early_stopping_monitor_value": 0.5559524738435466, + "early_stopping_patience": 30, + "early_stopping_start_epoch": 30, + "early_stopping_wait": 0, + "encoder_lr": 0.0001840425578317346, + "epoch": 20, + "epoch_seconds": 12.328440360724926, + "grad_norm": 0.8412519666281614, + "lr": 0.0001840425578317346, + "selection_metric_name": "val_refine_score", + "selection_metric_value": 0.5559524738435466, + "strategy3_bootstrap_loaded": true, + "strategy3_decoder_state": "frozen", + "strategy3_encoder_state": "frozen", + "strategy3_freeze_active": true, + "strategy3_freeze_requested": true, + "strategy3_segmentation_head_state": "frozen", + "train_action_distribution": { + "max_abs_delta": 0.10009765625, + "mean_abs_delta": 0.02664831308224662, + "mean_delta": -0.01703380848365751, + "near_zero_pct": 3.148494223317109e-05, + "negative_pct": 91.17910103364424, + "positive_pct": 8.820870069956237 + }, + "train_actor_loss": -0.01626497925099102, + "train_advantage_mean": 0.0, + "train_advantage_std": 0.0, + "train_alpha": 0.0, + "train_annealed_aux_ce_weight": 0.0, + "train_biou_delta_mean": 0.01626497916632533, + "train_ce_loss": 0.0, + "train_critic_loss": 0.0, + "train_dice": 0.8866836063258448, + "train_dice_loss": 0.0, + "train_effective_steps": 8.0, + "train_entropy": 0.0, + "train_entropy_bonus_used": 0.0, + "train_entropy_loss": 0.0, + "train_iou": 0.8144645930929776, + "train_loss": -0.16264979541301727, + "train_mask_delta_mean": 0.026648781516335228, + "train_mean_reward": 0.01626497925099102, + "train_mean_value_pred": 0.0, + "train_reinforce_loss": 0.0, + "train_reward_zeros_pct": 0.9432316821237857, + "train_rl_loss_scale": 10.0, + "train_value_pred_error": 0.0, + "val_actor_loss": -0.012024002700854908, + "val_binary_flips_correct_pct": 0.2558352900486366, + "val_binary_flips_total_pct": 0.4491693833295037, + "val_binary_flips_wrong_pct": 0.19333409328086704, + "val_biou": 0.4101569412911453, + "val_biou_gain": 0.02549755346029564, + "val_ce_loss": 0.0, + "val_critic_loss": 0.0, + "val_decoder_biou": 0.3846593878308497, + "val_decoder_dice": 0.770921132483555, + "val_decoder_iou": 0.6801783568719756, + "val_dice": 0.7876476151931268, + "val_dice_gain": 0.016726482709571777, + "val_dice_loss": 0.0, + "val_entropy": 0.0, + "val_iou": 0.701748006395948, + "val_iou_gain": 0.021569649523972445, + "val_loss": -0.12024002700854908, + "val_refine_score": 0.5559524738435466, + "val_reward": 0.012024002700854908, + "validated_this_epoch": true + }, + { + "alpha": null, + "early_stopping_active": false, + "early_stopping_best_value": null, + "early_stopping_improved": false, + "early_stopping_min_delta": 0.0, + "early_stopping_monitor_mode": "max", + "early_stopping_monitor_name": "val_refine_score", + "early_stopping_monitor_value": 0.5575151050120524, + "early_stopping_patience": 30, + "early_stopping_start_epoch": 30, + "early_stopping_wait": 0, + "encoder_lr": 0.00018272957009986775, + "epoch": 21, + "epoch_seconds": 12.345122661907226, + "grad_norm": 0.643930359320207, + "lr": 0.00018272957009986775, + "selection_metric_name": "val_refine_score", + "selection_metric_value": 0.5575151050120524, + "strategy3_bootstrap_loaded": true, + "strategy3_decoder_state": "frozen", + "strategy3_encoder_state": "frozen", + "strategy3_freeze_active": true, + "strategy3_freeze_requested": true, + "strategy3_segmentation_head_state": "frozen", + "train_action_distribution": { + "max_abs_delta": 0.10009765625, + "mean_abs_delta": 0.02919162924147465, + "mean_delta": -0.01959021808579564, + "near_zero_pct": 4.882447590468721e-05, + "negative_pct": 91.26455316489393, + "positive_pct": 8.735400218177926 + }, + "train_actor_loss": -0.016261186208794243, + "train_advantage_mean": 0.0, + "train_advantage_std": 0.0, + "train_alpha": 0.0, + "train_annealed_aux_ce_weight": 0.0, + "train_biou_delta_mean": 0.01626118629345993, + "train_ce_loss": 0.0, + "train_critic_loss": 0.0, + "train_dice": 0.8866604318440366, + "train_dice_loss": 0.0, + "train_effective_steps": 8.0, + "train_entropy": 0.0, + "train_entropy_bonus_used": 0.0, + "train_entropy_loss": 0.0, + "train_iou": 0.8133301364100524, + "train_loss": -0.16261186789382587, + "train_mask_delta_mean": 0.029194224964488636, + "train_mean_reward": 0.016261186208794243, + "train_mean_value_pred": 0.0, + "train_reinforce_loss": 0.0, + "train_reward_zeros_pct": 0.4261363763362169, + "train_rl_loss_scale": 10.0, + "train_value_pred_error": 0.0, + "val_actor_loss": -0.012208286438180949, + "val_binary_flips_correct_pct": 0.2616134344362745, + "val_binary_flips_total_pct": 0.4975711598115809, + "val_binary_flips_wrong_pct": 0.2359577253753064, + "val_biou": 0.41326535356191435, + "val_biou_gain": 0.028605965731064664, + "val_ce_loss": 0.0, + "val_critic_loss": 0.0, + "val_decoder_biou": 0.3846593878308497, + "val_decoder_dice": 0.770921132483555, + "val_decoder_iou": 0.6801783568719756, + "val_dice": 0.7879184748231317, + "val_dice_gain": 0.016997342339576726, + "val_dice_loss": 0.0, + "val_entropy": 0.0, + "val_iou": 0.7017648564621904, + "val_iou_gain": 0.021586499590214858, + "val_loss": -0.12208286438180949, + "val_refine_score": 0.5575151050120524, + "val_reward": 0.012208286438180949, + "validated_this_epoch": true + }, + { + "alpha": null, + "early_stopping_active": false, + "early_stopping_best_value": null, + "early_stopping_improved": false, + "early_stopping_min_delta": 0.0, + "early_stopping_monitor_mode": "max", + "early_stopping_monitor_name": "val_refine_score", + "early_stopping_monitor_value": 0.5516515274083438, + "early_stopping_patience": 30, + "early_stopping_start_epoch": 30, + "early_stopping_wait": 0, + "encoder_lr": 0.00018135926149992384, + "epoch": 22, + "epoch_seconds": 12.337120085023344, + "grad_norm": 0.5316034609621222, + "lr": 0.00018135926149992384, + "selection_metric_name": "val_refine_score", + "selection_metric_value": 0.5516515274083438, + "strategy3_bootstrap_loaded": true, + "strategy3_decoder_state": "frozen", + "strategy3_encoder_state": "frozen", + "strategy3_freeze_active": true, + "strategy3_freeze_requested": true, + "strategy3_segmentation_head_state": "frozen", + "train_action_distribution": { + "max_abs_delta": 0.10009765625, + "mean_abs_delta": 0.027792800493030387, + "mean_delta": -0.01944224104623903, + "near_zero_pct": 3.2169397715361726e-05, + "negative_pct": 91.29551980983128, + "positive_pct": 8.704449989917604 + }, + "train_actor_loss": -0.01671816797087641, + "train_advantage_mean": 0.0, + "train_advantage_std": 0.0, + "train_alpha": 0.0, + "train_annealed_aux_ce_weight": 0.0, + "train_biou_delta_mean": 0.01671816814020779, + "train_ce_loss": 0.0, + "train_critic_loss": 0.0, + "train_dice": 0.8894503050021304, + "train_dice_loss": 0.0, + "train_effective_steps": 8.0, + "train_entropy": 0.0, + "train_entropy_bonus_used": 0.0, + "train_entropy_loss": 0.0, + "train_iou": 0.816261322119748, + "train_loss": -0.1671816815029491, + "train_mask_delta_mean": 0.027793190696022728, + "train_mean_reward": 0.01671816797087641, + "train_mean_value_pred": 0.0, + "train_reinforce_loss": 0.0, + "train_reward_zeros_pct": 0.3077651606872678, + "train_rl_loss_scale": 10.0, + "train_value_pred_error": 0.0, + "val_actor_loss": -0.010859579437692446, + "val_binary_flips_correct_pct": 0.3553166108972886, + "val_binary_flips_total_pct": 0.7024839812634038, + "val_binary_flips_wrong_pct": 0.3471673703661152, + "val_biou": 0.4037762201705215, + "val_biou_gain": 0.01911683233967182, + "val_ce_loss": 0.0, + "val_critic_loss": 0.0, + "val_decoder_biou": 0.3846593878308497, + "val_decoder_dice": 0.770921132483555, + "val_decoder_iou": 0.6801783568719756, + "val_dice": 0.787899081681853, + "val_dice_gain": 0.01697794919829798, + "val_dice_loss": 0.0, + "val_entropy": 0.0, + "val_iou": 0.6995268346461662, + "val_iou_gain": 0.019348477774190576, + "val_loss": -0.10859579437692446, + "val_refine_score": 0.5516515274083438, + "val_reward": 0.010859579437692446, + "validated_this_epoch": true + }, + { + "alpha": null, + "early_stopping_active": false, + "early_stopping_best_value": null, + "early_stopping_improved": false, + "early_stopping_min_delta": 0.0, + "early_stopping_monitor_mode": "max", + "early_stopping_monitor_name": "val_refine_score", + "early_stopping_monitor_value": 0.5582463983633773, + "early_stopping_patience": 30, + "early_stopping_start_epoch": 30, + "early_stopping_wait": 0, + "encoder_lr": 0.00017993257117296878, + "epoch": 23, + "epoch_seconds": 12.278826920315623, + "grad_norm": 0.6338966841047461, + "lr": 0.00017993257117296878, + "selection_metric_name": "val_refine_score", + "selection_metric_value": 0.5582463983633773, + "strategy3_bootstrap_loaded": true, + "strategy3_decoder_state": "frozen", + "strategy3_encoder_state": "frozen", + "strategy3_freeze_active": true, + "strategy3_freeze_requested": true, + "strategy3_segmentation_head_state": "frozen", + "train_action_distribution": { + "max_abs_delta": 0.10009765625, + "mean_abs_delta": 0.02662752812135626, + "mean_delta": -0.017362372611056675, + "near_zero_pct": 5.787449530523438e-05, + "negative_pct": 91.13324027169834, + "positive_pct": 8.866704187609933 + }, + "train_actor_loss": -0.01689355020640836, + "train_advantage_mean": 0.0, + "train_advantage_std": 0.0, + "train_alpha": 0.0, + "train_annealed_aux_ce_weight": 0.0, + "train_biou_delta_mean": 0.01689355020640836, + "train_ce_loss": 0.0, + "train_critic_loss": 0.0, + "train_dice": 0.893128081950343, + "train_dice_loss": 0.0, + "train_effective_steps": 8.0, + "train_entropy": 0.0, + "train_entropy_bonus_used": 0.0, + "train_entropy_loss": 0.0, + "train_iou": 0.8212533959908768, + "train_loss": -0.16893549669872632, + "train_mask_delta_mean": 0.026622425426136364, + "train_mean_reward": 0.01689355020640836, + "train_mean_value_pred": 0.0, + "train_reinforce_loss": 0.0, + "train_reward_zeros_pct": 0.35137560387903993, + "train_rl_loss_scale": 10.0, + "train_value_pred_error": 0.0, + "val_actor_loss": -0.012657880361075513, + "val_binary_flips_correct_pct": 0.2774369482900582, + "val_binary_flips_total_pct": 0.49616869758157167, + "val_binary_flips_wrong_pct": 0.21873174929151348, + "val_biou": 0.41763771299563296, + "val_biou_gain": 0.03297832516478327, + "val_ce_loss": 0.0, + "val_critic_loss": 0.0, + "val_decoder_biou": 0.3846593878308497, + "val_decoder_dice": 0.770921132483555, + "val_decoder_iou": 0.6801783568719756, + "val_dice": 0.7845883032251618, + "val_dice_gain": 0.013667170741606838, + "val_dice_loss": 0.0, + "val_entropy": 0.0, + "val_iou": 0.6988550837311216, + "val_iou_gain": 0.01867672685914601, + "val_loss": -0.12657880361075513, + "val_refine_score": 0.5582463983633773, + "val_reward": 0.012657880361075513, + "validated_this_epoch": true + }, + { + "alpha": null, + "early_stopping_active": false, + "early_stopping_best_value": null, + "early_stopping_improved": false, + "early_stopping_min_delta": 0.0, + "early_stopping_monitor_mode": "max", + "early_stopping_monitor_name": "val_refine_score", + "early_stopping_monitor_value": 0.5617521103440947, + "early_stopping_patience": 30, + "early_stopping_start_epoch": 30, + "early_stopping_wait": 0, + "encoder_lr": 0.0001784504769012879, + "epoch": 24, + "epoch_seconds": 12.368655554950237, + "grad_norm": 0.5897722704844042, + "lr": 0.0001784504769012879, + "selection_metric_name": "val_refine_score", + "selection_metric_value": 0.5617521103440947, + "strategy3_bootstrap_loaded": true, + "strategy3_decoder_state": "frozen", + "strategy3_encoder_state": "frozen", + "strategy3_freeze_active": true, + "strategy3_freeze_requested": true, + "strategy3_segmentation_head_state": "frozen", + "train_action_distribution": { + "max_abs_delta": 0.10009765625, + "mean_abs_delta": 0.02756744464436038, + "mean_delta": -0.018608036927286197, + "near_zero_pct": 3.034418356988185e-05, + "negative_pct": 91.25518114729361, + "positive_pct": 8.744790557433259 + }, + "train_actor_loss": -0.017512686346890405, + "train_advantage_mean": 0.0, + "train_advantage_std": 0.0, + "train_alpha": 0.0, + "train_annealed_aux_ce_weight": 0.0, + "train_biou_delta_mean": 0.017512686346890405, + "train_ce_loss": 0.0, + "train_critic_loss": 0.0, + "train_dice": 0.8897611207973872, + "train_dice_loss": 0.0, + "train_effective_steps": 8.0, + "train_entropy": 0.0, + "train_entropy_bonus_used": 0.0, + "train_entropy_loss": 0.0, + "train_iou": 0.8179213288518494, + "train_loss": -0.17512686008756811, + "train_mask_delta_mean": 0.02756708318536932, + "train_mean_reward": 0.017512686346890405, + "train_mean_value_pred": 0.0, + "train_reinforce_loss": 0.0, + "train_reward_zeros_pct": 0.6392045645043254, + "train_rl_loss_scale": 10.0, + "train_value_pred_error": 0.0, + "val_actor_loss": -0.012582255963934585, + "val_binary_flips_correct_pct": 0.3118739408605239, + "val_binary_flips_total_pct": 0.573880064721201, + "val_binary_flips_wrong_pct": 0.26200612386067706, + "val_biou": 0.41815584732029426, + "val_biou_gain": 0.033496459489444574, + "val_ce_loss": 0.0, + "val_critic_loss": 0.0, + "val_decoder_biou": 0.3846593878308497, + "val_decoder_dice": 0.770921132483555, + "val_decoder_iou": 0.6801783568719756, + "val_dice": 0.7904894257774717, + "val_dice_gain": 0.01956829329391674, + "val_dice_loss": 0.0, + "val_entropy": 0.0, + "val_iou": 0.705348373367895, + "val_iou_gain": 0.025170016495919434, + "val_loss": -0.12582255963934585, + "val_refine_score": 0.5617521103440947, + "val_reward": 0.012582255963934585, + "validated_this_epoch": true + }, + { + "alpha": null, + "early_stopping_active": false, + "early_stopping_best_value": null, + "early_stopping_improved": false, + "early_stopping_min_delta": 0.0, + "early_stopping_monitor_mode": "max", + "early_stopping_monitor_name": "val_refine_score", + "early_stopping_monitor_value": 0.5604163982509622, + "early_stopping_patience": 30, + "early_stopping_start_epoch": 30, + "early_stopping_wait": 0, + "encoder_lr": 0.00017691399443826278, + "epoch": 25, + "epoch_seconds": 12.305280993226916, + "grad_norm": 0.6135065203363245, + "lr": 0.00017691399443826278, + "selection_metric_name": "val_refine_score", + "selection_metric_value": 0.5604163982509622, + "strategy3_bootstrap_loaded": true, + "strategy3_decoder_state": "frozen", + "strategy3_encoder_state": "frozen", + "strategy3_freeze_active": true, + "strategy3_freeze_requested": true, + "strategy3_segmentation_head_state": "frozen", + "train_action_distribution": { + "max_abs_delta": 0.10009765625, + "mean_abs_delta": 0.027621761916882613, + "mean_delta": -0.018467690721577543, + "near_zero_pct": 6.114467045005189e-05, + "negative_pct": 91.16522453048013, + "positive_pct": 8.834716178138148 + }, + "train_actor_loss": -0.017331301683952915, + "train_advantage_mean": 0.0, + "train_advantage_std": 0.0, + "train_alpha": 0.0, + "train_annealed_aux_ce_weight": 0.4, + "train_biou_delta_mean": 0.017331301853284294, + "train_ce_loss": 0.18074895576997238, + "train_critic_loss": 0.0, + "train_dice": 0.8927842973450998, + "train_dice_loss": 0.08229398727416992, + "train_effective_steps": 8.0, + "train_entropy": 0.0, + "train_entropy_bonus_used": 0.0, + "train_entropy_loss": 0.0, + "train_iou": 0.8216606661990213, + "train_loss": -0.1207044239748608, + "train_mask_delta_mean": 0.027626731178977272, + "train_mean_reward": 0.017331301683952915, + "train_mean_value_pred": 0.0, + "train_reinforce_loss": 0.0, + "train_reward_zeros_pct": 0.5681818351149559, + "train_rl_loss_scale": 10.0, + "train_value_pred_error": 0.0, + "val_actor_loss": -0.013300206373969559, + "val_binary_flips_correct_pct": 0.2710192811255362, + "val_binary_flips_total_pct": 0.4719902487362132, + "val_binary_flips_wrong_pct": 0.20097096761067706, + "val_biou": 0.4212242367449828, + "val_biou_gain": 0.03656484891413314, + "val_ce_loss": 0.0, + "val_critic_loss": 0.0, + "val_decoder_biou": 0.3846593878308497, + "val_decoder_dice": 0.770921132483555, + "val_decoder_iou": 0.6801783568719756, + "val_dice": 0.7839220244374848, + "val_dice_gain": 0.013000891953929838, + "val_dice_loss": 0.0, + "val_entropy": 0.0, + "val_iou": 0.6996085597569416, + "val_iou_gain": 0.019430202884965997, + "val_loss": -0.1330020637396956, + "val_refine_score": 0.5604163982509622, + "val_reward": 0.013300206373969559, + "validated_this_epoch": true + }, + { + "alpha": null, + "early_stopping_active": false, + "early_stopping_best_value": null, + "early_stopping_improved": false, + "early_stopping_min_delta": 0.0, + "early_stopping_monitor_mode": "max", + "early_stopping_monitor_name": "val_refine_score", + "early_stopping_monitor_value": 0.5585183751692734, + "early_stopping_patience": 30, + "early_stopping_start_epoch": 30, + "early_stopping_wait": 0, + "encoder_lr": 0.00017532417681222453, + "epoch": 26, + "epoch_seconds": 12.30804765271023, + "grad_norm": 0.7906017357652838, + "lr": 0.00017532417681222453, + "selection_metric_name": "val_refine_score", + "selection_metric_value": 0.5585183751692734, + "strategy3_bootstrap_loaded": true, + "strategy3_decoder_state": "frozen", + "strategy3_encoder_state": "frozen", + "strategy3_freeze_active": true, + "strategy3_freeze_requested": true, + "strategy3_segmentation_head_state": "frozen", + "train_action_distribution": { + "max_abs_delta": 0.10009765625, + "mean_abs_delta": 0.029413148125802927, + "mean_delta": -0.020408699437129228, + "near_zero_pct": 2.9279475458307306e-05, + "negative_pct": 91.35313650423831, + "positive_pct": 8.646836351941932 + }, + "train_actor_loss": -0.017361475039003628, + "train_advantage_mean": 0.0, + "train_advantage_std": 0.0, + "train_alpha": 0.0, + "train_annealed_aux_ce_weight": 0.3733333333333334, + "train_biou_delta_mean": 0.017361474869672253, + "train_ce_loss": 0.18064756285060535, + "train_critic_loss": 0.0, + "train_dice": 0.8919356515687626, + "train_dice_loss": 0.0822730768810619, + "train_effective_steps": 8.0, + "train_entropy": 0.0, + "train_entropy_bonus_used": 0.0, + "train_entropy_loss": 0.0, + "train_iou": 0.8201736992799398, + "train_loss": -0.1245362318374894, + "train_mask_delta_mean": 0.02941339666193182, + "train_mean_reward": 0.017361475039003628, + "train_mean_value_pred": 0.0, + "train_reinforce_loss": 0.0, + "train_reward_zeros_pct": 0.7102272938936949, + "train_rl_loss_scale": 10.0, + "train_value_pred_error": 0.0, + "val_actor_loss": -0.012936506871483289, + "val_binary_flips_correct_pct": 0.25764166140088846, + "val_binary_flips_total_pct": 0.44963313084022677, + "val_binary_flips_wrong_pct": 0.19199146943933823, + "val_biou": 0.41849631235014917, + "val_biou_gain": 0.03383692451929948, + "val_ce_loss": 0.0, + "val_critic_loss": 0.0, + "val_decoder_biou": 0.3846593878308497, + "val_decoder_dice": 0.770921132483555, + "val_decoder_iou": 0.6801783568719756, + "val_dice": 0.784180256001112, + "val_dice_gain": 0.013259123517556981, + "val_dice_loss": 0.0, + "val_entropy": 0.0, + "val_iou": 0.6985404379883976, + "val_iou_gain": 0.018362081116422013, + "val_loss": -0.1293650687148329, + "val_refine_score": 0.5585183751692734, + "val_reward": 0.012936506871483289, + "validated_this_epoch": true + }, + { + "alpha": null, + "early_stopping_active": false, + "early_stopping_best_value": null, + "early_stopping_improved": false, + "early_stopping_min_delta": 0.0, + "early_stopping_monitor_mode": "max", + "early_stopping_monitor_name": "val_refine_score", + "early_stopping_monitor_value": 0.5595430504725173, + "early_stopping_patience": 30, + "early_stopping_start_epoch": 30, + "early_stopping_wait": 0, + "encoder_lr": 0.0001736821136047609, + "epoch": 27, + "epoch_seconds": 12.27113792905584, + "grad_norm": 0.6011777791109952, + "lr": 0.0001736821136047609, + "selection_metric_name": "val_refine_score", + "selection_metric_value": 0.5595430504725173, + "strategy3_bootstrap_loaded": true, + "strategy3_decoder_state": "frozen", + "strategy3_encoder_state": "frozen", + "strategy3_freeze_active": true, + "strategy3_freeze_requested": true, + "strategy3_segmentation_head_state": "frozen", + "train_action_distribution": { + "max_abs_delta": 0.10009765625, + "mean_abs_delta": 0.030683092032135886, + "mean_delta": -0.021535624316046862, + "near_zero_pct": 7.27043592198904e-05, + "negative_pct": 91.18819649923931, + "positive_pct": 8.811732809143988 + }, + "train_actor_loss": -0.017267421710378338, + "train_advantage_mean": 0.0, + "train_advantage_std": 0.0, + "train_alpha": 0.0, + "train_annealed_aux_ce_weight": 0.3466666666666667, + "train_biou_delta_mean": 0.017267421879709713, + "train_ce_loss": 0.17607063461433758, + "train_critic_loss": 0.0, + "train_dice": 0.894736382544828, + "train_dice_loss": 0.08105266094207764, + "train_effective_steps": 8.0, + "train_entropy": 0.0, + "train_entropy_bonus_used": 0.0, + "train_entropy_loss": 0.0, + "train_iou": 0.8237886889055477, + "train_loss": -0.1281061815944585, + "train_mask_delta_mean": 0.0306854248046875, + "train_mean_reward": 0.017267421710378338, + "train_mean_value_pred": 0.0, + "train_reinforce_loss": 0.0, + "train_reward_zeros_pct": 0.7301634939556773, + "train_rl_loss_scale": 10.0, + "train_value_pred_error": 0.0, + "val_actor_loss": -0.012526211896329187, + "val_binary_flips_correct_pct": 0.3119562186446844, + "val_binary_flips_total_pct": 0.5535574520335478, + "val_binary_flips_wrong_pct": 0.24160123338886338, + "val_biou": 0.41508734716436185, + "val_biou_gain": 0.030427959333512167, + "val_ce_loss": 0.0, + "val_critic_loss": 0.0, + "val_decoder_biou": 0.3846593878308497, + "val_decoder_dice": 0.770921132483555, + "val_decoder_iou": 0.6801783568719756, + "val_dice": 0.7895907376904631, + "val_dice_gain": 0.01866960520690808, + "val_dice_loss": 0.0, + "val_entropy": 0.0, + "val_iou": 0.7039987537806727, + "val_iou_gain": 0.023820396908697083, + "val_loss": -0.12526211896329187, + "val_refine_score": 0.5595430504725173, + "val_reward": 0.012526211896329187, + "validated_this_epoch": true + }, + { + "alpha": null, + "early_stopping_active": false, + "early_stopping_best_value": null, + "early_stopping_improved": false, + "early_stopping_min_delta": 0.0, + "early_stopping_monitor_mode": "max", + "early_stopping_monitor_name": "val_refine_score", + "early_stopping_monitor_value": 0.5596270895246767, + "early_stopping_patience": 30, + "early_stopping_start_epoch": 30, + "early_stopping_wait": 0, + "encoder_lr": 0.00017198893020397134, + "epoch": 28, + "epoch_seconds": 12.28900722740218, + "grad_norm": 0.623288325288079, + "lr": 0.00017198893020397134, + "selection_metric_name": "val_refine_score", + "selection_metric_value": 0.5596270895246767, + "strategy3_bootstrap_loaded": true, + "strategy3_decoder_state": "frozen", + "strategy3_encoder_state": "frozen", + "strategy3_freeze_active": true, + "strategy3_freeze_requested": true, + "strategy3_segmentation_head_state": "frozen", + "train_action_distribution": { + "max_abs_delta": 0.10009765625, + "mean_abs_delta": 0.029494524954564193, + "mean_delta": -0.019485781519589098, + "near_zero_pct": 5.787449530523438e-05, + "negative_pct": 91.15238961848345, + "positive_pct": 8.847554121166468 + }, + "train_actor_loss": -0.017765193133860956, + "train_advantage_mean": 0.0, + "train_advantage_std": 0.0, + "train_alpha": 0.0, + "train_annealed_aux_ce_weight": 0.3200000000000001, + "train_biou_delta_mean": 0.017765193049195268, + "train_ce_loss": 0.17401958324692465, + "train_critic_loss": 0.0, + "train_dice": 0.8960504154533901, + "train_dice_loss": 0.07961798256093805, + "train_effective_steps": 8.0, + "train_entropy": 0.0, + "train_entropy_bonus_used": 0.0, + "train_entropy_loss": 0.0, + "train_iou": 0.8256537126017072, + "train_loss": -0.13706991956992584, + "train_mask_delta_mean": 0.029491077769886364, + "train_mean_reward": 0.017765193133860956, + "train_mean_value_pred": 0.0, + "train_reinforce_loss": 0.0, + "train_reward_zeros_pct": 0.5208333488553762, + "train_rl_loss_scale": 10.0, + "train_value_pred_error": 0.0, + "val_actor_loss": -0.012836408226576168, + "val_binary_flips_correct_pct": 0.31749874937768074, + "val_binary_flips_total_pct": 0.5852343989353554, + "val_binary_flips_wrong_pct": 0.26773564955767465, + "val_biou": 0.41640060271936075, + "val_biou_gain": 0.03174121488851106, + "val_ce_loss": 0.0, + "val_critic_loss": 0.0, + "val_decoder_biou": 0.3846593878308497, + "val_decoder_dice": 0.770921132483555, + "val_decoder_iou": 0.6801783568719756, + "val_dice": 0.7886960998818967, + "val_dice_gain": 0.017774967398341723, + "val_dice_loss": 0.0, + "val_entropy": 0.0, + "val_iou": 0.7028535763299925, + "val_iou_gain": 0.02267521945801687, + "val_loss": -0.12836408226576168, + "val_refine_score": 0.5596270895246767, + "val_reward": 0.012836408226576168, + "validated_this_epoch": true + }, + { + "alpha": null, + "early_stopping_active": false, + "early_stopping_best_value": null, + "early_stopping_improved": false, + "early_stopping_min_delta": 0.0, + "early_stopping_monitor_mode": "max", + "early_stopping_monitor_name": "val_refine_score", + "early_stopping_monitor_value": 0.5585794866304186, + "early_stopping_patience": 30, + "early_stopping_start_epoch": 30, + "early_stopping_wait": 0, + "encoder_lr": 0.0001702457870331824, + "epoch": 29, + "epoch_seconds": 12.277565740980208, + "grad_norm": 0.5506763024763628, + "lr": 0.0001702457870331824, + "selection_metric_name": "val_refine_score", + "selection_metric_value": 0.5585794866304186, + "strategy3_bootstrap_loaded": true, + "strategy3_decoder_state": "frozen", + "strategy3_encoder_state": "frozen", + "strategy3_freeze_active": true, + "strategy3_freeze_requested": true, + "strategy3_segmentation_head_state": "frozen", + "train_action_distribution": { + "max_abs_delta": 0.10009765625, + "mean_abs_delta": 0.03199321082369848, + "mean_delta": -0.022535656282508917, + "near_zero_pct": 2.456433918496259e-05, + "negative_pct": 91.22369851578365, + "positive_pct": 8.77627892081033 + }, + "train_actor_loss": -0.017844419393275694, + "train_advantage_mean": 0.0, + "train_advantage_std": 0.0, + "train_alpha": 0.0, + "train_annealed_aux_ce_weight": 0.2933333333333334, + "train_biou_delta_mean": 0.017844419393275694, + "train_ce_loss": 0.1830704469572414, + "train_critic_loss": 0.0, + "train_dice": 0.8953394074667237, + "train_dice_loss": 0.08186443827368996, + "train_effective_steps": 8.0, + "train_entropy": 0.0, + "train_entropy_bonus_used": 0.0, + "train_entropy_loss": 0.0, + "train_iou": 0.8246302457546153, + "train_loss": -0.13958708400076086, + "train_mask_delta_mean": 0.0319976806640625, + "train_mean_reward": 0.017844419393275694, + "train_mean_value_pred": 0.0, + "train_reinforce_loss": 0.0, + "train_reward_zeros_pct": 0.6591407645663078, + "train_rl_loss_scale": 10.0, + "train_value_pred_error": 0.0, + "val_actor_loss": -0.012954863643244607, + "val_binary_flips_correct_pct": 0.2535726509842218, + "val_binary_flips_total_pct": 0.4329344805549173, + "val_binary_flips_wrong_pct": 0.17936182957069546, + "val_biou": 0.4183785350911572, + "val_biou_gain": 0.0337191472603075, + "val_ce_loss": 0.0, + "val_critic_loss": 0.0, + "val_decoder_biou": 0.3846593878308497, + "val_decoder_dice": 0.770921132483555, + "val_decoder_iou": 0.6801783568719756, + "val_dice": 0.7839530622533457, + "val_dice_gain": 0.013031929769790729, + "val_dice_loss": 0.0, + "val_entropy": 0.0, + "val_iou": 0.69878043816968, + "val_iou_gain": 0.018602081297704465, + "val_loss": -0.12954863643244607, + "val_refine_score": 0.5585794866304186, + "val_reward": 0.012954863643244607, + "validated_this_epoch": true + }, + { + "alpha": null, + "early_stopping_active": true, + "early_stopping_best_value": 0.5584402914722243, + "early_stopping_improved": true, + "early_stopping_min_delta": 0.0, + "early_stopping_monitor_mode": "max", + "early_stopping_monitor_name": "val_refine_score", + "early_stopping_monitor_value": 0.5584402914722243, + "early_stopping_patience": 30, + "early_stopping_start_epoch": 30, + "early_stopping_wait": 0, + "encoder_lr": 0.00016845387875565144, + "epoch": 30, + "epoch_seconds": 12.300568820908666, + "grad_norm": 0.537314696745439, + "lr": 0.00016845387875565144, + "selection_metric_name": "val_refine_score", + "selection_metric_value": 0.5584402914722243, + "strategy3_bootstrap_loaded": true, + "strategy3_decoder_state": "frozen", + "strategy3_encoder_state": "frozen", + "strategy3_freeze_active": true, + "strategy3_freeze_requested": true, + "strategy3_segmentation_head_state": "frozen", + "train_action_distribution": { + "max_abs_delta": 0.10009765625, + "mean_abs_delta": 0.026468743040988393, + "mean_delta": -0.017170313735153864, + "near_zero_pct": 3.437486449022551e-05, + "negative_pct": 91.17324514822526, + "positive_pct": 8.826722678813068 + }, + "train_actor_loss": -0.01794045123890762, + "train_advantage_mean": 0.0, + "train_advantage_std": 0.0, + "train_alpha": 0.0, + "train_annealed_aux_ce_weight": 0.26666666666666666, + "train_biou_delta_mean": 0.017940451323573307, + "train_ce_loss": 0.17812328311530026, + "train_critic_loss": 0.0, + "train_dice": 0.8961109836226524, + "train_dice_loss": 0.08071669123389504, + "train_effective_steps": 8.0, + "train_entropy": 0.0, + "train_entropy_bonus_used": 0.0, + "train_entropy_loss": 0.0, + "train_iou": 0.8254478591559276, + "train_loss": -0.14489251713861118, + "train_mask_delta_mean": 0.026472611860795456, + "train_mean_reward": 0.01794045123890762, + "train_mean_value_pred": 0.0, + "train_reinforce_loss": 0.0, + "train_reward_zeros_pct": 0.6628788076341152, + "train_rl_loss_scale": 10.0, + "train_value_pred_error": 0.0, + "val_actor_loss": -0.012526863945822697, + "val_binary_flips_correct_pct": 0.2986496570063572, + "val_binary_flips_total_pct": 0.5451838175455729, + "val_binary_flips_wrong_pct": 0.24653416053921567, + "val_biou": 0.41765674636054656, + "val_biou_gain": 0.032997358529696874, + "val_ce_loss": 0.0, + "val_critic_loss": 0.0, + "val_decoder_biou": 0.3846593878308497, + "val_decoder_dice": 0.770921132483555, + "val_decoder_iou": 0.6801783568719756, + "val_dice": 0.7850743077274412, + "val_dice_gain": 0.014153175243886262, + "val_dice_loss": 0.0, + "val_entropy": 0.0, + "val_iou": 0.6992238365839021, + "val_iou_gain": 0.019045479711926494, + "val_loss": -0.12526863945822697, + "val_refine_score": 0.5584402914722243, + "val_reward": 0.012526863945822697, + "validated_this_epoch": true + }, + { + "alpha": null, + "early_stopping_active": true, + "early_stopping_best_value": 0.561358047397789, + "early_stopping_improved": true, + "early_stopping_min_delta": 0.0, + "early_stopping_monitor_mode": "max", + "early_stopping_monitor_name": "val_refine_score", + "early_stopping_monitor_value": 0.561358047397789, + "early_stopping_patience": 30, + "early_stopping_start_epoch": 30, + "early_stopping_wait": 0, + "encoder_lr": 0.00016661443345580398, + "epoch": 31, + "epoch_seconds": 12.268857690971345, + "grad_norm": 0.8748541853644631, + "lr": 0.00016661443345580398, + "selection_metric_name": "val_refine_score", + "selection_metric_value": 0.561358047397789, + "strategy3_bootstrap_loaded": true, + "strategy3_decoder_state": "frozen", + "strategy3_encoder_state": "frozen", + "strategy3_freeze_active": true, + "strategy3_freeze_requested": true, + "strategy3_segmentation_head_state": "frozen", + "train_action_distribution": { + "max_abs_delta": 0.10009765625, + "mean_abs_delta": 0.030356983103874056, + "mean_delta": -0.019454506998458368, + "near_zero_pct": 2.6769806089015962e-05, + "negative_pct": 91.24426394701004, + "positive_pct": 8.755711271342905 + }, + "train_actor_loss": -0.01775219816838878, + "train_advantage_mean": 0.0, + "train_advantage_std": 0.0, + "train_alpha": 0.0, + "train_annealed_aux_ce_weight": 0.24000000000000005, + "train_biou_delta_mean": 0.017752198253054467, + "train_ce_loss": 0.17639568583531814, + "train_critic_loss": 0.0, + "train_dice": 0.8902338247989664, + "train_dice_loss": 0.08098950711163608, + "train_effective_steps": 8.0, + "train_entropy": 0.0, + "train_entropy_bonus_used": 0.0, + "train_entropy_loss": 0.0, + "train_iou": 0.8198252207442079, + "train_loss": -0.1466357640244744, + "train_mask_delta_mean": 0.030358054421164772, + "train_mean_reward": 0.01775219816838878, + "train_mean_value_pred": 0.0, + "train_reinforce_loss": 0.0, + "train_reward_zeros_pct": 0.4734848625957966, + "train_rl_loss_scale": 10.0, + "train_value_pred_error": 0.0, + "val_actor_loss": -0.012669821031522588, + "val_binary_flips_correct_pct": 0.32516554290173105, + "val_binary_flips_total_pct": 0.613107868269378, + "val_binary_flips_wrong_pct": 0.2879423253676471, + "val_biou": 0.41810228127465665, + "val_biou_gain": 0.033442893443806965, + "val_ce_loss": 0.0, + "val_critic_loss": 0.0, + "val_decoder_biou": 0.3846593878308497, + "val_decoder_dice": 0.770921132483555, + "val_decoder_iou": 0.6801783568719756, + "val_dice": 0.7900563557483365, + "val_dice_gain": 0.019135223264781565, + "val_dice_loss": 0.0, + "val_entropy": 0.0, + "val_iou": 0.7046138135209216, + "val_iou_gain": 0.024435456648945975, + "val_loss": -0.12669821031522588, + "val_refine_score": 0.561358047397789, + "val_reward": 0.012669821031522588, + "validated_this_epoch": true + }, + { + "alpha": null, + "early_stopping_active": true, + "early_stopping_best_value": 0.5633902368246444, + "early_stopping_improved": true, + "early_stopping_min_delta": 0.0, + "early_stopping_monitor_mode": "max", + "early_stopping_monitor_name": "val_refine_score", + "early_stopping_monitor_value": 0.5633902368246444, + "early_stopping_patience": 30, + "early_stopping_start_epoch": 30, + "early_stopping_wait": 0, + "encoder_lr": 0.00016472871179756623, + "epoch": 32, + "epoch_seconds": 12.271468795835972, + "grad_norm": 0.5453700423240662, + "lr": 0.00016472871179756623, + "selection_metric_name": "val_refine_score", + "selection_metric_value": 0.5633902368246444, + "strategy3_bootstrap_loaded": true, + "strategy3_decoder_state": "frozen", + "strategy3_encoder_state": "frozen", + "strategy3_freeze_active": true, + "strategy3_freeze_requested": true, + "strategy3_segmentation_head_state": "frozen", + "train_action_distribution": { + "max_abs_delta": 0.10009765625, + "mean_abs_delta": 0.03575225925835019, + "mean_delta": -0.026019526190463115, + "near_zero_pct": 3.0724436586834514e-05, + "negative_pct": 91.29406322132458, + "positive_pct": 8.705907958475025 + }, + "train_actor_loss": -0.018194290702178314, + "train_advantage_mean": 0.0, + "train_advantage_std": 0.0, + "train_alpha": 0.0, + "train_annealed_aux_ce_weight": 0.21333333333333335, + "train_biou_delta_mean": 0.01819429087150969, + "train_ce_loss": 0.17431000552394174, + "train_critic_loss": 0.0, + "train_dice": 0.8976396022307914, + "train_dice_loss": 0.08029755137183449, + "train_effective_steps": 8.0, + "train_entropy": 0.0, + "train_entropy_bonus_used": 0.0, + "train_entropy_loss": 0.0, + "train_iou": 0.8278744610185647, + "train_loss": -0.15478476611050693, + "train_mask_delta_mean": 0.03574718128551136, + "train_mean_reward": 0.018194290702178314, + "train_mean_value_pred": 0.0, + "train_reinforce_loss": 0.0, + "train_reward_zeros_pct": 0.5445075919851661, + "train_rl_loss_scale": 10.0, + "train_value_pred_error": 0.0, + "val_actor_loss": -0.013523909947252832, + "val_binary_flips_correct_pct": 0.29259102017271754, + "val_binary_flips_total_pct": 0.49762725830078125, + "val_binary_flips_wrong_pct": 0.2050362381280637, + "val_biou": 0.4237537252378137, + "val_biou_gain": 0.039094337406964, + "val_ce_loss": 0.0, + "val_critic_loss": 0.0, + "val_decoder_biou": 0.3846593878308497, + "val_decoder_dice": 0.770921132483555, + "val_decoder_iou": 0.6801783568719756, + "val_dice": 0.7872205406056032, + "val_dice_gain": 0.01629940812204822, + "val_dice_loss": 0.0, + "val_entropy": 0.0, + "val_iou": 0.7030267484114752, + "val_iou_gain": 0.02284839153949958, + "val_loss": -0.13523909947252832, + "val_refine_score": 0.5633902368246444, + "val_reward": 0.013523909947252832, + "validated_this_epoch": true + }, + { + "alpha": null, + "early_stopping_active": true, + "early_stopping_best_value": 0.5633902368246444, + "early_stopping_improved": false, + "early_stopping_min_delta": 0.0, + "early_stopping_monitor_mode": "max", + "early_stopping_monitor_name": "val_refine_score", + "early_stopping_monitor_value": 0.5620593395050861, + "early_stopping_patience": 30, + "early_stopping_start_epoch": 30, + "early_stopping_wait": 1, + "encoder_lr": 0.00016279800616036884, + "epoch": 33, + "epoch_seconds": 12.305247690994292, + "grad_norm": 0.7041583630171689, + "lr": 0.00016279800616036884, + "selection_metric_name": "val_refine_score", + "selection_metric_value": 0.5620593395050861, + "strategy3_bootstrap_loaded": true, + "strategy3_decoder_state": "frozen", + "strategy3_encoder_state": "frozen", + "strategy3_freeze_active": true, + "strategy3_freeze_requested": true, + "strategy3_segmentation_head_state": "frozen", + "train_action_distribution": { + "max_abs_delta": 0.10009765625, + "mean_abs_delta": 0.031302824087271634, + "mean_delta": -0.021197018996727737, + "near_zero_pct": 8.935943753840547e-05, + "negative_pct": 91.21364632790738, + "positive_pct": 8.786266157403588 + }, + "train_actor_loss": -0.018083741603318645, + "train_advantage_mean": 0.0, + "train_advantage_std": 0.0, + "train_alpha": 0.0, + "train_annealed_aux_ce_weight": 0.1866666666666667, + "train_biou_delta_mean": 0.01808374177265002, + "train_ce_loss": 0.1785040172663602, + "train_critic_loss": 0.0, + "train_dice": 0.8939269343586809, + "train_dice_loss": 0.08132474530826915, + "train_effective_steps": 8.0, + "train_entropy": 0.0, + "train_entropy_bonus_used": 0.0, + "train_entropy_loss": 0.0, + "train_iou": 0.8239135652774914, + "train_loss": -0.1565867310220545, + "train_mask_delta_mean": 0.03130271218039773, + "train_mean_reward": 0.018083741603318645, + "train_mean_value_pred": 0.0, + "train_reinforce_loss": 0.0, + "train_reward_zeros_pct": 0.44981061946600676, + "train_rl_loss_scale": 10.0, + "train_value_pred_error": 0.0, + "val_actor_loss": -0.013496750205376884, + "val_binary_flips_correct_pct": 0.2793704762178309, + "val_binary_flips_total_pct": 0.4895228965609681, + "val_binary_flips_wrong_pct": 0.21015242034313728, + "val_biou": 0.4221899670917047, + "val_biou_gain": 0.03753057926085501, + "val_ce_loss": 0.0, + "val_critic_loss": 0.0, + "val_decoder_biou": 0.3846593878308497, + "val_decoder_dice": 0.770921132483555, + "val_decoder_iou": 0.6801783568719756, + "val_dice": 0.7863043127218245, + "val_dice_gain": 0.015383180238269567, + "val_dice_loss": 0.0, + "val_entropy": 0.0, + "val_iou": 0.7019287119184676, + "val_iou_gain": 0.02175035504649203, + "val_loss": -0.13496750205376884, + "val_refine_score": 0.5620593395050861, + "val_reward": 0.013496750205376884, + "validated_this_epoch": true + }, + { + "alpha": null, + "early_stopping_active": true, + "early_stopping_best_value": 0.56346345191812, + "early_stopping_improved": true, + "early_stopping_min_delta": 0.0, + "early_stopping_monitor_mode": "max", + "early_stopping_monitor_name": "val_refine_score", + "early_stopping_monitor_value": 0.56346345191812, + "early_stopping_patience": 30, + "early_stopping_start_epoch": 30, + "early_stopping_wait": 0, + "encoder_lr": 0.00016082363975341467, + "epoch": 34, + "epoch_seconds": 12.269919152371585, + "grad_norm": 0.5969339609146118, + "lr": 0.00016082363975341467, + "selection_metric_name": "val_refine_score", + "selection_metric_value": 0.56346345191812, + "strategy3_bootstrap_loaded": true, + "strategy3_decoder_state": "frozen", + "strategy3_encoder_state": "frozen", + "strategy3_freeze_active": true, + "strategy3_freeze_requested": true, + "strategy3_segmentation_head_state": "frozen", + "train_action_distribution": { + "max_abs_delta": 0.10009765625, + "mean_abs_delta": 0.03194665733132173, + "mean_delta": -0.02201236782341518, + "near_zero_pct": 4.517404774291704e-05, + "negative_pct": 91.2397635253993, + "positive_pct": 8.760193489830602 + }, + "train_actor_loss": -0.018499014106716706, + "train_advantage_mean": 0.0, + "train_advantage_std": 0.0, + "train_alpha": 0.0, + "train_annealed_aux_ce_weight": 0.16000000000000006, + "train_biou_delta_mean": 0.018499014106716706, + "train_ce_loss": 0.18158623305234042, + "train_critic_loss": 0.0, + "train_dice": 0.8953316547028781, + "train_dice_loss": 0.08150997486981479, + "train_effective_steps": 8.0, + "train_entropy": 0.0, + "train_entropy_bonus_used": 0.0, + "train_entropy_loss": 0.0, + "train_iou": 0.8248302966092058, + "train_loss": -0.16394243863495914, + "train_mask_delta_mean": 0.031953291459517044, + "train_mean_reward": 0.018499014106716706, + "train_mean_value_pred": 0.0, + "train_reinforce_loss": 0.0, + "train_reward_zeros_pct": 0.4971591057255864, + "train_rl_loss_scale": 10.0, + "train_value_pred_error": 0.0, + "val_actor_loss": -0.013565745706728194, + "val_binary_flips_correct_pct": 0.29891518985523896, + "val_binary_flips_total_pct": 0.5014494353649663, + "val_binary_flips_wrong_pct": 0.20253424550972732, + "val_biou": 0.4233732685202916, + "val_biou_gain": 0.038713880689441926, + "val_ce_loss": 0.0, + "val_critic_loss": 0.0, + "val_decoder_biou": 0.3846593878308497, + "val_decoder_dice": 0.770921132483555, + "val_decoder_iou": 0.6801783568719756, + "val_dice": 0.7880116920386444, + "val_dice_gain": 0.017090559555089424, + "val_dice_loss": 0.0, + "val_entropy": 0.0, + "val_iou": 0.7035536353159484, + "val_iou_gain": 0.023375278443972802, + "val_loss": -0.13565745706728194, + "val_refine_score": 0.56346345191812, + "val_reward": 0.013565745706728194, + "validated_this_epoch": true + }, + { + "alpha": null, + "early_stopping_active": true, + "early_stopping_best_value": 0.5660905575660109, + "early_stopping_improved": true, + "early_stopping_min_delta": 0.0, + "early_stopping_monitor_mode": "max", + "early_stopping_monitor_name": "val_refine_score", + "early_stopping_monitor_value": 0.5660905575660109, + "early_stopping_patience": 30, + "early_stopping_start_epoch": 30, + "early_stopping_wait": 0, + "encoder_lr": 0.00015880696570881722, + "epoch": 35, + "epoch_seconds": 12.304415022954345, + "grad_norm": 0.5322054624557495, + "lr": 0.00015880696570881722, + "selection_metric_name": "val_refine_score", + "selection_metric_value": 0.5660905575660109, + "strategy3_bootstrap_loaded": true, + "strategy3_decoder_state": "frozen", + "strategy3_encoder_state": "frozen", + "strategy3_freeze_active": true, + "strategy3_freeze_requested": true, + "strategy3_segmentation_head_state": "frozen", + "train_action_distribution": { + "max_abs_delta": 0.10009765625, + "mean_abs_delta": 0.02959018968977034, + "mean_delta": -0.018904615151272577, + "near_zero_pct": 2.4944591943536082e-05, + "negative_pct": 91.23133461583744, + "positive_pct": 8.768642723391002 + }, + "train_actor_loss": -0.01858581320861545, + "train_advantage_mean": 0.0, + "train_advantage_std": 0.0, + "train_alpha": 0.0, + "train_annealed_aux_ce_weight": 0.13333333333333333, + "train_biou_delta_mean": 0.01858581312394976, + "train_ce_loss": 0.1737641150301153, + "train_critic_loss": 0.0, + "train_dice": 0.8991828724938715, + "train_dice_loss": 0.07837808132171631, + "train_effective_steps": 8.0, + "train_entropy": 0.0, + "train_entropy_bonus_used": 0.0, + "train_entropy_loss": 0.0, + "train_iou": 0.8301389324096654, + "train_loss": -0.1690486493435773, + "train_mask_delta_mean": 0.029588179154829544, + "train_mean_reward": 0.01858581320861545, + "train_mean_value_pred": 0.0, + "train_reinforce_loss": 0.0, + "train_reward_zeros_pct": 0.14204545877873898, + "train_rl_loss_scale": 10.0, + "train_value_pred_error": 0.0, + "val_actor_loss": -0.012766125200869283, + "val_binary_flips_correct_pct": 0.3834892721737132, + "val_binary_flips_total_pct": 0.6942300235523897, + "val_binary_flips_wrong_pct": 0.31074075137867646, + "val_biou": 0.4256342787051846, + "val_biou_gain": 0.040974890874334924, + "val_ce_loss": 0.0, + "val_critic_loss": 0.0, + "val_decoder_biou": 0.3846593878308497, + "val_decoder_dice": 0.770921132483555, + "val_decoder_iou": 0.6801783568719756, + "val_dice": 0.7914868886240803, + "val_dice_gain": 0.02056575614052536, + "val_dice_loss": 0.0, + "val_entropy": 0.0, + "val_iou": 0.7065468364268371, + "val_iou_gain": 0.026368479554861546, + "val_loss": -0.12766125200869283, + "val_refine_score": 0.5660905575660109, + "val_reward": 0.012766125200869283, + "validated_this_epoch": true + }, + { + "alpha": null, + "early_stopping_active": true, + "early_stopping_best_value": 0.5660905575660109, + "early_stopping_improved": false, + "early_stopping_min_delta": 0.0, + "early_stopping_monitor_mode": "max", + "early_stopping_monitor_name": "val_refine_score", + "early_stopping_monitor_value": 0.5608609357049, + "early_stopping_patience": 30, + "early_stopping_start_epoch": 30, + "early_stopping_wait": 1, + "encoder_lr": 0.00015674936615423155, + "epoch": 36, + "epoch_seconds": 12.283688313793391, + "grad_norm": 0.6194604499773546, + "lr": 0.00015674936615423155, + "selection_metric_name": "val_refine_score", + "selection_metric_value": 0.5608609357049, + "strategy3_bootstrap_loaded": true, + "strategy3_decoder_state": "frozen", + "strategy3_encoder_state": "frozen", + "strategy3_freeze_active": true, + "strategy3_freeze_requested": true, + "strategy3_segmentation_head_state": "frozen", + "train_action_distribution": { + "max_abs_delta": 0.10009765625, + "mean_abs_delta": 0.0334068420343101, + "mean_delta": -0.023268113780597396, + "near_zero_pct": 3.688453385951686e-05, + "negative_pct": 91.24014648524198, + "positive_pct": 8.759819115088744 + }, + "train_actor_loss": -0.018200359989846635, + "train_advantage_mean": 0.0, + "train_advantage_std": 0.0, + "train_alpha": 0.0, + "train_annealed_aux_ce_weight": 0.10666666666666669, + "train_biou_delta_mean": 0.018200360074512322, + "train_ce_loss": 0.17709577489982953, + "train_critic_loss": 0.0, + "train_dice": 0.8933393666948202, + "train_dice_loss": 0.07998100735924461, + "train_effective_steps": 8.0, + "train_entropy": 0.0, + "train_entropy_bonus_used": 0.0, + "train_entropy_loss": 0.0, + "train_iou": 0.8240417935144327, + "train_loss": -0.1682928272268989, + "train_mask_delta_mean": 0.033400102095170456, + "train_mean_reward": 0.018200359989846635, + "train_mean_value_pred": 0.0, + "train_reinforce_loss": 0.0, + "train_reward_zeros_pct": 0.4734848625957966, + "train_rl_loss_scale": 10.0, + "train_value_pred_error": 0.0, + "val_actor_loss": -0.013487249096215237, + "val_binary_flips_correct_pct": 0.29940137676164214, + "val_binary_flips_total_pct": 0.5317949781230852, + "val_binary_flips_wrong_pct": 0.23239360136144302, + "val_biou": 0.42265337825239696, + "val_biou_gain": 0.037993990421547275, + "val_ce_loss": 0.0, + "val_critic_loss": 0.0, + "val_decoder_biou": 0.3846593878308497, + "val_decoder_dice": 0.770921132483555, + "val_decoder_iou": 0.6801783568719756, + "val_dice": 0.7839973356194293, + "val_dice_gain": 0.01307620313587432, + "val_dice_loss": 0.0, + "val_entropy": 0.0, + "val_iou": 0.6990684931574032, + "val_iou_gain": 0.018890136285427572, + "val_loss": -0.13487249096215237, + "val_refine_score": 0.5608609357049, + "val_reward": 0.013487249096215237, + "validated_this_epoch": true + }, + { + "alpha": null, + "early_stopping_active": true, + "early_stopping_best_value": 0.5660905575660109, + "early_stopping_improved": false, + "early_stopping_min_delta": 0.0, + "early_stopping_monitor_mode": "max", + "early_stopping_monitor_name": "val_refine_score", + "early_stopping_monitor_value": 0.5639109547494923, + "early_stopping_patience": 30, + "early_stopping_start_epoch": 30, + "early_stopping_wait": 2, + "encoder_lr": 0.00015465225126561297, + "epoch": 37, + "epoch_seconds": 12.312053307890892, + "grad_norm": 0.6198487959124825, + "lr": 0.00015465225126561297, + "selection_metric_name": "val_refine_score", + "selection_metric_value": 0.5639109547494923, + "strategy3_bootstrap_loaded": true, + "strategy3_decoder_state": "frozen", + "strategy3_encoder_state": "frozen", + "strategy3_freeze_active": true, + "strategy3_freeze_requested": true, + "strategy3_segmentation_head_state": "frozen", + "train_action_distribution": { + "max_abs_delta": 0.10009765625, + "mean_abs_delta": 0.028042300138622522, + "mean_delta": -0.018110022075812925, + "near_zero_pct": 2.349963094419846e-05, + "negative_pct": 91.25268201936375, + "positive_pct": 8.747296492484482 + }, + "train_actor_loss": -0.01885497437218543, + "train_advantage_mean": 0.0, + "train_advantage_std": 0.0, + "train_alpha": 0.0, + "train_annealed_aux_ce_weight": 0.07999999999999997, + "train_biou_delta_mean": 0.01885497437218543, + "train_ce_loss": 0.177568796006116, + "train_critic_loss": 0.0, + "train_dice": 0.8973980314299406, + "train_dice_loss": 0.0809320482340726, + "train_effective_steps": 8.0, + "train_entropy": 0.0, + "train_entropy_bonus_used": 0.0, + "train_entropy_loss": 0.0, + "train_iou": 0.8270658185457169, + "train_loss": -0.17820970172231848, + "train_mask_delta_mean": 0.02804010564630682, + "train_mean_reward": 0.01885497437218543, + "train_mean_value_pred": 0.0, + "train_reinforce_loss": 0.0, + "train_reward_zeros_pct": 0.4734848625957966, + "train_rl_loss_scale": 10.0, + "train_value_pred_error": 0.0, + "val_actor_loss": -0.013458392677421216, + "val_binary_flips_correct_pct": 0.33586539474188115, + "val_binary_flips_total_pct": 0.5925122429342831, + "val_binary_flips_wrong_pct": 0.25664684819240197, + "val_biou": 0.42304799413877525, + "val_biou_gain": 0.038388606307925566, + "val_ce_loss": 0.0, + "val_critic_loss": 0.0, + "val_decoder_biou": 0.3846593878308497, + "val_decoder_dice": 0.770921132483555, + "val_decoder_iou": 0.6801783568719756, + "val_dice": 0.7893708787589409, + "val_dice_gain": 0.01844974627538587, + "val_dice_loss": 0.0, + "val_entropy": 0.0, + "val_iou": 0.7047739153602092, + "val_iou_gain": 0.024595558488233582, + "val_loss": -0.13458392677421216, + "val_refine_score": 0.5639109547494923, + "val_reward": 0.013458392677421216, + "validated_this_epoch": true + }, + { + "alpha": null, + "early_stopping_active": true, + "early_stopping_best_value": 0.5660905575660109, + "early_stopping_improved": false, + "early_stopping_min_delta": 0.0, + "early_stopping_monitor_mode": "max", + "early_stopping_monitor_name": "val_refine_score", + "early_stopping_monitor_value": 0.5640479200074319, + "early_stopping_patience": 30, + "early_stopping_start_epoch": 30, + "early_stopping_wait": 3, + "encoder_lr": 0.00015251705830075291, + "epoch": 38, + "epoch_seconds": 12.319115411955863, + "grad_norm": 0.6693625206297095, + "lr": 0.00015251705830075291, + "selection_metric_name": "val_refine_score", + "selection_metric_value": 0.5640479200074319, + "strategy3_bootstrap_loaded": true, + "strategy3_decoder_state": "frozen", + "strategy3_encoder_state": "frozen", + "strategy3_freeze_active": true, + "strategy3_freeze_requested": true, + "strategy3_segmentation_head_state": "frozen", + "train_action_distribution": { + "max_abs_delta": 0.10009765625, + "mean_abs_delta": 0.03292800581336699, + "mean_delta": -0.022807795194570313, + "near_zero_pct": 3.11046894745976e-05, + "negative_pct": 91.2560027431358, + "positive_pct": 8.743968326598406 + }, + "train_actor_loss": -0.018567255694382435, + "train_advantage_mean": 0.0, + "train_advantage_std": 0.0, + "train_alpha": 0.0, + "train_annealed_aux_ce_weight": 0.05333333333333332, + "train_biou_delta_mean": 0.018567255821380968, + "train_ce_loss": 0.18300962989980524, + "train_critic_loss": 0.0, + "train_dice": 0.8968995559896269, + "train_dice_loss": 0.08148468624461781, + "train_effective_steps": 8.0, + "train_entropy": 0.0, + "train_entropy_bonus_used": 0.0, + "train_entropy_loss": 0.0, + "train_iou": 0.8276408858935678, + "train_loss": -0.17861937528306787, + "train_mask_delta_mean": 0.032927079634232956, + "train_mean_reward": 0.018567255694382435, + "train_mean_value_pred": 0.0, + "train_reinforce_loss": 0.0, + "train_reward_zeros_pct": 0.4734848625957966, + "train_rl_loss_scale": 10.0, + "train_value_pred_error": 0.0, + "val_actor_loss": -0.01375237828324316, + "val_binary_flips_correct_pct": 0.2962598613664216, + "val_binary_flips_total_pct": 0.48420475978477323, + "val_binary_flips_wrong_pct": 0.1879448984183517, + "val_biou": 0.42628000441636943, + "val_biou_gain": 0.04162061658551974, + "val_ce_loss": 0.0, + "val_critic_loss": 0.0, + "val_decoder_biou": 0.3846593878308497, + "val_decoder_dice": 0.770921132483555, + "val_decoder_iou": 0.6801783568719756, + "val_dice": 0.7858777488480786, + "val_dice_gain": 0.014956616364523612, + "val_dice_loss": 0.0, + "val_entropy": 0.0, + "val_iou": 0.7018158355984943, + "val_iou_gain": 0.021637478726518666, + "val_loss": -0.1375237828324316, + "val_refine_score": 0.5640479200074319, + "val_reward": 0.01375237828324316, + "validated_this_epoch": true + }, + { + "alpha": null, + "early_stopping_active": true, + "early_stopping_best_value": 0.5660905575660109, + "early_stopping_improved": false, + "early_stopping_min_delta": 0.0, + "early_stopping_monitor_mode": "max", + "early_stopping_monitor_name": "val_refine_score", + "early_stopping_monitor_value": 0.5624189571705802, + "early_stopping_patience": 30, + "early_stopping_start_epoch": 30, + "early_stopping_wait": 4, + "encoder_lr": 0.00015034525061425423, + "epoch": 39, + "epoch_seconds": 12.312729358673096, + "grad_norm": 0.6089554103938016, + "lr": 0.00015034525061425423, + "selection_metric_name": "val_refine_score", + "selection_metric_value": 0.5624189571705802, + "strategy3_bootstrap_loaded": true, + "strategy3_decoder_state": "frozen", + "strategy3_encoder_state": "frozen", + "strategy3_freeze_active": true, + "strategy3_freeze_requested": true, + "strategy3_segmentation_head_state": "frozen", + "train_action_distribution": { + "max_abs_delta": 0.10009765625, + "mean_abs_delta": 0.03197086088105359, + "mean_delta": -0.02118630446916954, + "near_zero_pct": 7.224805565122303e-05, + "negative_pct": 91.27422869205475, + "positive_pct": 8.725701446052302 + }, + "train_actor_loss": -0.01887908723967319, + "train_advantage_mean": 0.0, + "train_advantage_std": 0.0, + "train_alpha": 0.0, + "train_annealed_aux_ce_weight": 0.040000000000000015, + "train_biou_delta_mean": 0.018879087049175392, + "train_ce_loss": 0.18078210882165216, + "train_critic_loss": 0.0, + "train_dice": 0.8990663061141019, + "train_dice_loss": 0.08220959251577203, + "train_effective_steps": 8.0, + "train_entropy": 0.0, + "train_entropy_bonus_used": 0.0, + "train_entropy_loss": 0.0, + "train_iou": 0.8307007553522968, + "train_loss": -0.18353103372183713, + "train_mask_delta_mean": 0.03196300159801136, + "train_mean_reward": 0.01887908723967319, + "train_mean_value_pred": 0.0, + "train_reinforce_loss": 0.0, + "train_reward_zeros_pct": 0.5407695489173586, + "train_rl_loss_scale": 10.0, + "train_value_pred_error": 0.0, + "val_actor_loss": -0.013522037712391466, + "val_binary_flips_correct_pct": 0.2887052648207721, + "val_binary_flips_total_pct": 0.49163593965418195, + "val_binary_flips_wrong_pct": 0.20293067483340993, + "val_biou": 0.42378332142032127, + "val_biou_gain": 0.03912393358947158, + "val_ce_loss": 0.0, + "val_critic_loss": 0.0, + "val_decoder_biou": 0.3846593878308497, + "val_decoder_dice": 0.770921132483555, + "val_decoder_iou": 0.6801783568719756, + "val_dice": 0.785539744768807, + "val_dice_gain": 0.014618612285251964, + "val_dice_loss": 0.0, + "val_entropy": 0.0, + "val_iou": 0.7010545929208392, + "val_iou_gain": 0.020876236048863572, + "val_loss": -0.13522037712391466, + "val_refine_score": 0.5624189571705802, + "val_reward": 0.013522037712391466, + "validated_this_epoch": true + }, + { + "alpha": null, + "early_stopping_active": true, + "early_stopping_best_value": 0.5660905575660109, + "early_stopping_improved": false, + "early_stopping_min_delta": 0.0, + "early_stopping_monitor_mode": "max", + "early_stopping_monitor_name": "val_refine_score", + "early_stopping_monitor_value": 0.5656077503781917, + "early_stopping_patience": 30, + "early_stopping_start_epoch": 30, + "early_stopping_wait": 5, + "encoder_lr": 0.00014813831665462106, + "epoch": 40, + "epoch_seconds": 12.282601275946945, + "grad_norm": 0.5513238446279005, + "lr": 0.00014813831665462106, + "selection_metric_name": "val_refine_score", + "selection_metric_value": 0.5656077503781917, + "strategy3_bootstrap_loaded": true, + "strategy3_decoder_state": "frozen", + "strategy3_encoder_state": "frozen", + "strategy3_freeze_active": true, + "strategy3_freeze_requested": true, + "strategy3_segmentation_head_state": "frozen", + "train_action_distribution": { + "max_abs_delta": 0.10009765625, + "mean_abs_delta": 0.030200454660437324, + "mean_delta": -0.019975865630178967, + "near_zero_pct": 4.806396999997146e-05, + "negative_pct": 91.16062894463539, + "positive_pct": 8.839324908331037 + }, + "train_actor_loss": -0.019660584621967493, + "train_advantage_mean": 0.0, + "train_advantage_std": 0.0, + "train_alpha": 0.0, + "train_annealed_aux_ce_weight": 0.040000000000000015, + "train_biou_delta_mean": 0.01966058468546676, + "train_ce_loss": 0.17499990896745163, + "train_critic_loss": 0.0, + "train_dice": 0.9000932797861504, + "train_dice_loss": 0.07923963936892423, + "train_effective_steps": 8.0, + "train_entropy": 0.0, + "train_entropy_bonus_used": 0.0, + "train_entropy_loss": 0.0, + "train_iou": 0.8316164058579224, + "train_loss": -0.19152105396444147, + "train_mask_delta_mean": 0.030195756392045456, + "train_mean_reward": 0.019660584621967493, + "train_mean_value_pred": 0.0, + "train_reinforce_loss": 0.0, + "train_reward_zeros_pct": 0.3077651606872678, + "train_rl_loss_scale": 10.0, + "train_value_pred_error": 0.0, + "val_actor_loss": -0.013380242075072601, + "val_binary_flips_correct_pct": 0.37570654177198226, + "val_binary_flips_total_pct": 0.6658666274126839, + "val_binary_flips_wrong_pct": 0.2901600856407016, + "val_biou": 0.42466163651775063, + "val_biou_gain": 0.04000224868690094, + "val_ce_loss": 0.0, + "val_critic_loss": 0.0, + "val_decoder_biou": 0.3846593878308497, + "val_decoder_dice": 0.770921132483555, + "val_decoder_iou": 0.6801783568719756, + "val_dice": 0.7916095311140136, + "val_dice_gain": 0.02068839863045857, + "val_dice_loss": 0.0, + "val_entropy": 0.0, + "val_iou": 0.7065538642386328, + "val_iou_gain": 0.02637550736665717, + "val_loss": -0.13380242075072601, + "val_refine_score": 0.5656077503781917, + "val_reward": 0.013380242075072601, + "validated_this_epoch": true + }, + { + "alpha": null, + "early_stopping_active": true, + "early_stopping_best_value": 0.5660905575660109, + "early_stopping_improved": false, + "early_stopping_min_delta": 0.0, + "early_stopping_monitor_mode": "max", + "early_stopping_monitor_name": "val_refine_score", + "early_stopping_monitor_value": 0.5624550670220181, + "early_stopping_patience": 30, + "early_stopping_start_epoch": 30, + "early_stopping_wait": 6, + "encoder_lr": 0.00014589776894415052, + "epoch": 41, + "epoch_seconds": 12.27512364787981, + "grad_norm": 0.8410897363315929, + "lr": 0.00014589776894415052, + "selection_metric_name": "val_refine_score", + "selection_metric_value": 0.5624550670220181, + "strategy3_bootstrap_loaded": true, + "strategy3_decoder_state": "frozen", + "strategy3_encoder_state": "frozen", + "strategy3_freeze_active": true, + "strategy3_freeze_requested": true, + "strategy3_segmentation_head_state": "frozen", + "train_action_distribution": { + "max_abs_delta": 0.10009765625, + "mean_abs_delta": 0.0287044755267826, + "mean_delta": -0.018638927743516186, + "near_zero_pct": 1.7339533542326535e-05, + "negative_pct": 91.1740360612219, + "positive_pct": 8.825948809019543 + }, + "train_actor_loss": -0.01882936058311977, + "train_advantage_mean": 0.0, + "train_advantage_std": 0.0, + "train_alpha": 0.0, + "train_annealed_aux_ce_weight": 0.040000000000000015, + "train_biou_delta_mean": 0.01882936058311977, + "train_ce_loss": 0.1774816851724278, + "train_critic_loss": 0.0, + "train_dice": 0.8957275122048342, + "train_dice_loss": 0.080102416602048, + "train_effective_steps": 8.0, + "train_entropy": 0.0, + "train_entropy_bonus_used": 0.0, + "train_entropy_loss": 0.0, + "train_iou": 0.82630673833805, + "train_loss": -0.18314191563562912, + "train_mask_delta_mean": 0.0287017822265625, + "train_mean_reward": 0.01882936058311977, + "train_mean_value_pred": 0.0, + "train_reinforce_loss": 0.0, + "train_reward_zeros_pct": 0.3314394038170576, + "train_rl_loss_scale": 10.0, + "train_value_pred_error": 0.0, + "val_actor_loss": -0.013513451413018629, + "val_binary_flips_correct_pct": 0.32409219180836396, + "val_binary_flips_total_pct": 0.5999957813936121, + "val_binary_flips_wrong_pct": 0.2759035895852482, + "val_biou": 0.4249396370009781, + "val_biou_gain": 0.0402802491701284, + "val_ce_loss": 0.0, + "val_critic_loss": 0.0, + "val_decoder_biou": 0.3846593878308497, + "val_decoder_dice": 0.770921132483555, + "val_decoder_iou": 0.6801783568719756, + "val_dice": 0.7848185436897265, + "val_dice_gain": 0.013897411206171495, + "val_dice_loss": 0.0, + "val_entropy": 0.0, + "val_iou": 0.699970497043058, + "val_iou_gain": 0.01979214017108244, + "val_loss": -0.1351345141301863, + "val_refine_score": 0.5624550670220181, + "val_reward": 0.013513451413018629, + "validated_this_epoch": true + }, + { + "alpha": null, + "early_stopping_active": true, + "early_stopping_best_value": 0.566406093307325, + "early_stopping_improved": true, + "early_stopping_min_delta": 0.0, + "early_stopping_monitor_mode": "max", + "early_stopping_monitor_name": "val_refine_score", + "early_stopping_monitor_value": 0.566406093307325, + "early_stopping_patience": 30, + "early_stopping_start_epoch": 30, + "early_stopping_wait": 0, + "encoder_lr": 0.00014362514304232544, + "epoch": 42, + "epoch_seconds": 12.323708938900381, + "grad_norm": 0.7872692129828713, + "lr": 0.00014362514304232544, + "selection_metric_name": "val_refine_score", + "selection_metric_value": 0.566406093307325, + "strategy3_bootstrap_loaded": true, + "strategy3_decoder_state": "frozen", + "strategy3_encoder_state": "frozen", + "strategy3_freeze_active": true, + "strategy3_freeze_requested": true, + "strategy3_segmentation_head_state": "frozen", + "train_action_distribution": { + "max_abs_delta": 0.10009765625, + "mean_abs_delta": 0.02880525876852599, + "mean_delta": -0.01890856091102416, + "near_zero_pct": 3.832949498804407e-05, + "negative_pct": 91.19968922300772, + "positive_pct": 8.80027428608049 + }, + "train_actor_loss": -0.018872756890645673, + "train_advantage_mean": 0.0, + "train_advantage_std": 0.0, + "train_alpha": 0.0, + "train_annealed_aux_ce_weight": 0.040000000000000015, + "train_biou_delta_mean": 0.018872756805979985, + "train_ce_loss": 0.178736996921626, + "train_critic_loss": 0.0, + "train_dice": 0.8971600462650888, + "train_dice_loss": 0.08152622526342218, + "train_effective_steps": 8.0, + "train_entropy": 0.0, + "train_entropy_bonus_used": 0.0, + "train_entropy_loss": 0.0, + "train_iou": 0.8272989612943605, + "train_loss": -0.1835223070599816, + "train_mask_delta_mean": 0.02880859375, + "train_mean_reward": 0.018872756890645673, + "train_mean_value_pred": 0.0, + "train_reinforce_loss": 0.0, + "train_reward_zeros_pct": 0.4971591057255864, + "train_rl_loss_scale": 10.0, + "train_value_pred_error": 0.0, + "val_actor_loss": -0.013281453790114028, + "val_binary_flips_correct_pct": 0.3834369135837929, + "val_binary_flips_total_pct": 0.6868811214671415, + "val_binary_flips_wrong_pct": 0.3034442078833487, + "val_biou": 0.4244320266635321, + "val_biou_gain": 0.039772638832682394, + "val_ce_loss": 0.0, + "val_critic_loss": 0.0, + "val_decoder_biou": 0.3846593878308497, + "val_decoder_dice": 0.770921132483555, + "val_decoder_iou": 0.6801783568719756, + "val_dice": 0.7927068797303527, + "val_dice_gain": 0.021785747246797715, + "val_dice_loss": 0.0, + "val_entropy": 0.0, + "val_iou": 0.708380159951118, + "val_iou_gain": 0.02820180307914244, + "val_loss": -0.13281453790114028, + "val_refine_score": 0.566406093307325, + "val_reward": 0.013281453790114028, + "validated_this_epoch": true + }, + { + "alpha": null, + "early_stopping_active": true, + "early_stopping_best_value": 0.566406093307325, + "early_stopping_improved": false, + "early_stopping_min_delta": 0.0, + "early_stopping_monitor_mode": "max", + "early_stopping_monitor_name": "val_refine_score", + "early_stopping_monitor_value": 0.5639416542448797, + "early_stopping_patience": 30, + "early_stopping_start_epoch": 30, + "early_stopping_wait": 1, + "encoder_lr": 0.00014132199649341884, + "epoch": 43, + "epoch_seconds": 12.323515414725989, + "grad_norm": 0.6553171927278693, + "lr": 0.00014132199649341884, + "selection_metric_name": "val_refine_score", + "selection_metric_value": 0.5639416542448797, + "strategy3_bootstrap_loaded": true, + "strategy3_decoder_state": "frozen", + "strategy3_encoder_state": "frozen", + "strategy3_freeze_active": true, + "strategy3_freeze_requested": true, + "strategy3_segmentation_head_state": "frozen", + "train_action_distribution": { + "max_abs_delta": 0.10009765625, + "mean_abs_delta": 0.03178866592828523, + "mean_delta": -0.021159918999976733, + "near_zero_pct": 4.76837169830188e-05, + "negative_pct": 91.16537503220819, + "positive_pct": 8.83457911285487 + }, + "train_actor_loss": -0.019042516973885624, + "train_advantage_mean": 0.0, + "train_advantage_std": 0.0, + "train_alpha": 0.0, + "train_annealed_aux_ce_weight": 0.040000000000000015, + "train_biou_delta_mean": 0.019042516804554245, + "train_ce_loss": 0.1691005053845319, + "train_critic_loss": 0.0, + "train_dice": 0.8971898974569494, + "train_dice_loss": 0.0759459679776972, + "train_effective_steps": 8.0, + "train_entropy": 0.0, + "train_entropy_bonus_used": 0.0, + "train_entropy_loss": 0.0, + "train_iou": 0.8289588180190033, + "train_loss": -0.18552424013614655, + "train_mask_delta_mean": 0.031782670454545456, + "train_mean_reward": 0.019042516973885624, + "train_mean_value_pred": 0.0, + "train_reinforce_loss": 0.0, + "train_reward_zeros_pct": 0.5681818351149559, + "train_rl_loss_scale": 10.0, + "train_value_pred_error": 0.0, + "val_actor_loss": -0.013406673697318183, + "val_binary_flips_correct_pct": 0.33757826861213236, + "val_binary_flips_total_pct": 0.5891575532801011, + "val_binary_flips_wrong_pct": 0.25157928466796875, + "val_biou": 0.4237796440650819, + "val_biou_gain": 0.03912025623423221, + "val_ce_loss": 0.0, + "val_critic_loss": 0.0, + "val_decoder_biou": 0.3846593878308497, + "val_decoder_dice": 0.770921132483555, + "val_decoder_iou": 0.6801783568719756, + "val_dice": 0.7888409126276068, + "val_dice_gain": 0.017919780144051822, + "val_dice_loss": 0.0, + "val_entropy": 0.0, + "val_iou": 0.7041036644246776, + "val_iou_gain": 0.023925307552702058, + "val_loss": -0.13406673697318183, + "val_refine_score": 0.5639416542448797, + "val_reward": 0.013406673697318183, + "validated_this_epoch": true + }, + { + "alpha": null, + "early_stopping_active": true, + "early_stopping_best_value": 0.5679105673561133, + "early_stopping_improved": true, + "early_stopping_min_delta": 0.0, + "early_stopping_monitor_mode": "max", + "early_stopping_monitor_name": "val_refine_score", + "early_stopping_monitor_value": 0.5679105673561133, + "early_stopping_patience": 30, + "early_stopping_start_epoch": 30, + "early_stopping_wait": 0, + "encoder_lr": 0.00013898990775903052, + "epoch": 44, + "epoch_seconds": 12.325701603665948, + "grad_norm": 0.5880074771967801, + "lr": 0.00013898990775903052, + "selection_metric_name": "val_refine_score", + "selection_metric_value": 0.5679105673561133, + "strategy3_bootstrap_loaded": true, + "strategy3_decoder_state": "frozen", + "strategy3_encoder_state": "frozen", + "strategy3_freeze_active": true, + "strategy3_freeze_requested": true, + "strategy3_segmentation_head_state": "frozen", + "train_action_distribution": { + "max_abs_delta": 0.10009765625, + "mean_abs_delta": 0.03336810047568923, + "mean_delta": -0.023683643794025887, + "near_zero_pct": 4.859632321602641e-05, + "negative_pct": 91.25880748033524, + "positive_pct": 8.741146114400841 + }, + "train_actor_loss": -0.01946779280445877, + "train_advantage_mean": 0.0, + "train_advantage_std": 0.0, + "train_alpha": 0.0, + "train_annealed_aux_ce_weight": 0.040000000000000015, + "train_biou_delta_mean": 0.019467792465796017, + "train_ce_loss": 0.1805169623006474, + "train_critic_loss": 0.0, + "train_dice": 0.8957451873954184, + "train_dice_loss": 0.08281112800944936, + "train_effective_steps": 8.0, + "train_entropy": 0.0, + "train_entropy_bonus_used": 0.0, + "train_entropy_loss": 0.0, + "train_iou": 0.8279912443093452, + "train_loss": -0.18941137465563687, + "train_mask_delta_mean": 0.03337790749289773, + "train_mean_reward": 0.01946779280445877, + "train_mean_value_pred": 0.0, + "train_reinforce_loss": 0.0, + "train_reward_zeros_pct": 0.9469697251915932, + "train_rl_loss_scale": 10.0, + "train_value_pred_error": 0.0, + "val_actor_loss": -0.01395190449693473, + "val_binary_flips_correct_pct": 0.3554849063648897, + "val_binary_flips_total_pct": 0.5809858733532476, + "val_binary_flips_wrong_pct": 0.22550096698835786, + "val_biou": 0.428644322440318, + "val_biou_gain": 0.04398493460946834, + "val_ce_loss": 0.0, + "val_critic_loss": 0.0, + "val_decoder_biou": 0.3846593878308497, + "val_decoder_dice": 0.770921132483555, + "val_decoder_iou": 0.6801783568719756, + "val_dice": 0.7910292512444552, + "val_dice_gain": 0.02010811876090024, + "val_dice_loss": 0.0, + "val_entropy": 0.0, + "val_iou": 0.7071768122719087, + "val_iou_gain": 0.026998455399933063, + "val_loss": -0.1395190449693473, + "val_refine_score": 0.5679105673561133, + "val_reward": 0.01395190449693473, + "validated_this_epoch": true + }, + { + "alpha": null, + "early_stopping_active": true, + "early_stopping_best_value": 0.5679105673561133, + "early_stopping_improved": false, + "early_stopping_min_delta": 0.0, + "early_stopping_monitor_mode": "max", + "early_stopping_monitor_name": "val_refine_score", + "early_stopping_monitor_value": 0.5661618643442095, + "early_stopping_patience": 30, + "early_stopping_start_epoch": 30, + "early_stopping_wait": 1, + "encoder_lr": 0.00013663047513628863, + "epoch": 45, + "epoch_seconds": 12.311484491918236, + "grad_norm": 0.6817272657697852, + "lr": 0.00013663047513628863, + "selection_metric_name": "val_refine_score", + "selection_metric_value": 0.5661618643442095, + "strategy3_bootstrap_loaded": true, + "strategy3_decoder_state": "frozen", + "strategy3_encoder_state": "frozen", + "strategy3_freeze_active": true, + "strategy3_freeze_requested": true, + "strategy3_segmentation_head_state": "frozen", + "train_action_distribution": { + "max_abs_delta": 0.10009765625, + "mean_abs_delta": 0.029229027176783842, + "mean_delta": -0.018745153105225076, + "near_zero_pct": 6.722871768777787e-05, + "negative_pct": 91.24037792736834, + "positive_pct": 8.759557083249092 + }, + "train_actor_loss": -0.019355303073098185, + "train_advantage_mean": 0.0, + "train_advantage_std": 0.0, + "train_alpha": 0.0, + "train_annealed_aux_ce_weight": 0.040000000000000015, + "train_biou_delta_mean": 0.019355302988432497, + "train_ce_loss": 0.16933287544683975, + "train_critic_loss": 0.0, + "train_dice": 0.902546794553698, + "train_dice_loss": 0.07706708257848566, + "train_effective_steps": 8.0, + "train_entropy": 0.0, + "train_entropy_bonus_used": 0.0, + "train_entropy_loss": 0.0, + "train_iou": 0.8339893391658829, + "train_loss": -0.18862503496083347, + "train_mask_delta_mean": 0.029234452681107956, + "train_mean_reward": 0.019355303073098185, + "train_mean_value_pred": 0.0, + "train_reinforce_loss": 0.0, + "train_reward_zeros_pct": 0.4971591057255864, + "train_rl_loss_scale": 10.0, + "train_value_pred_error": 0.0, + "val_actor_loss": -0.01393088677286869, + "val_binary_flips_correct_pct": 0.3378400615617341, + "val_binary_flips_total_pct": 0.5723654055127911, + "val_binary_flips_wrong_pct": 0.234525343951057, + "val_biou": 0.42670025456558414, + "val_biou_gain": 0.04204086673473445, + "val_ce_loss": 0.0, + "val_critic_loss": 0.0, + "val_decoder_biou": 0.3846593878308497, + "val_decoder_dice": 0.770921132483555, + "val_decoder_iou": 0.6801783568719756, + "val_dice": 0.7899150106557503, + "val_dice_gain": 0.018993878172195333, + "val_dice_loss": 0.0, + "val_entropy": 0.0, + "val_iou": 0.7056234741228347, + "val_iou_gain": 0.025445117250859073, + "val_loss": -0.1393088677286869, + "val_refine_score": 0.5661618643442095, + "val_reward": 0.01393088677286869, + "validated_this_epoch": true + }, + { + "alpha": null, + "early_stopping_active": true, + "early_stopping_best_value": 0.56943207420596, + "early_stopping_improved": true, + "early_stopping_min_delta": 0.0, + "early_stopping_monitor_mode": "max", + "early_stopping_monitor_name": "val_refine_score", + "early_stopping_monitor_value": 0.56943207420596, + "early_stopping_patience": 30, + "early_stopping_start_epoch": 30, + "early_stopping_wait": 0, + "encoder_lr": 0.00013424531566245653, + "epoch": 46, + "epoch_seconds": 12.315176812931895, + "grad_norm": 0.6294446154074236, + "lr": 0.00013424531566245653, + "selection_metric_name": "val_refine_score", + "selection_metric_value": 0.56943207420596, + "strategy3_bootstrap_loaded": true, + "strategy3_decoder_state": "frozen", + "strategy3_encoder_state": "frozen", + "strategy3_freeze_active": true, + "strategy3_freeze_requested": true, + "strategy3_segmentation_head_state": "frozen", + "train_action_distribution": { + "max_abs_delta": 0.10009765625, + "mean_abs_delta": 0.032161291244185784, + "mean_delta": -0.021403277610343965, + "near_zero_pct": 3.467906695546348e-05, + "negative_pct": 91.13765894012018, + "positive_pct": 8.862308294258334 + }, + "train_actor_loss": -0.019987721333481288, + "train_advantage_mean": 0.0, + "train_advantage_std": 0.0, + "train_alpha": 0.0, + "train_annealed_aux_ce_weight": 0.040000000000000015, + "train_biou_delta_mean": 0.019987721333481288, + "train_ce_loss": 0.17334013364531778, + "train_critic_loss": 0.0, + "train_dice": 0.9028956156056427, + "train_dice_loss": 0.07781497456810692, + "train_effective_steps": 8.0, + "train_entropy": 0.0, + "train_entropy_bonus_used": 0.0, + "train_entropy_loss": 0.0, + "train_iou": 0.8358076012924899, + "train_loss": -0.1948541118340059, + "train_mask_delta_mean": 0.03216136585582386, + "train_mean_reward": 0.019987721333481288, + "train_mean_value_pred": 0.0, + "train_reinforce_loss": 0.0, + "train_reward_zeros_pct": 0.4971591057255864, + "train_rl_loss_scale": 10.0, + "train_value_pred_error": 0.0, + "val_actor_loss": -0.014454220203333534, + "val_binary_flips_correct_pct": 0.34337511249617036, + "val_binary_flips_total_pct": 0.5931031470205269, + "val_binary_flips_wrong_pct": 0.2497280345243566, + "val_biou": 0.4318514591016318, + "val_biou_gain": 0.04719207127078212, + "val_ce_loss": 0.0, + "val_critic_loss": 0.0, + "val_decoder_biou": 0.3846593878308497, + "val_decoder_dice": 0.770921132483555, + "val_decoder_iou": 0.6801783568719756, + "val_dice": 0.7903356001028405, + "val_dice_gain": 0.019414467619285558, + "val_dice_loss": 0.0, + "val_entropy": 0.0, + "val_iou": 0.707012689310288, + "val_iou_gain": 0.026834332438312458, + "val_loss": -0.14454220203333534, + "val_refine_score": 0.56943207420596, + "val_reward": 0.014454220203333534, + "validated_this_epoch": true + }, + { + "alpha": null, + "early_stopping_active": true, + "early_stopping_best_value": 0.56943207420596, + "early_stopping_improved": false, + "early_stopping_min_delta": 0.0, + "early_stopping_monitor_mode": "max", + "early_stopping_monitor_name": "val_refine_score", + "early_stopping_monitor_value": 0.5674656893344703, + "early_stopping_patience": 30, + "early_stopping_start_epoch": 30, + "early_stopping_wait": 1, + "encoder_lr": 0.00013183606400669613, + "epoch": 47, + "epoch_seconds": 12.355216545984149, + "grad_norm": 0.7093438885428689, + "lr": 0.00013183606400669613, + "selection_metric_name": "val_refine_score", + "selection_metric_value": 0.5674656893344703, + "strategy3_bootstrap_loaded": true, + "strategy3_decoder_state": "frozen", + "strategy3_encoder_state": "frozen", + "strategy3_freeze_active": true, + "strategy3_freeze_requested": true, + "strategy3_segmentation_head_state": "frozen", + "train_action_distribution": { + "max_abs_delta": 0.10009765625, + "mean_abs_delta": 0.03169084245085039, + "mean_delta": -0.021443571450866082, + "near_zero_pct": 3.7264786747279935e-05, + "negative_pct": 91.19751351800832, + "positive_pct": 8.802451388063757 + }, + "train_actor_loss": -0.019997871078720145, + "train_advantage_mean": 0.0, + "train_advantage_std": 0.0, + "train_alpha": 0.0, + "train_annealed_aux_ce_weight": 0.040000000000000015, + "train_biou_delta_mean": 0.019997871078720145, + "train_ce_loss": 0.1697592227296396, + "train_critic_loss": 0.0, + "train_dice": 0.9026770620647189, + "train_dice_loss": 0.07687623392451894, + "train_effective_steps": 8.0, + "train_entropy": 0.0, + "train_entropy_bonus_used": 0.0, + "train_entropy_loss": 0.0, + "train_iou": 0.8369003364018825, + "train_loss": -0.19504600356925617, + "train_mask_delta_mean": 0.03167724609375, + "train_mean_reward": 0.019997871078720145, + "train_mean_value_pred": 0.0, + "train_reinforce_loss": 0.0, + "train_reward_zeros_pct": 0.5918560782447457, + "train_rl_loss_scale": 10.0, + "train_value_pred_error": 0.0, + "val_actor_loss": -0.013763871516857762, + "val_binary_flips_correct_pct": 0.3728754380170037, + "val_binary_flips_total_pct": 0.6548077452416514, + "val_binary_flips_wrong_pct": 0.2819323072246477, + "val_biou": 0.42927202297126665, + "val_biou_gain": 0.04461263514041697, + "val_ce_loss": 0.0, + "val_critic_loss": 0.0, + "val_decoder_biou": 0.3846593878308497, + "val_decoder_dice": 0.770921132483555, + "val_decoder_iou": 0.6801783568719756, + "val_dice": 0.7900444501454517, + "val_dice_gain": 0.019123317661896677, + "val_dice_loss": 0.0, + "val_entropy": 0.0, + "val_iou": 0.7056593556976738, + "val_iou_gain": 0.02548099882569821, + "val_loss": -0.13763871516857762, + "val_refine_score": 0.5674656893344703, + "val_reward": 0.013763871516857762, + "validated_this_epoch": true + }, + { + "alpha": null, + "early_stopping_active": true, + "early_stopping_best_value": 0.56943207420596, + "early_stopping_improved": false, + "early_stopping_min_delta": 0.0, + "early_stopping_monitor_mode": "max", + "early_stopping_monitor_name": "val_refine_score", + "early_stopping_monitor_value": 0.5670083811957827, + "early_stopping_patience": 30, + "early_stopping_start_epoch": 30, + "early_stopping_wait": 2, + "encoder_lr": 0.0001294043713497476, + "epoch": 48, + "epoch_seconds": 12.2616434590891, + "grad_norm": 0.6025781468911604, + "lr": 0.0001294043713497476, + "selection_metric_name": "val_refine_score", + "selection_metric_value": 0.5670083811957827, + "strategy3_bootstrap_loaded": true, + "strategy3_decoder_state": "frozen", + "strategy3_encoder_state": "frozen", + "strategy3_freeze_active": true, + "strategy3_freeze_requested": true, + "strategy3_segmentation_head_state": "frozen", + "train_action_distribution": { + "max_abs_delta": 0.10009765625, + "mean_abs_delta": 0.030366446949880232, + "mean_delta": -0.01961319080807946, + "near_zero_pct": 2.532484496048875e-05, + "negative_pct": 91.14063009619713, + "positive_pct": 8.85934629900889 + }, + "train_actor_loss": -0.020288509811507538, + "train_advantage_mean": 0.0, + "train_advantage_std": 0.0, + "train_alpha": 0.0, + "train_annealed_aux_ce_weight": 0.040000000000000015, + "train_biou_delta_mean": 0.02028850991733965, + "train_ce_loss": 0.1656264534050768, + "train_critic_loss": 0.0, + "train_dice": 0.9060489620394981, + "train_dice_loss": 0.07574374567378651, + "train_effective_steps": 8.0, + "train_entropy": 0.0, + "train_entropy_bonus_used": 0.0, + "train_entropy_loss": 0.0, + "train_iou": 0.8388255833917896, + "train_loss": -0.19805768945000388, + "train_mask_delta_mean": 0.030364990234375, + "train_mean_reward": 0.020288509811507538, + "train_mean_value_pred": 0.0, + "train_reinforce_loss": 0.0, + "train_reward_zeros_pct": 0.3314394038170576, + "train_rl_loss_scale": 10.0, + "train_value_pred_error": 0.0, + "val_actor_loss": -0.01443658185962704, + "val_binary_flips_correct_pct": 0.348812926049326, + "val_binary_flips_total_pct": 0.5884095734240962, + "val_binary_flips_wrong_pct": 0.2395966473747702, + "val_biou": 0.4288530015909412, + "val_biou_gain": 0.04419361376009151, + "val_ce_loss": 0.0, + "val_critic_loss": 0.0, + "val_decoder_biou": 0.3846593878308497, + "val_decoder_dice": 0.770921132483555, + "val_decoder_iou": 0.6801783568719756, + "val_dice": 0.7887985723830976, + "val_dice_gain": 0.017877439899542602, + "val_dice_loss": 0.0, + "val_entropy": 0.0, + "val_iou": 0.705163760800624, + "val_iou_gain": 0.024985403928648453, + "val_loss": -0.1443658185962704, + "val_refine_score": 0.5670083811957827, + "val_reward": 0.01443658185962704, + "validated_this_epoch": true + }, + { + "alpha": null, + "early_stopping_active": true, + "early_stopping_best_value": 0.56943207420596, + "early_stopping_improved": false, + "early_stopping_min_delta": 0.0, + "early_stopping_monitor_mode": "max", + "early_stopping_monitor_name": "val_refine_score", + "early_stopping_monitor_value": 0.5670395330368161, + "early_stopping_patience": 30, + "early_stopping_start_epoch": 30, + "early_stopping_wait": 3, + "encoder_lr": 0.00012695190425229217, + "epoch": 49, + "epoch_seconds": 12.268973970320076, + "grad_norm": 0.7104395953091708, + "lr": 0.00012695190425229217, + "selection_metric_name": "val_refine_score", + "selection_metric_value": 0.5670395330368161, + "strategy3_bootstrap_loaded": true, + "strategy3_decoder_state": "frozen", + "strategy3_encoder_state": "frozen", + "strategy3_freeze_active": true, + "strategy3_freeze_requested": true, + "strategy3_segmentation_head_state": "frozen", + "train_action_distribution": { + "max_abs_delta": 0.10009765625, + "mean_abs_delta": 0.030840847725895317, + "mean_delta": -0.020120763939551332, + "near_zero_pct": 2.0229455799380958e-05, + "negative_pct": 91.24450981616974, + "positive_pct": 8.755472277037121 + }, + "train_actor_loss": -0.020135530113210818, + "train_advantage_mean": 0.0, + "train_advantage_std": 0.0, + "train_alpha": 0.0, + "train_annealed_aux_ce_weight": 0.040000000000000015, + "train_biou_delta_mean": 0.020135530028545127, + "train_ce_loss": 0.1789762330326167, + "train_critic_loss": 0.0, + "train_dice": 0.9006200925728545, + "train_dice_loss": 0.08042654666033658, + "train_effective_steps": 8.0, + "train_entropy": 0.0, + "train_entropy_bonus_used": 0.0, + "train_entropy_loss": 0.0, + "train_iou": 0.8345958697625009, + "train_loss": -0.19616725634444843, + "train_mask_delta_mean": 0.030831076882102272, + "train_mean_reward": 0.020135530113210818, + "train_mean_value_pred": 0.0, + "train_reinforce_loss": 0.0, + "train_reward_zeros_pct": 0.5918560782447457, + "train_rl_loss_scale": 10.0, + "train_value_pred_error": 0.0, + "val_actor_loss": -0.013908828630519565, + "val_binary_flips_correct_pct": 0.3567041135301777, + "val_binary_flips_total_pct": 0.6313959757486979, + "val_binary_flips_wrong_pct": 0.2746918622185202, + "val_biou": 0.4295489850470203, + "val_biou_gain": 0.04488959721617064, + "val_ce_loss": 0.0, + "val_critic_loss": 0.0, + "val_decoder_biou": 0.3846593878308497, + "val_decoder_dice": 0.770921132483555, + "val_decoder_iou": 0.6801783568719756, + "val_dice": 0.7887602768148485, + "val_dice_gain": 0.01783914433129352, + "val_dice_loss": 0.0, + "val_entropy": 0.0, + "val_iou": 0.7045300810266117, + "val_iou_gain": 0.024351724154636156, + "val_loss": -0.13908828630519565, + "val_refine_score": 0.5670395330368161, + "val_reward": 0.013908828630519565, + "validated_this_epoch": true + }, + { + "alpha": null, + "early_stopping_active": true, + "early_stopping_best_value": 0.56943207420596, + "early_stopping_improved": false, + "early_stopping_min_delta": 0.0, + "early_stopping_monitor_mode": "max", + "early_stopping_monitor_name": "val_refine_score", + "early_stopping_monitor_value": 0.5653711757506723, + "early_stopping_patience": 30, + "early_stopping_start_epoch": 30, + "early_stopping_wait": 4, + "encoder_lr": 0.00012448034351277498, + "epoch": 50, + "epoch_seconds": 12.281928262207657, + "grad_norm": 0.9051222150976007, + "lr": 0.00012448034351277498, + "selection_metric_name": "val_refine_score", + "selection_metric_value": 0.5653711757506723, + "strategy3_bootstrap_loaded": true, + "strategy3_decoder_state": "frozen", + "strategy3_encoder_state": "frozen", + "strategy3_freeze_active": true, + "strategy3_freeze_requested": true, + "strategy3_segmentation_head_state": "frozen", + "train_action_distribution": { + "max_abs_delta": 0.10009765625, + "mean_abs_delta": 0.033288796157152814, + "mean_delta": -0.021871388995681296, + "near_zero_pct": 2.311937805643538e-05, + "negative_pct": 91.37151004238562, + "positive_pct": 8.62846892665733 + }, + "train_actor_loss": -0.020277519925994882, + "train_advantage_mean": 0.0, + "train_advantage_std": 0.0, + "train_alpha": 0.0, + "train_annealed_aux_ce_weight": 0.040000000000000015, + "train_biou_delta_mean": 0.020277520010660573, + "train_ce_loss": 0.17067420008507642, + "train_critic_loss": 0.0, + "train_dice": 0.9011081670841364, + "train_dice_loss": 0.07912096652117642, + "train_effective_steps": 8.0, + "train_entropy": 0.0, + "train_entropy_bonus_used": 0.0, + "train_entropy_loss": 0.0, + "train_iou": 0.8339152867300627, + "train_loss": -0.19777929241007025, + "train_mask_delta_mean": 0.033289129083806816, + "train_mean_reward": 0.020277519925994882, + "train_mean_value_pred": 0.0, + "train_reinforce_loss": 0.0, + "train_reward_zeros_pct": 0.6155303213745356, + "train_rl_loss_scale": 10.0, + "train_value_pred_error": 0.0, + "val_actor_loss": -0.013934814480307978, + "val_binary_flips_correct_pct": 0.3483828376321232, + "val_binary_flips_total_pct": 0.6014842613070619, + "val_binary_flips_wrong_pct": 0.2531014236749387, + "val_biou": 0.42647083485714826, + "val_biou_gain": 0.041811447026298576, + "val_ce_loss": 0.0, + "val_critic_loss": 0.0, + "val_decoder_biou": 0.3846593878308497, + "val_decoder_dice": 0.770921132483555, + "val_decoder_iou": 0.6801783568719756, + "val_dice": 0.7880069986377066, + "val_dice_gain": 0.01708586615415164, + "val_dice_loss": 0.0, + "val_entropy": 0.0, + "val_iou": 0.7042715166441964, + "val_iou_gain": 0.024093159772220818, + "val_loss": -0.13934814480307978, + "val_refine_score": 0.5653711757506723, + "val_reward": 0.013934814480307978, + "validated_this_epoch": true + }, + { + "alpha": null, + "early_stopping_active": true, + "early_stopping_best_value": 0.56943207420596, + "early_stopping_improved": false, + "early_stopping_min_delta": 0.0, + "early_stopping_monitor_mode": "max", + "early_stopping_monitor_name": "val_refine_score", + "early_stopping_monitor_value": 0.5658646342493703, + "early_stopping_patience": 30, + "early_stopping_start_epoch": 30, + "early_stopping_wait": 5, + "encoder_lr": 0.00012199138301546971, + "epoch": 51, + "epoch_seconds": 12.293788008857518, + "grad_norm": 0.6756900278004733, + "lr": 0.00012199138301546971, + "selection_metric_name": "val_refine_score", + "selection_metric_value": 0.5658646342493703, + "strategy3_bootstrap_loaded": true, + "strategy3_decoder_state": "frozen", + "strategy3_encoder_state": "frozen", + "strategy3_freeze_active": true, + "strategy3_freeze_requested": true, + "strategy3_segmentation_head_state": "frozen", + "train_action_distribution": { + "max_abs_delta": 0.10009765625, + "mean_abs_delta": 0.03404978305016729, + "mean_delta": -0.023911949649283833, + "near_zero_pct": 5.201860011022125e-05, + "negative_pct": 91.1919083784927, + "positive_pct": 8.808041744950144 + }, + "train_actor_loss": -0.020763540639150466, + "train_advantage_mean": 0.0, + "train_advantage_std": 0.0, + "train_alpha": 0.0, + "train_annealed_aux_ce_weight": 0.040000000000000015, + "train_biou_delta_mean": 0.020763540554484775, + "train_ce_loss": 0.17645071175965396, + "train_critic_loss": 0.0, + "train_dice": 0.902183424218561, + "train_dice_loss": 0.07922086390581998, + "train_effective_steps": 8.0, + "train_entropy": 0.0, + "train_entropy_bonus_used": 0.0, + "train_entropy_loss": 0.0, + "train_iou": 0.8362514290691756, + "train_loss": -0.2025219676169482, + "train_mask_delta_mean": 0.03404513272372159, + "train_mean_reward": 0.020763540639150466, + "train_mean_value_pred": 0.0, + "train_reinforce_loss": 0.0, + "train_reward_zeros_pct": 0.6354665214365179, + "train_rl_loss_scale": 10.0, + "train_value_pred_error": 0.0, + "val_actor_loss": -0.013730792772548739, + "val_binary_flips_correct_pct": 0.3691205791398591, + "val_binary_flips_total_pct": 0.6569507075291054, + "val_binary_flips_wrong_pct": 0.2878301283892463, + "val_biou": 0.4261659377580866, + "val_biou_gain": 0.0415065499272369, + "val_ce_loss": 0.0, + "val_critic_loss": 0.0, + "val_decoder_biou": 0.3846593878308497, + "val_decoder_dice": 0.770921132483555, + "val_decoder_iou": 0.6801783568719756, + "val_dice": 0.7899403791918208, + "val_dice_gain": 0.019019246708265825, + "val_dice_loss": 0.0, + "val_entropy": 0.0, + "val_iou": 0.7055633307406539, + "val_iou_gain": 0.02538497386867833, + "val_loss": -0.1373079277254874, + "val_refine_score": 0.5658646342493703, + "val_reward": 0.013730792772548739, + "validated_this_epoch": true + }, + { + "alpha": null, + "early_stopping_active": true, + "early_stopping_best_value": 0.56943207420596, + "early_stopping_improved": false, + "early_stopping_min_delta": 0.0, + "early_stopping_monitor_mode": "max", + "early_stopping_monitor_name": "val_refine_score", + "early_stopping_monitor_value": 0.5636933069938107, + "early_stopping_patience": 30, + "early_stopping_start_epoch": 30, + "early_stopping_wait": 6, + "encoder_lr": 0.00011948672856957482, + "epoch": 52, + "epoch_seconds": 12.347352554090321, + "grad_norm": 0.9663110917264764, + "lr": 0.00011948672856957482, + "selection_metric_name": "val_refine_score", + "selection_metric_value": 0.5636933069938107, + "strategy3_bootstrap_loaded": true, + "strategy3_decoder_state": "frozen", + "strategy3_encoder_state": "frozen", + "strategy3_freeze_active": true, + "strategy3_freeze_requested": true, + "strategy3_segmentation_head_state": "frozen", + "train_action_distribution": { + "max_abs_delta": 0.10009765625, + "mean_abs_delta": 0.030621743147176774, + "mean_delta": -0.01908290678296577, + "near_zero_pct": 3.6884533988706444e-05, + "negative_pct": 91.26789170232686, + "positive_pct": 8.7320735339414 + }, + "train_actor_loss": -0.02054746516858524, + "train_advantage_mean": 0.0, + "train_advantage_std": 0.0, + "train_alpha": 0.0, + "train_annealed_aux_ce_weight": 0.040000000000000015, + "train_biou_delta_mean": 0.020547465337916616, + "train_ce_loss": 0.16707381335171786, + "train_critic_loss": 0.0, + "train_dice": 0.900658064535832, + "train_dice_loss": 0.07725749774412675, + "train_effective_steps": 8.0, + "train_entropy": 0.0, + "train_entropy_bonus_used": 0.0, + "train_entropy_loss": 0.0, + "train_iou": 0.8344729658622159, + "train_loss": -0.20058802312070673, + "train_mask_delta_mean": 0.030627163973721592, + "train_mean_reward": 0.02054746516858524, + "train_mean_value_pred": 0.0, + "train_reinforce_loss": 0.0, + "train_reward_zeros_pct": 0.6155303213745356, + "train_rl_loss_scale": 10.0, + "train_value_pred_error": 0.0, + "val_actor_loss": -0.013623238395666704, + "val_binary_flips_correct_pct": 0.3293355305989583, + "val_binary_flips_total_pct": 0.5767822265625, + "val_binary_flips_wrong_pct": 0.24744669596354169, + "val_biou": 0.4268275688254662, + "val_biou_gain": 0.0421681809946165, + "val_ce_loss": 0.0, + "val_critic_loss": 0.0, + "val_decoder_biou": 0.3846593878308497, + "val_decoder_dice": 0.770921132483555, + "val_decoder_iou": 0.6801783568719756, + "val_dice": 0.7846694381934407, + "val_dice_gain": 0.013748305709885722, + "val_dice_loss": 0.0, + "val_entropy": 0.0, + "val_iou": 0.7005590451621553, + "val_iou_gain": 0.020380688290179694, + "val_loss": -0.13623238395666704, + "val_refine_score": 0.5636933069938107, + "val_reward": 0.013623238395666704, + "validated_this_epoch": true + }, + { + "alpha": null, + "early_stopping_active": true, + "early_stopping_best_value": 0.56943207420596, + "early_stopping_improved": false, + "early_stopping_min_delta": 0.0, + "early_stopping_monitor_mode": "max", + "early_stopping_monitor_name": "val_refine_score", + "early_stopping_monitor_value": 0.5661023352345975, + "early_stopping_patience": 30, + "early_stopping_start_epoch": 30, + "early_stopping_wait": 7, + "encoder_lr": 0.00011696809674013731, + "epoch": 53, + "epoch_seconds": 12.293042928911746, + "grad_norm": 0.7165770855816928, + "lr": 0.00011696809674013731, + "selection_metric_name": "val_refine_score", + "selection_metric_value": 0.5661023352345975, + "strategy3_bootstrap_loaded": true, + "strategy3_decoder_state": "frozen", + "strategy3_encoder_state": "frozen", + "strategy3_freeze_active": true, + "strategy3_freeze_requested": true, + "strategy3_segmentation_head_state": "frozen", + "train_action_distribution": { + "max_abs_delta": 0.10009765625, + "mean_abs_delta": 0.030263280199671335, + "mean_delta": -0.020289031323045492, + "near_zero_pct": 2.6009300184300216e-05, + "negative_pct": 91.25747579065236, + "positive_pct": 8.742500740018757 + }, + "train_actor_loss": -0.02070840214913584, + "train_advantage_mean": 0.0, + "train_advantage_std": 0.0, + "train_alpha": 0.0, + "train_annealed_aux_ce_weight": 0.040000000000000015, + "train_biou_delta_mean": 0.020708402276134373, + "train_ce_loss": 0.1712302646853707, + "train_critic_loss": 0.0, + "train_dice": 0.903651291007001, + "train_dice_loss": 0.07755061171271584, + "train_effective_steps": 8.0, + "train_entropy": 0.0, + "train_entropy_bonus_used": 0.0, + "train_entropy_loss": 0.0, + "train_iou": 0.8366719571911134, + "train_loss": -0.20210839807987213, + "train_mask_delta_mean": 0.030260953036221592, + "train_mean_reward": 0.02070840214913584, + "train_mean_value_pred": 0.0, + "train_reinforce_loss": 0.0, + "train_reward_zeros_pct": 0.3077651606872678, + "train_rl_loss_scale": 10.0, + "train_value_pred_error": 0.0, + "val_actor_loss": -0.01368929621821735, + "val_binary_flips_correct_pct": 0.3810807770373774, + "val_binary_flips_total_pct": 0.684824176863128, + "val_binary_flips_wrong_pct": 0.3037433998257506, + "val_biou": 0.42709070138609345, + "val_biou_gain": 0.042431313555243766, + "val_ce_loss": 0.0, + "val_critic_loss": 0.0, + "val_decoder_biou": 0.3846593878308497, + "val_decoder_dice": 0.770921132483555, + "val_decoder_iou": 0.6801783568719756, + "val_dice": 0.7894441394554592, + "val_dice_gain": 0.018523006971904232, + "val_dice_loss": 0.0, + "val_entropy": 0.0, + "val_iou": 0.7051139690831015, + "val_iou_gain": 0.024935612211125946, + "val_loss": -0.1368929621821735, + "val_refine_score": 0.5661023352345975, + "val_reward": 0.01368929621821735, + "validated_this_epoch": true + }, + { + "alpha": null, + "early_stopping_active": true, + "early_stopping_best_value": 0.56943207420596, + "early_stopping_improved": false, + "early_stopping_min_delta": 0.0, + "early_stopping_monitor_mode": "max", + "early_stopping_monitor_name": "val_refine_score", + "early_stopping_monitor_value": 0.5656899297478438, + "early_stopping_patience": 30, + "early_stopping_start_epoch": 30, + "early_stopping_wait": 8, + "encoder_lr": 0.00011443721367160455, + "epoch": 54, + "epoch_seconds": 12.344333497341722, + "grad_norm": 0.8327629241076383, + "lr": 0.00011443721367160455, + "selection_metric_name": "val_refine_score", + "selection_metric_value": 0.5656899297478438, + "strategy3_bootstrap_loaded": true, + "strategy3_decoder_state": "frozen", + "strategy3_encoder_state": "frozen", + "strategy3_freeze_active": true, + "strategy3_freeze_requested": true, + "strategy3_segmentation_head_state": "frozen", + "train_action_distribution": { + "max_abs_delta": 0.10009765625, + "mean_abs_delta": 0.030571707693690605, + "mean_delta": -0.018670266451822085, + "near_zero_pct": 2.8899222570544225e-05, + "negative_pct": 91.23938090421937, + "positive_pct": 8.76059252768755 + }, + "train_actor_loss": -0.020606917192873716, + "train_advantage_mean": 0.0, + "train_advantage_std": 0.0, + "train_alpha": 0.0, + "train_annealed_aux_ce_weight": 0.040000000000000015, + "train_biou_delta_mean": 0.020606917108208025, + "train_ce_loss": 0.17325483601201663, + "train_critic_loss": 0.0, + "train_dice": 0.9021258553698241, + "train_dice_loss": 0.07921794869683006, + "train_effective_steps": 8.0, + "train_entropy": 0.0, + "train_entropy_bonus_used": 0.0, + "train_entropy_loss": 0.0, + "train_iou": 0.8353521435258686, + "train_loss": -0.20101971246979453, + "train_mask_delta_mean": 0.03057861328125, + "train_mean_reward": 0.020606917192873716, + "train_mean_value_pred": 0.0, + "train_reinforce_loss": 0.0, + "train_reward_zeros_pct": 0.3077651606872678, + "train_rl_loss_scale": 10.0, + "train_value_pred_error": 0.0, + "val_actor_loss": -0.013737825844145846, + "val_binary_flips_correct_pct": 0.3591163485657935, + "val_binary_flips_total_pct": 0.6082609588024663, + "val_binary_flips_wrong_pct": 0.24914461023667278, + "val_biou": 0.4264232825435323, + "val_biou_gain": 0.0417638947126826, + "val_ce_loss": 0.0, + "val_critic_loss": 0.0, + "val_decoder_biou": 0.3846593878308497, + "val_decoder_dice": 0.770921132483555, + "val_decoder_iou": 0.6801783568719756, + "val_dice": 0.7890950656070623, + "val_dice_gain": 0.018173933123507346, + "val_dice_loss": 0.0, + "val_entropy": 0.0, + "val_iou": 0.7049565769521554, + "val_iou_gain": 0.024778220080179825, + "val_loss": -0.13737825844145846, + "val_refine_score": 0.5656899297478438, + "val_reward": 0.013737825844145846, + "validated_this_epoch": true + }, + { + "alpha": null, + "early_stopping_active": true, + "early_stopping_best_value": 0.56943207420596, + "early_stopping_improved": false, + "early_stopping_min_delta": 0.0, + "early_stopping_monitor_mode": "max", + "early_stopping_monitor_name": "val_refine_score", + "early_stopping_monitor_value": 0.5678555418292288, + "early_stopping_patience": 30, + "early_stopping_start_epoch": 30, + "early_stopping_wait": 9, + "encoder_lr": 0.00011189581390481132, + "epoch": 55, + "epoch_seconds": 12.313811327330768, + "grad_norm": 0.7774119431322272, + "lr": 0.00011189581390481132, + "selection_metric_name": "val_refine_score", + "selection_metric_value": 0.5678555418292288, + "strategy3_bootstrap_loaded": true, + "strategy3_decoder_state": "frozen", + "strategy3_encoder_state": "frozen", + "strategy3_freeze_active": true, + "strategy3_freeze_requested": true, + "strategy3_segmentation_head_state": "frozen", + "train_action_distribution": { + "max_abs_delta": 0.10009765625, + "mean_abs_delta": 0.034622987838123336, + "mean_delta": -0.024147052233192055, + "near_zero_pct": 9.620399106841597e-05, + "negative_pct": 91.20805920525031, + "positive_pct": 8.791846959767016 + }, + "train_actor_loss": -0.020505256903230806, + "train_advantage_mean": 0.0, + "train_advantage_std": 0.0, + "train_alpha": 0.0, + "train_annealed_aux_ce_weight": 0.040000000000000015, + "train_biou_delta_mean": 0.020505256776232272, + "train_ce_loss": 0.17005317319523205, + "train_critic_loss": 0.0, + "train_dice": 0.9026074521251148, + "train_dice_loss": 0.07652167840437456, + "train_effective_steps": 8.0, + "train_entropy": 0.0, + "train_entropy_bonus_used": 0.0, + "train_entropy_loss": 0.0, + "train_iou": 0.8366543267318163, + "train_loss": -0.20012107897888531, + "train_mask_delta_mean": 0.034636064009232956, + "train_mean_reward": 0.020505256903230806, + "train_mean_value_pred": 0.0, + "train_reinforce_loss": 0.0, + "train_reward_zeros_pct": 0.4261363763362169, + "train_rl_loss_scale": 10.0, + "train_value_pred_error": 0.0, + "val_actor_loss": -0.01392466260222136, + "val_binary_flips_correct_pct": 0.38511238846124385, + "val_binary_flips_total_pct": 0.6669362386067709, + "val_binary_flips_wrong_pct": 0.281823850145527, + "val_biou": 0.4294240681959603, + "val_biou_gain": 0.04476468036511061, + "val_ce_loss": 0.0, + "val_critic_loss": 0.0, + "val_decoder_biou": 0.3846593878308497, + "val_decoder_dice": 0.770921132483555, + "val_decoder_iou": 0.6801783568719756, + "val_dice": 0.7907896076868385, + "val_dice_gain": 0.019868475203283498, + "val_dice_loss": 0.0, + "val_entropy": 0.0, + "val_iou": 0.7062870154624973, + "val_iou_gain": 0.026108658590521694, + "val_loss": -0.1392466260222136, + "val_refine_score": 0.5678555418292288, + "val_reward": 0.01392466260222136, + "validated_this_epoch": true + }, + { + "alpha": null, + "early_stopping_active": true, + "early_stopping_best_value": 0.56943207420596, + "early_stopping_improved": false, + "early_stopping_min_delta": 0.0, + "early_stopping_monitor_mode": "max", + "early_stopping_monitor_name": "val_refine_score", + "early_stopping_monitor_value": 0.5663183179922152, + "early_stopping_patience": 30, + "early_stopping_start_epoch": 30, + "early_stopping_wait": 10, + "encoder_lr": 0.00010934563918821202, + "epoch": 56, + "epoch_seconds": 12.326824580784887, + "grad_norm": 0.8744065111333673, + "lr": 0.00010934563918821202, + "selection_metric_name": "val_refine_score", + "selection_metric_value": 0.5663183179922152, + "strategy3_bootstrap_loaded": true, + "strategy3_decoder_state": "frozen", + "strategy3_encoder_state": "frozen", + "strategy3_freeze_active": true, + "strategy3_freeze_requested": true, + "strategy3_segmentation_head_state": "frozen", + "train_action_distribution": { + "max_abs_delta": 0.10009765625, + "mean_abs_delta": 0.04260300044817003, + "mean_delta": -0.03311451505446299, + "near_zero_pct": 0.00019765547033433575, + "negative_pct": 91.31562547250228, + "positive_pct": 8.684178674593568 + }, + "train_actor_loss": -0.02100214684800118, + "train_advantage_mean": 0.0, + "train_advantage_std": 0.0, + "train_alpha": 0.0, + "train_annealed_aux_ce_weight": 0.040000000000000015, + "train_biou_delta_mean": 0.02100214727132962, + "train_ce_loss": 0.16913528672673486, + "train_critic_loss": 0.0, + "train_dice": 0.9053409106783644, + "train_dice_loss": 0.07863075082952325, + "train_effective_steps": 8.0, + "train_entropy": 0.0, + "train_entropy_bonus_used": 0.0, + "train_entropy_loss": 0.0, + "train_iou": 0.8402761514797163, + "train_loss": -0.20506615394895727, + "train_mask_delta_mean": 0.04259144176136364, + "train_mean_reward": 0.02100214684800118, + "train_mean_value_pred": 0.0, + "train_reinforce_loss": 0.0, + "train_reward_zeros_pct": 0.4971591057255864, + "train_rl_loss_scale": 10.0, + "train_value_pred_error": 0.0, + "val_actor_loss": -0.014144904551358195, + "val_binary_flips_correct_pct": 0.3345152911017923, + "val_binary_flips_total_pct": 0.5961362053366268, + "val_binary_flips_wrong_pct": 0.2616209142348346, + "val_biou": 0.4296308041545358, + "val_biou_gain": 0.04497141632368612, + "val_ce_loss": 0.0, + "val_critic_loss": 0.0, + "val_decoder_biou": 0.3846593878308497, + "val_decoder_dice": 0.770921132483555, + "val_decoder_iou": 0.6801783568719756, + "val_dice": 0.7867413150269601, + "val_dice_gain": 0.015820182543405115, + "val_dice_loss": 0.0, + "val_entropy": 0.0, + "val_iou": 0.7030058318298946, + "val_iou_gain": 0.022827474957919036, + "val_loss": -0.14144904551358195, + "val_refine_score": 0.5663183179922152, + "val_reward": 0.014144904551358195, + "validated_this_epoch": true + }, + { + "alpha": null, + "early_stopping_active": true, + "early_stopping_best_value": 0.56943207420596, + "early_stopping_improved": false, + "early_stopping_min_delta": 0.0, + "early_stopping_monitor_mode": "max", + "early_stopping_monitor_name": "val_refine_score", + "early_stopping_monitor_value": 0.5681023230641223, + "early_stopping_patience": 30, + "early_stopping_start_epoch": 30, + "early_stopping_wait": 11, + "encoder_lr": 0.00010678843728417333, + "epoch": 57, + "epoch_seconds": 12.28714133426547, + "grad_norm": 0.6924729428508065, + "lr": 0.00010678843728417333, + "selection_metric_name": "val_refine_score", + "selection_metric_value": 0.5681023230641223, + "strategy3_bootstrap_loaded": true, + "strategy3_decoder_state": "frozen", + "strategy3_encoder_state": "frozen", + "strategy3_freeze_active": true, + "strategy3_freeze_requested": true, + "strategy3_segmentation_head_state": "frozen", + "train_action_distribution": { + "max_abs_delta": 0.10009765625, + "mean_abs_delta": 0.0343692001294006, + "mean_delta": -0.02369332178072496, + "near_zero_pct": 3.939420335799778e-05, + "negative_pct": 91.17500775239684, + "positive_pct": 8.824955197897824 + }, + "train_actor_loss": -0.020743891729084266, + "train_advantage_mean": 0.0, + "train_advantage_std": 0.0, + "train_alpha": 0.0, + "train_annealed_aux_ce_weight": 0.040000000000000015, + "train_biou_delta_mean": 0.020743891665585, + "train_ce_loss": 0.1737946312535893, + "train_critic_loss": 0.0, + "train_dice": 0.9054459273157287, + "train_dice_loss": 0.0780462460084395, + "train_effective_steps": 8.0, + "train_entropy": 0.0, + "train_entropy_bonus_used": 0.0, + "train_entropy_loss": 0.0, + "train_iou": 0.8398459037431618, + "train_loss": -0.2024020959030498, + "train_mask_delta_mean": 0.03438498757102273, + "train_mean_reward": 0.020743891729084266, + "train_mean_value_pred": 0.0, + "train_reinforce_loss": 0.0, + "train_reward_zeros_pct": 0.3314394038170576, + "train_rl_loss_scale": 10.0, + "train_value_pred_error": 0.0, + "val_actor_loss": -0.013716648252739105, + "val_binary_flips_correct_pct": 0.3765779383042279, + "val_binary_flips_total_pct": 0.6679273119159772, + "val_binary_flips_wrong_pct": 0.2913493736117494, + "val_biou": 0.43021528263201286, + "val_biou_gain": 0.04555589480116318, + "val_ce_loss": 0.0, + "val_critic_loss": 0.0, + "val_decoder_biou": 0.3846593878308497, + "val_decoder_dice": 0.770921132483555, + "val_decoder_iou": 0.6801783568719756, + "val_dice": 0.7904320997046705, + "val_dice_gain": 0.01951096722111556, + "val_dice_loss": 0.0, + "val_entropy": 0.0, + "val_iou": 0.7059893634962318, + "val_iou_gain": 0.025811006624256172, + "val_loss": -0.13716648252739105, + "val_refine_score": 0.5681023230641223, + "val_reward": 0.013716648252739105, + "validated_this_epoch": true + }, + { + "alpha": null, + "early_stopping_active": true, + "early_stopping_best_value": 0.56943207420596, + "early_stopping_improved": false, + "early_stopping_min_delta": 0.0, + "early_stopping_monitor_mode": "max", + "early_stopping_monitor_name": "val_refine_score", + "early_stopping_monitor_value": 0.5687824645956983, + "early_stopping_patience": 30, + "early_stopping_start_epoch": 30, + "early_stopping_wait": 12, + "encoder_lr": 0.00010422596077114516, + "epoch": 58, + "epoch_seconds": 12.285101741086692, + "grad_norm": 0.8040529868819497, + "lr": 0.00010422596077114516, + "selection_metric_name": "val_refine_score", + "selection_metric_value": 0.5687824645956983, + "strategy3_bootstrap_loaded": true, + "strategy3_decoder_state": "frozen", + "strategy3_encoder_state": "frozen", + "strategy3_freeze_active": true, + "strategy3_freeze_requested": true, + "strategy3_segmentation_head_state": "frozen", + "train_action_distribution": { + "max_abs_delta": 0.10009765625, + "mean_abs_delta": 0.033883300482888117, + "mean_delta": -0.022371482908387075, + "near_zero_pct": 2.6009300313489803e-05, + "negative_pct": 91.1750497465784, + "positive_pct": 8.82492625916546 + }, + "train_actor_loss": -0.020929902642489073, + "train_advantage_mean": 0.0, + "train_advantage_std": 0.0, + "train_alpha": 0.0, + "train_annealed_aux_ce_weight": 0.040000000000000015, + "train_biou_delta_mean": 0.02092990230382632, + "train_ce_loss": 0.1633132276209918, + "train_critic_loss": 0.0, + "train_dice": 0.9076351484319396, + "train_dice_loss": 0.07566072182221846, + "train_effective_steps": 8.0, + "train_entropy": 0.0, + "train_entropy_bonus_used": 0.0, + "train_entropy_loss": 0.0, + "train_iou": 0.8413212365840831, + "train_loss": -0.2045195441354405, + "train_mask_delta_mean": 0.03387035023082386, + "train_mean_reward": 0.020929902642489073, + "train_mean_value_pred": 0.0, + "train_reinforce_loss": 0.0, + "train_reward_zeros_pct": 0.1657197019085288, + "train_rl_loss_scale": 10.0, + "train_value_pred_error": 0.0, + "val_actor_loss": -0.014059655433811713, + "val_binary_flips_correct_pct": 0.36599402334175857, + "val_binary_flips_total_pct": 0.6849401137408089, + "val_binary_flips_wrong_pct": 0.3189460903990502, + "val_biou": 0.43279619008268955, + "val_biou_gain": 0.04813680225183986, + "val_ce_loss": 0.0, + "val_critic_loss": 0.0, + "val_decoder_biou": 0.3846593878308497, + "val_decoder_dice": 0.770921132483555, + "val_decoder_iou": 0.6801783568719756, + "val_dice": 0.7888129285159822, + "val_dice_gain": 0.017891796032427187, + "val_dice_loss": 0.0, + "val_entropy": 0.0, + "val_iou": 0.7047687391087069, + "val_iou_gain": 0.024590382236731267, + "val_loss": -0.14059655433811713, + "val_refine_score": 0.5687824645956983, + "val_reward": 0.014059655433811713, + "validated_this_epoch": true + }, + { + "alpha": null, + "early_stopping_active": true, + "early_stopping_best_value": 0.56943207420596, + "early_stopping_improved": false, + "early_stopping_min_delta": 0.0, + "early_stopping_monitor_mode": "max", + "early_stopping_monitor_name": "val_refine_score", + "early_stopping_monitor_value": 0.5635827959890375, + "early_stopping_patience": 30, + "early_stopping_start_epoch": 30, + "early_stopping_wait": 13, + "encoder_lr": 0.00010165996584253105, + "epoch": 59, + "epoch_seconds": 12.301317519042641, + "grad_norm": 0.7711435556411743, + "lr": 0.00010165996584253105, + "selection_metric_name": "val_refine_score", + "selection_metric_value": 0.5635827959890375, + "strategy3_bootstrap_loaded": true, + "strategy3_decoder_state": "frozen", + "strategy3_encoder_state": "frozen", + "strategy3_freeze_active": true, + "strategy3_freeze_requested": true, + "strategy3_segmentation_head_state": "frozen", + "train_action_distribution": { + "max_abs_delta": 0.10009765625, + "mean_abs_delta": 0.03359234214506366, + "mean_delta": -0.023171265715394507, + "near_zero_pct": 6.144887291528985e-05, + "negative_pct": 91.24956706708127, + "positive_pct": 8.750373582271012 + }, + "train_actor_loss": -0.021146720354656943, + "train_advantage_mean": 0.0, + "train_advantage_std": 0.0, + "train_alpha": 0.0, + "train_annealed_aux_ce_weight": 0.040000000000000015, + "train_biou_delta_mean": 0.021146720354656943, + "train_ce_loss": 0.17008998854593796, + "train_critic_loss": 0.0, + "train_dice": 0.8997315772784057, + "train_dice_loss": 0.0780480070547624, + "train_effective_steps": 8.0, + "train_entropy": 0.0, + "train_entropy_bonus_used": 0.0, + "train_entropy_loss": 0.0, + "train_iou": 0.8342993357251304, + "train_loss": -0.20650443841110577, + "train_mask_delta_mean": 0.03360817649147727, + "train_mean_reward": 0.021146720354656943, + "train_mean_value_pred": 0.0, + "train_reinforce_loss": 0.0, + "train_reward_zeros_pct": 0.3077651606872678, + "train_rl_loss_scale": 10.0, + "train_value_pred_error": 0.0, + "val_actor_loss": -0.013659877196005255, + "val_binary_flips_correct_pct": 0.3650328692267923, + "val_binary_flips_total_pct": 0.6747301887063419, + "val_binary_flips_wrong_pct": 0.30969731947954965, + "val_biou": 0.4238686025098861, + "val_biou_gain": 0.03920921467903643, + "val_ce_loss": 0.0, + "val_critic_loss": 0.0, + "val_decoder_biou": 0.3846593878308497, + "val_decoder_dice": 0.770921132483555, + "val_decoder_iou": 0.6801783568719756, + "val_dice": 0.7884915796401312, + "val_dice_gain": 0.017570447156576185, + "val_dice_loss": 0.0, + "val_entropy": 0.0, + "val_iou": 0.7032969894681889, + "val_iou_gain": 0.023118632596213273, + "val_loss": -0.13659877196005255, + "val_refine_score": 0.5635827959890375, + "val_reward": 0.013659877196005255, + "validated_this_epoch": true + }, + { + "alpha": null, + "early_stopping_active": true, + "early_stopping_best_value": 0.56943207420596, + "early_stopping_improved": false, + "early_stopping_min_delta": 0.0, + "early_stopping_monitor_mode": "max", + "early_stopping_monitor_name": "val_refine_score", + "early_stopping_monitor_value": 0.5680952971791573, + "early_stopping_patience": 30, + "early_stopping_start_epoch": 30, + "early_stopping_wait": 14, + "encoder_lr": 9.909221110308074e-05, + "epoch": 60, + "epoch_seconds": 12.327371406368911, + "grad_norm": 0.7051373611796986, + "lr": 9.909221110308074e-05, + "selection_metric_name": "val_refine_score", + "selection_metric_value": 0.5680952971791573, + "strategy3_bootstrap_loaded": true, + "strategy3_decoder_state": "frozen", + "strategy3_encoder_state": "frozen", + "strategy3_freeze_active": true, + "strategy3_freeze_requested": true, + "strategy3_segmentation_head_state": "frozen", + "train_action_distribution": { + "max_abs_delta": 0.10009765625, + "mean_abs_delta": 0.03970233088528568, + "mean_delta": -0.029626636554233053, + "near_zero_pct": 2.387988383196154e-05, + "negative_pct": 91.30928496068174, + "positive_pct": 8.690693297169425 + }, + "train_actor_loss": -0.021162050268189472, + "train_advantage_mean": 0.0, + "train_advantage_std": 0.0, + "train_alpha": 0.0, + "train_annealed_aux_ce_weight": 0.040000000000000015, + "train_biou_delta_mean": 0.021162050268189472, + "train_ce_loss": 0.17304070768031207, + "train_critic_loss": 0.0, + "train_dice": 0.9023527133695644, + "train_dice_loss": 0.07972650636326183, + "train_effective_steps": 8.0, + "train_entropy": 0.0, + "train_entropy_bonus_used": 0.0, + "train_entropy_loss": 0.0, + "train_iou": 0.8381257675289654, + "train_loss": -0.2065651552243666, + "train_mask_delta_mean": 0.03969504616477273, + "train_mean_reward": 0.021162050268189472, + "train_mean_value_pred": 0.0, + "train_reinforce_loss": 0.0, + "train_reward_zeros_pct": 0.7912181169641289, + "train_rl_loss_scale": 10.0, + "train_value_pred_error": 0.0, + "val_actor_loss": -0.014228242875105934, + "val_binary_flips_correct_pct": 0.3645466823203891, + "val_binary_flips_total_pct": 0.6253373389150582, + "val_binary_flips_wrong_pct": 0.2607906565946691, + "val_biou": 0.43115053677467974, + "val_biou_gain": 0.04649114894383005, + "val_ce_loss": 0.0, + "val_critic_loss": 0.0, + "val_decoder_biou": 0.3846593878308497, + "val_decoder_dice": 0.770921132483555, + "val_decoder_iou": 0.6801783568719756, + "val_dice": 0.7882466887122395, + "val_dice_gain": 0.01732555622868448, + "val_dice_loss": 0.0, + "val_entropy": 0.0, + "val_iou": 0.7050400575836349, + "val_iou_gain": 0.024861700711659274, + "val_loss": -0.14228242875105934, + "val_refine_score": 0.5680952971791573, + "val_reward": 0.014228242875105934, + "validated_this_epoch": true + }, + { + "alpha": null, + "early_stopping_active": true, + "early_stopping_best_value": 0.56943207420596, + "early_stopping_improved": false, + "early_stopping_min_delta": 0.0, + "early_stopping_monitor_mode": "max", + "early_stopping_monitor_name": "val_refine_score", + "early_stopping_monitor_value": 0.5624445914351754, + "early_stopping_patience": 30, + "early_stopping_start_epoch": 30, + "early_stopping_wait": 15, + "encoder_lr": 9.652445636363041e-05, + "epoch": 61, + "epoch_seconds": 12.283787592779845, + "grad_norm": 0.7786744399504228, + "lr": 9.652445636363041e-05, + "selection_metric_name": "val_refine_score", + "selection_metric_value": 0.5624445914351754, + "strategy3_bootstrap_loaded": true, + "strategy3_decoder_state": "frozen", + "strategy3_encoder_state": "frozen", + "strategy3_freeze_active": true, + "strategy3_freeze_requested": true, + "strategy3_segmentation_head_state": "frozen", + "train_action_distribution": { + "max_abs_delta": 0.10009765625, + "mean_abs_delta": 0.03315238853577863, + "mean_delta": -0.02090383640659804, + "near_zero_pct": 3.2169397715361726e-05, + "negative_pct": 91.14555581049486, + "positive_pct": 8.854414073919708 + }, + "train_actor_loss": -0.021108672206702813, + "train_advantage_mean": 0.0, + "train_advantage_std": 0.0, + "train_alpha": 0.0, + "train_annealed_aux_ce_weight": 0.040000000000000015, + "train_biou_delta_mean": 0.02110867237603419, + "train_ce_loss": 0.16849744319915771, + "train_critic_loss": 0.0, + "train_dice": 0.9043148469416995, + "train_dice_loss": 0.07826733047311957, + "train_effective_steps": 8.0, + "train_entropy": 0.0, + "train_entropy_bonus_used": 0.0, + "train_entropy_loss": 0.0, + "train_iou": 0.8399846116238898, + "train_loss": -0.20615142583847046, + "train_mask_delta_mean": 0.03314625133167614, + "train_mean_reward": 0.021108672206702813, + "train_mean_value_pred": 0.0, + "train_reinforce_loss": 0.0, + "train_reward_zeros_pct": 0.5407695489173586, + "train_rl_loss_scale": 10.0, + "train_value_pred_error": 0.0, + "val_actor_loss": -0.013234137877589092, + "val_binary_flips_correct_pct": 0.3612032123640472, + "val_binary_flips_total_pct": 0.6313398772594976, + "val_binary_flips_wrong_pct": 0.27013666489545035, + "val_biou": 0.42082448279846374, + "val_biou_gain": 0.03616509496761405, + "val_ce_loss": 0.0, + "val_critic_loss": 0.0, + "val_decoder_biou": 0.3846593878308497, + "val_decoder_dice": 0.770921132483555, + "val_decoder_iou": 0.6801783568719756, + "val_dice": 0.7889787017224223, + "val_dice_gain": 0.018057569238867366, + "val_dice_loss": 0.0, + "val_entropy": 0.0, + "val_iou": 0.7040647000718872, + "val_iou_gain": 0.023886343199911564, + "val_loss": -0.13234137877589092, + "val_refine_score": 0.5624445914351754, + "val_reward": 0.013234137877589092, + "validated_this_epoch": true + }, + { + "alpha": null, + "early_stopping_active": true, + "early_stopping_best_value": 0.56943207420596, + "early_stopping_improved": false, + "early_stopping_min_delta": 0.0, + "early_stopping_monitor_mode": "max", + "early_stopping_monitor_name": "val_refine_score", + "early_stopping_monitor_value": 0.566723834406682, + "early_stopping_patience": 30, + "early_stopping_start_epoch": 30, + "early_stopping_wait": 16, + "encoder_lr": 9.395846143501629e-05, + "epoch": 62, + "epoch_seconds": 12.336716633290052, + "grad_norm": 0.9446680491620844, + "lr": 9.395846143501629e-05, + "selection_metric_name": "val_refine_score", + "selection_metric_value": 0.566723834406682, + "strategy3_bootstrap_loaded": true, + "strategy3_decoder_state": "frozen", + "strategy3_encoder_state": "frozen", + "strategy3_freeze_active": true, + "strategy3_freeze_requested": true, + "strategy3_segmentation_head_state": "frozen", + "train_action_distribution": { + "max_abs_delta": 0.10009765625, + "mean_abs_delta": 0.03354023845696991, + "mean_delta": -0.02312987393022261, + "near_zero_pct": 0.00022617444027549607, + "negative_pct": 91.18629971688443, + "positive_pct": 8.813476164571263 + }, + "train_actor_loss": -0.021220194711614484, + "train_advantage_mean": 0.0, + "train_advantage_std": 0.0, + "train_alpha": 0.0, + "train_annealed_aux_ce_weight": 0.040000000000000015, + "train_biou_delta_mean": 0.021220194457617417, + "train_ce_loss": 0.1709953180768273, + "train_critic_loss": 0.0, + "train_dice": 0.9021749631836732, + "train_dice_loss": 0.07839538834311745, + "train_effective_steps": 8.0, + "train_entropy": 0.0, + "train_entropy_bonus_used": 0.0, + "train_entropy_loss": 0.0, + "train_iou": 0.8368082409717986, + "train_loss": -0.20721413736993616, + "train_mask_delta_mean": 0.033544367009943184, + "train_mean_reward": 0.021220194711614484, + "train_mean_value_pred": 0.0, + "train_reinforce_loss": 0.0, + "train_reward_zeros_pct": 0.5681818351149559, + "train_rl_loss_scale": 10.0, + "train_value_pred_error": 0.0, + "val_actor_loss": -0.01373226432770025, + "val_binary_flips_correct_pct": 0.3716150919596354, + "val_binary_flips_total_pct": 0.6755828857421875, + "val_binary_flips_wrong_pct": 0.30396779378255206, + "val_biou": 0.4288250111717326, + "val_biou_gain": 0.04416562334088292, + "val_ce_loss": 0.0, + "val_critic_loss": 0.0, + "val_decoder_biou": 0.3846593878308497, + "val_decoder_dice": 0.770921132483555, + "val_decoder_iou": 0.6801783568719756, + "val_dice": 0.7889656279968301, + "val_dice_gain": 0.01804449551327514, + "val_dice_loss": 0.0, + "val_entropy": 0.0, + "val_iou": 0.7046226576416312, + "val_iou_gain": 0.024444300769655647, + "val_loss": -0.1373226432770025, + "val_refine_score": 0.566723834406682, + "val_reward": 0.01373226432770025, + "validated_this_epoch": true + }, + { + "alpha": null, + "early_stopping_active": true, + "early_stopping_best_value": 0.56943207420596, + "early_stopping_improved": false, + "early_stopping_min_delta": 0.0, + "early_stopping_monitor_mode": "max", + "early_stopping_monitor_name": "val_refine_score", + "early_stopping_monitor_value": 0.5660611464826922, + "early_stopping_patience": 30, + "early_stopping_start_epoch": 30, + "early_stopping_wait": 17, + "encoder_lr": 9.139598492198814e-05, + "epoch": 63, + "epoch_seconds": 12.319774720817804, + "grad_norm": 0.8528961376710371, + "lr": 9.139598492198814e-05, + "selection_metric_name": "val_refine_score", + "selection_metric_value": 0.5660611464826922, + "strategy3_bootstrap_loaded": true, + "strategy3_decoder_state": "frozen", + "strategy3_encoder_state": "frozen", + "strategy3_freeze_active": true, + "strategy3_freeze_requested": true, + "strategy3_segmentation_head_state": "frozen", + "train_action_distribution": { + "max_abs_delta": 0.10009765625, + "mean_abs_delta": 0.03728447367691181, + "mean_delta": -0.027253838086670094, + "near_zero_pct": 3.612402821318028e-05, + "negative_pct": 91.2347362800078, + "positive_pct": 8.765230039981278 + }, + "train_actor_loss": -0.021784224891400136, + "train_advantage_mean": 0.0, + "train_advantage_std": 0.0, + "train_alpha": 0.0, + "train_annealed_aux_ce_weight": 0.040000000000000015, + "train_biou_delta_mean": 0.021784224891400136, + "train_ce_loss": 0.16650009764866394, + "train_critic_loss": 0.0, + "train_dice": 0.9041343242568719, + "train_dice_loss": 0.07636463642120361, + "train_effective_steps": 8.0, + "train_entropy": 0.0, + "train_entropy_bonus_used": 0.0, + "train_entropy_loss": 0.0, + "train_iou": 0.8394491580295607, + "train_loss": -0.212984943931753, + "train_mask_delta_mean": 0.03729248046875, + "train_mean_reward": 0.021784224891400136, + "train_mean_value_pred": 0.0, + "train_reinforce_loss": 0.0, + "train_reward_zeros_pct": 0.5918560782447457, + "train_rl_loss_scale": 10.0, + "train_value_pred_error": 0.0, + "val_actor_loss": -0.013903477429266786, + "val_binary_flips_correct_pct": 0.3546733482211244, + "val_binary_flips_total_pct": 0.665436538995481, + "val_binary_flips_wrong_pct": 0.3107631907743566, + "val_biou": 0.42932398274141564, + "val_biou_gain": 0.04466459491056596, + "val_ce_loss": 0.0, + "val_critic_loss": 0.0, + "val_decoder_biou": 0.3846593878308497, + "val_decoder_dice": 0.770921132483555, + "val_decoder_iou": 0.6801783568719756, + "val_dice": 0.7871156843387758, + "val_dice_gain": 0.016194551855220785, + "val_dice_loss": 0.0, + "val_entropy": 0.0, + "val_iou": 0.7027983102239689, + "val_iou_gain": 0.022619953351993294, + "val_loss": -0.13903477429266786, + "val_refine_score": 0.5660611464826922, + "val_reward": 0.013903477429266786, + "validated_this_epoch": true + }, + { + "alpha": null, + "early_stopping_active": true, + "early_stopping_best_value": 0.56943207420596, + "early_stopping_improved": false, + "early_stopping_min_delta": 0.0, + "early_stopping_monitor_mode": "max", + "early_stopping_monitor_name": "val_refine_score", + "early_stopping_monitor_value": 0.5679956130616611, + "early_stopping_patience": 30, + "early_stopping_start_epoch": 30, + "early_stopping_wait": 18, + "encoder_lr": 8.883878301794945e-05, + "epoch": 64, + "epoch_seconds": 12.348818860016763, + "grad_norm": 0.9602558396079324, + "lr": 8.883878301794945e-05, + "selection_metric_name": "val_refine_score", + "selection_metric_value": 0.5679956130616611, + "strategy3_bootstrap_loaded": true, + "strategy3_decoder_state": "frozen", + "strategy3_encoder_state": "frozen", + "strategy3_freeze_active": true, + "strategy3_freeze_requested": true, + "strategy3_segmentation_head_state": "frozen", + "train_action_distribution": { + "max_abs_delta": 0.10009765625, + "mean_abs_delta": 0.03541757818311453, + "mean_delta": -0.025449738520282237, + "near_zero_pct": 3.8405545410569175e-05, + "negative_pct": 91.22686250643297, + "positive_pct": 8.773101476783102 + }, + "train_actor_loss": -0.021466973454649138, + "train_advantage_mean": 0.0, + "train_advantage_std": 0.0, + "train_alpha": 0.0, + "train_annealed_aux_ce_weight": 0.040000000000000015, + "train_biou_delta_mean": 0.02146697358164767, + "train_ce_loss": 0.1676497825167396, + "train_critic_loss": 0.0, + "train_dice": 0.9045075859657966, + "train_dice_loss": 0.07720194079659203, + "train_effective_steps": 8.0, + "train_entropy": 0.0, + "train_entropy_bonus_used": 0.0, + "train_entropy_loss": 0.0, + "train_iou": 0.8398427858214386, + "train_loss": -0.2097727046771483, + "train_mask_delta_mean": 0.03541981090198864, + "train_mean_reward": 0.021466973454649138, + "train_mean_value_pred": 0.0, + "train_reinforce_loss": 0.0, + "train_reward_zeros_pct": 0.14204545877873898, + "train_rl_loss_scale": 10.0, + "train_value_pred_error": 0.0, + "val_actor_loss": -0.01373967432664358, + "val_binary_flips_correct_pct": 0.3857145122453278, + "val_binary_flips_total_pct": 0.7086660347732843, + "val_binary_flips_wrong_pct": 0.32295152252795645, + "val_biou": 0.43051810798106993, + "val_biou_gain": 0.045858720150220245, + "val_ce_loss": 0.0, + "val_critic_loss": 0.0, + "val_decoder_biou": 0.3846593878308497, + "val_decoder_dice": 0.770921132483555, + "val_decoder_iou": 0.6801783568719756, + "val_dice": 0.7898631688881796, + "val_dice_gain": 0.018942036404624663, + "val_dice_loss": 0.0, + "val_entropy": 0.0, + "val_iou": 0.7054731181422523, + "val_iou_gain": 0.025294761270276744, + "val_loss": -0.1373967432664358, + "val_refine_score": 0.5679956130616611, + "val_reward": 0.01373967432664358, + "validated_this_epoch": true + }, + { + "alpha": null, + "early_stopping_active": true, + "early_stopping_best_value": 0.56943207420596, + "early_stopping_improved": false, + "early_stopping_min_delta": 0.0, + "early_stopping_monitor_mode": "max", + "early_stopping_monitor_name": "val_refine_score", + "early_stopping_monitor_value": 0.5670528655073623, + "early_stopping_patience": 30, + "early_stopping_start_epoch": 30, + "early_stopping_wait": 19, + "encoder_lr": 8.628860830135015e-05, + "epoch": 65, + "epoch_seconds": 12.333469644188881, + "grad_norm": 0.8319580284031954, + "lr": 8.628860830135015e-05, + "selection_metric_name": "val_refine_score", + "selection_metric_value": 0.5670528655073623, + "strategy3_bootstrap_loaded": true, + "strategy3_decoder_state": "frozen", + "strategy3_encoder_state": "frozen", + "strategy3_freeze_active": true, + "strategy3_freeze_requested": true, + "strategy3_segmentation_head_state": "frozen", + "train_action_distribution": { + "max_abs_delta": 0.10009765625, + "mean_abs_delta": 0.03390689374117011, + "mean_delta": -0.023577562088824132, + "near_zero_pct": 6.39585422845812e-05, + "negative_pct": 91.10321632840417, + "positive_pct": 8.896722009574825 + }, + "train_actor_loss": -0.021799708454636857, + "train_advantage_mean": 0.0, + "train_advantage_std": 0.0, + "train_alpha": 0.0, + "train_annealed_aux_ce_weight": 0.040000000000000015, + "train_biou_delta_mean": 0.021799708454636857, + "train_ce_loss": 0.1628556102514267, + "train_critic_loss": 0.0, + "train_dice": 0.9064649725658106, + "train_dice_loss": 0.07443638823249123, + "train_effective_steps": 8.0, + "train_entropy": 0.0, + "train_entropy_bonus_used": 0.0, + "train_entropy_loss": 0.0, + "train_iou": 0.8421374328425304, + "train_loss": -0.21325124664740128, + "train_mask_delta_mean": 0.03390086780894886, + "train_mean_reward": 0.021799708454636857, + "train_mean_value_pred": 0.0, + "train_reinforce_loss": 0.0, + "train_reward_zeros_pct": 0.3077651606872678, + "train_rl_loss_scale": 10.0, + "train_value_pred_error": 0.0, + "val_actor_loss": -0.013776822914223885, + "val_binary_flips_correct_pct": 0.3765592388078278, + "val_binary_flips_total_pct": 0.6915485157686121, + "val_binary_flips_wrong_pct": 0.3149892769607843, + "val_biou": 0.43034495842800435, + "val_biou_gain": 0.04568557059715467, + "val_ce_loss": 0.0, + "val_critic_loss": 0.0, + "val_decoder_biou": 0.3846593878308497, + "val_decoder_dice": 0.770921132483555, + "val_decoder_iou": 0.6801783568719756, + "val_dice": 0.7877484618915307, + "val_dice_gain": 0.01682732940797571, + "val_dice_loss": 0.0, + "val_entropy": 0.0, + "val_iou": 0.7037607725867204, + "val_iou_gain": 0.023582415714744842, + "val_loss": -0.13776822914223885, + "val_refine_score": 0.5670528655073623, + "val_reward": 0.013776822914223885, + "validated_this_epoch": true + }, + { + "alpha": null, + "early_stopping_active": true, + "early_stopping_best_value": 0.56943207420596, + "early_stopping_improved": false, + "early_stopping_min_delta": 0.0, + "early_stopping_monitor_mode": "max", + "early_stopping_monitor_name": "val_refine_score", + "early_stopping_monitor_value": 0.5659862293160036, + "early_stopping_patience": 30, + "early_stopping_start_epoch": 30, + "early_stopping_wait": 20, + "encoder_lr": 8.374720853455689e-05, + "epoch": 66, + "epoch_seconds": 12.310319716110826, + "grad_norm": 0.8083229498429731, + "lr": 8.374720853455689e-05, + "selection_metric_name": "val_refine_score", + "selection_metric_value": 0.5659862293160036, + "strategy3_bootstrap_loaded": true, + "strategy3_decoder_state": "frozen", + "strategy3_encoder_state": "frozen", + "strategy3_freeze_active": true, + "strategy3_freeze_requested": true, + "strategy3_segmentation_head_state": "frozen", + "train_action_distribution": { + "max_abs_delta": 0.10009765625, + "mean_abs_delta": 0.03522591284391555, + "mean_delta": -0.023633699229156428, + "near_zero_pct": 2.349963094419846e-05, + "negative_pct": 91.18560268120332, + "positive_pct": 8.814375686713241 + }, + "train_actor_loss": -0.021732515541688455, + "train_advantage_mean": 0.0, + "train_advantage_std": 0.0, + "train_alpha": 0.0, + "train_annealed_aux_ce_weight": 0.040000000000000015, + "train_biou_delta_mean": 0.021732515457022764, + "train_ce_loss": 0.16202239963141354, + "train_critic_loss": 0.0, + "train_dice": 0.9058198303396175, + "train_dice_loss": 0.07496993108229204, + "train_effective_steps": 8.0, + "train_entropy": 0.0, + "train_entropy_bonus_used": 0.0, + "train_entropy_loss": 0.0, + "train_iou": 0.8416566122634529, + "train_loss": -0.21258531510829926, + "train_mask_delta_mean": 0.03522838245738636, + "train_mean_reward": 0.021732515541688455, + "train_mean_value_pred": 0.0, + "train_reinforce_loss": 0.0, + "train_reward_zeros_pct": 0.3314394038170576, + "train_rl_loss_scale": 10.0, + "train_value_pred_error": 0.0, + "val_actor_loss": -0.01398176411021268, + "val_binary_flips_correct_pct": 0.3455479939778646, + "val_binary_flips_total_pct": 0.6291370765835631, + "val_binary_flips_wrong_pct": 0.28358908260569854, + "val_biou": 0.42849154233892633, + "val_biou_gain": 0.04383215450807665, + "val_ce_loss": 0.0, + "val_critic_loss": 0.0, + "val_decoder_biou": 0.3846593878308497, + "val_decoder_dice": 0.770921132483555, + "val_decoder_iou": 0.6801783568719756, + "val_dice": 0.7872879224275176, + "val_dice_gain": 0.016366789943962567, + "val_dice_loss": 0.0, + "val_entropy": 0.0, + "val_iou": 0.7034809162930808, + "val_iou_gain": 0.023302559421105262, + "val_loss": -0.1398176411021268, + "val_refine_score": 0.5659862293160036, + "val_reward": 0.01398176411021268, + "validated_this_epoch": true + }, + { + "alpha": null, + "early_stopping_active": true, + "early_stopping_best_value": 0.56943207420596, + "early_stopping_improved": false, + "early_stopping_min_delta": 0.0, + "early_stopping_monitor_mode": "max", + "early_stopping_monitor_name": "val_refine_score", + "early_stopping_monitor_value": 0.5688242392196584, + "early_stopping_patience": 30, + "early_stopping_start_epoch": 30, + "early_stopping_wait": 21, + "encoder_lr": 8.121632546602416e-05, + "epoch": 67, + "epoch_seconds": 12.29745077714324, + "grad_norm": 0.9017388603904031, + "lr": 8.121632546602416e-05, + "selection_metric_name": "val_refine_score", + "selection_metric_value": 0.5688242392196584, + "strategy3_bootstrap_loaded": true, + "strategy3_decoder_state": "frozen", + "strategy3_encoder_state": "frozen", + "strategy3_freeze_active": true, + "strategy3_freeze_requested": true, + "strategy3_segmentation_head_state": "frozen", + "train_action_distribution": { + "max_abs_delta": 0.10009765625, + "mean_abs_delta": 0.034320051527836105, + "mean_delta": -0.023700781124220652, + "near_zero_pct": 5.490852275484444e-05, + "negative_pct": 91.17947545918551, + "positive_pct": 8.820472395216877 + }, + "train_actor_loss": -0.021662000877602786, + "train_advantage_mean": 0.0, + "train_advantage_std": 0.0, + "train_alpha": 0.0, + "train_annealed_aux_ce_weight": 0.040000000000000015, + "train_biou_delta_mean": 0.02166200070827141, + "train_ce_loss": 0.16093275899236853, + "train_critic_loss": 0.0, + "train_dice": 0.9058451888485081, + "train_dice_loss": 0.07509140534834428, + "train_effective_steps": 8.0, + "train_entropy": 0.0, + "train_entropy_bonus_used": 0.0, + "train_entropy_loss": 0.0, + "train_iou": 0.842166223876012, + "train_loss": -0.21189953251318497, + "train_mask_delta_mean": 0.03432117808948864, + "train_mean_reward": 0.021662000877602786, + "train_mean_value_pred": 0.0, + "train_reinforce_loss": 0.0, + "train_reward_zeros_pct": 0.8049242664128542, + "train_rl_loss_scale": 10.0, + "train_value_pred_error": 0.0, + "val_actor_loss": -0.01436832712352043, + "val_binary_flips_correct_pct": 0.36286746754365806, + "val_binary_flips_total_pct": 0.6275177001953125, + "val_binary_flips_wrong_pct": 0.26465023265165444, + "val_biou": 0.43190262628207554, + "val_biou_gain": 0.047243238451225855, + "val_ce_loss": 0.0, + "val_critic_loss": 0.0, + "val_decoder_biou": 0.3846593878308497, + "val_decoder_dice": 0.770921132483555, + "val_decoder_iou": 0.6801783568719756, + "val_dice": 0.7892180424387608, + "val_dice_gain": 0.01829690995520583, + "val_dice_loss": 0.0, + "val_entropy": 0.0, + "val_iou": 0.7057458521572413, + "val_iou_gain": 0.025567495285265696, + "val_loss": -0.1436832712352043, + "val_refine_score": 0.5688242392196584, + "val_reward": 0.01436832712352043, + "validated_this_epoch": true + }, + { + "alpha": null, + "early_stopping_active": true, + "early_stopping_best_value": 0.56943207420596, + "early_stopping_improved": false, + "early_stopping_min_delta": 0.0, + "early_stopping_monitor_mode": "max", + "early_stopping_monitor_name": "val_refine_score", + "early_stopping_monitor_value": 0.5674885592658321, + "early_stopping_patience": 30, + "early_stopping_start_epoch": 30, + "early_stopping_wait": 22, + "encoder_lr": 7.869769363658661e-05, + "epoch": 68, + "epoch_seconds": 12.334626875817776, + "grad_norm": 0.8582201816818931, + "lr": 7.869769363658661e-05, + "selection_metric_name": "val_refine_score", + "selection_metric_value": 0.5674885592658321, + "strategy3_bootstrap_loaded": true, + "strategy3_decoder_state": "frozen", + "strategy3_encoder_state": "frozen", + "strategy3_freeze_active": true, + "strategy3_freeze_requested": true, + "strategy3_segmentation_head_state": "frozen", + "train_action_distribution": { + "max_abs_delta": 0.10009765625, + "mean_abs_delta": 0.031091910554096103, + "mean_delta": -0.019581409742717038, + "near_zero_pct": 2.6769806089015962e-05, + "negative_pct": 91.19823067025705, + "positive_pct": 8.801744531162761 + }, + "train_actor_loss": -0.022188941194062037, + "train_advantage_mean": 0.0, + "train_advantage_std": 0.0, + "train_alpha": 0.0, + "train_annealed_aux_ce_weight": 0.040000000000000015, + "train_biou_delta_mean": 0.02218894161739048, + "train_ce_loss": 0.15863656184890054, + "train_critic_loss": 0.0, + "train_dice": 0.908441679402571, + "train_dice_loss": 0.07304707440462979, + "train_effective_steps": 8.0, + "train_entropy": 0.0, + "train_entropy_bonus_used": 0.0, + "train_entropy_loss": 0.0, + "train_iou": 0.8460236467204909, + "train_loss": -0.21725573593919928, + "train_mask_delta_mean": 0.031096024946732956, + "train_mean_reward": 0.022188941194062037, + "train_mean_value_pred": 0.0, + "train_reinforce_loss": 0.0, + "train_reward_zeros_pct": 0.5208333488553762, + "train_rl_loss_scale": 10.0, + "train_value_pred_error": 0.0, + "val_actor_loss": -0.014145033586828504, + "val_binary_flips_correct_pct": 0.3773408777573529, + "val_binary_flips_total_pct": 0.6694307514265472, + "val_binary_flips_wrong_pct": 0.29208987366919426, + "val_biou": 0.4310462858936136, + "val_biou_gain": 0.046386898062763915, + "val_ce_loss": 0.0, + "val_critic_loss": 0.0, + "val_decoder_biou": 0.3846593878308497, + "val_decoder_dice": 0.770921132483555, + "val_decoder_iou": 0.6801783568719756, + "val_dice": 0.7877724867232466, + "val_dice_gain": 0.01685135423969164, + "val_dice_loss": 0.0, + "val_entropy": 0.0, + "val_iou": 0.7039308326380507, + "val_iou_gain": 0.023752475766075087, + "val_loss": -0.14145033586828504, + "val_refine_score": 0.5674885592658321, + "val_reward": 0.014145033586828504, + "validated_this_epoch": true + }, + { + "alpha": null, + "early_stopping_active": true, + "early_stopping_best_value": 0.56943207420596, + "early_stopping_improved": false, + "early_stopping_min_delta": 0.0, + "early_stopping_monitor_mode": "max", + "early_stopping_monitor_name": "val_refine_score", + "early_stopping_monitor_value": 0.568106234662512, + "early_stopping_patience": 30, + "early_stopping_start_epoch": 30, + "early_stopping_wait": 23, + "encoder_lr": 7.619303919069176e-05, + "epoch": 69, + "epoch_seconds": 12.314328367356211, + "grad_norm": 0.9609075459566984, + "lr": 7.619303919069176e-05, + "selection_metric_name": "val_refine_score", + "selection_metric_value": 0.568106234662512, + "strategy3_bootstrap_loaded": true, + "strategy3_decoder_state": "frozen", + "strategy3_encoder_state": "frozen", + "strategy3_freeze_active": true, + "strategy3_freeze_requested": true, + "strategy3_segmentation_head_state": "frozen", + "train_action_distribution": { + "max_abs_delta": 0.10009765625, + "mean_abs_delta": 0.03419448005628179, + "mean_delta": -0.023100159215656193, + "near_zero_pct": 2.349963094419846e-05, + "negative_pct": 91.29137437451969, + "positive_pct": 8.708604247393934 + }, + "train_actor_loss": -0.02214826628518164, + "train_advantage_mean": 0.0, + "train_advantage_std": 0.0, + "train_alpha": 0.0, + "train_annealed_aux_ce_weight": 0.040000000000000015, + "train_biou_delta_mean": 0.022148266348680903, + "train_ce_loss": 0.16437026181004263, + "train_critic_loss": 0.0, + "train_dice": 0.9067085915914507, + "train_dice_loss": 0.07696169072931464, + "train_effective_steps": 8.0, + "train_entropy": 0.0, + "train_entropy_bonus_used": 0.0, + "train_entropy_loss": 0.0, + "train_iou": 0.8442302170598501, + "train_loss": -0.21665602245114066, + "train_mask_delta_mean": 0.034189397638494316, + "train_mean_reward": 0.02214826628518164, + "train_mean_value_pred": 0.0, + "train_reinforce_loss": 0.0, + "train_reward_zeros_pct": 0.6628788076341152, + "train_rl_loss_scale": 10.0, + "train_value_pred_error": 0.0, + "val_actor_loss": -0.014223635283997282, + "val_binary_flips_correct_pct": 0.3763311049517463, + "val_binary_flips_total_pct": 0.6726769840016085, + "val_binary_flips_wrong_pct": 0.29634587904986215, + "val_biou": 0.43173518560636603, + "val_biou_gain": 0.04707579777551635, + "val_ce_loss": 0.0, + "val_critic_loss": 0.0, + "val_decoder_biou": 0.3846593878308497, + "val_decoder_dice": 0.770921132483555, + "val_decoder_iou": 0.6801783568719756, + "val_dice": 0.7882403512575796, + "val_dice_gain": 0.017319218774024647, + "val_dice_loss": 0.0, + "val_entropy": 0.0, + "val_iou": 0.7044772837186579, + "val_iou_gain": 0.024298926846682334, + "val_loss": -0.14223635283997282, + "val_refine_score": 0.568106234662512, + "val_reward": 0.014223635283997282, + "validated_this_epoch": true + }, + { + "alpha": null, + "early_stopping_active": true, + "early_stopping_best_value": 0.56943207420596, + "early_stopping_improved": false, + "early_stopping_min_delta": 0.0, + "early_stopping_monitor_mode": "max", + "early_stopping_monitor_name": "val_refine_score", + "early_stopping_monitor_value": 0.5682925434932107, + "early_stopping_patience": 30, + "early_stopping_start_epoch": 30, + "early_stopping_wait": 24, + "encoder_lr": 7.370407869338648e-05, + "epoch": 70, + "epoch_seconds": 12.372864083852619, + "grad_norm": 0.9153522144664418, + "lr": 7.370407869338648e-05, + "selection_metric_name": "val_refine_score", + "selection_metric_value": 0.5682925434932107, + "strategy3_bootstrap_loaded": true, + "strategy3_decoder_state": "frozen", + "strategy3_encoder_state": "frozen", + "strategy3_freeze_active": true, + "strategy3_freeze_requested": true, + "strategy3_segmentation_head_state": "frozen", + "train_action_distribution": { + "max_abs_delta": 0.10009765625, + "mean_abs_delta": 0.03428477781232108, + "mean_delta": -0.022624551741914314, + "near_zero_pct": 6.791317278239975e-05, + "negative_pct": 91.04901227084073, + "positive_pct": 8.950921791520985 + }, + "train_actor_loss": -0.021955761168183843, + "train_advantage_mean": 0.0, + "train_advantage_std": 0.0, + "train_alpha": 0.0, + "train_annealed_aux_ce_weight": 0.040000000000000015, + "train_biou_delta_mean": 0.021955761549179442, + "train_ce_loss": 0.1610469635237347, + "train_critic_loss": 0.0, + "train_dice": 0.9072664517050997, + "train_dice_loss": 0.07419354807246815, + "train_effective_steps": 8.0, + "train_entropy": 0.0, + "train_entropy_bonus_used": 0.0, + "train_entropy_loss": 0.0, + "train_iou": 0.8434534465014236, + "train_loss": -0.21485280177809976, + "train_mask_delta_mean": 0.03428927334872159, + "train_mean_reward": 0.021955761168183843, + "train_mean_value_pred": 0.0, + "train_reinforce_loss": 0.0, + "train_reward_zeros_pct": 0.4734848625957966, + "train_rl_loss_scale": 10.0, + "train_value_pred_error": 0.0, + "val_actor_loss": -0.014200159494066611, + "val_binary_flips_correct_pct": 0.3801757214116115, + "val_binary_flips_total_pct": 0.692135679955576, + "val_binary_flips_wrong_pct": 0.3119599585439645, + "val_biou": 0.43025845125880297, + "val_biou_gain": 0.04559906342795328, + "val_ce_loss": 0.0, + "val_critic_loss": 0.0, + "val_decoder_biou": 0.3846593878308497, + "val_decoder_dice": 0.770921132483555, + "val_decoder_iou": 0.6801783568719756, + "val_dice": 0.7899750657678679, + "val_dice_gain": 0.01905393328431293, + "val_dice_loss": 0.0, + "val_entropy": 0.0, + "val_iou": 0.7063266357276184, + "val_iou_gain": 0.02614827885564286, + "val_loss": -0.1420015949406661, + "val_refine_score": 0.5682925434932107, + "val_reward": 0.014200159494066611, + "validated_this_epoch": true + }, + { + "alpha": null, + "early_stopping_active": true, + "early_stopping_best_value": 0.56943207420596, + "early_stopping_improved": false, + "early_stopping_min_delta": 0.0, + "early_stopping_monitor_mode": "max", + "early_stopping_monitor_name": "val_refine_score", + "early_stopping_monitor_value": 0.566548513612638, + "early_stopping_patience": 30, + "early_stopping_start_epoch": 30, + "early_stopping_wait": 25, + "encoder_lr": 7.123251795386929e-05, + "epoch": 71, + "epoch_seconds": 12.338792444206774, + "grad_norm": 0.8800196647644043, + "lr": 7.123251795386929e-05, + "selection_metric_name": "val_refine_score", + "selection_metric_value": 0.566548513612638, + "strategy3_bootstrap_loaded": true, + "strategy3_decoder_state": "frozen", + "strategy3_encoder_state": "frozen", + "strategy3_freeze_active": true, + "strategy3_freeze_requested": true, + "strategy3_segmentation_head_state": "frozen", + "train_action_distribution": { + "max_abs_delta": 0.10009765625, + "mean_abs_delta": 0.033684916751967234, + "mean_delta": -0.023712105689231645, + "near_zero_pct": 8.02333675861436e-05, + "negative_pct": 91.30545163696462, + "positive_pct": 8.694470284337347 + }, + "train_actor_loss": -0.022307901868109846, + "train_advantage_mean": 0.0, + "train_advantage_std": 0.0, + "train_alpha": 0.0, + "train_annealed_aux_ce_weight": 0.040000000000000015, + "train_biou_delta_mean": 0.022307902016274802, + "train_ce_loss": 0.16255494884469293, + "train_critic_loss": 0.0, + "train_dice": 0.9082772689119436, + "train_dice_loss": 0.07607054168527777, + "train_effective_steps": 8.0, + "train_entropy": 0.0, + "train_entropy_bonus_used": 0.0, + "train_entropy_loss": 0.0, + "train_iou": 0.8453855307031489, + "train_loss": -0.21830650622194464, + "train_mask_delta_mean": 0.03367892178622159, + "train_mean_reward": 0.022307901868109846, + "train_mean_value_pred": 0.0, + "train_reinforce_loss": 0.0, + "train_reward_zeros_pct": 0.6828150076960976, + "train_rl_loss_scale": 10.0, + "train_value_pred_error": 0.0, + "val_actor_loss": -0.014075695693463786, + "val_binary_flips_correct_pct": 0.3558027978036918, + "val_binary_flips_total_pct": 0.6517859066233915, + "val_binary_flips_wrong_pct": 0.2959831088196998, + "val_biou": 0.4299979475967554, + "val_biou_gain": 0.04533855976590573, + "val_ce_loss": 0.0, + "val_critic_loss": 0.0, + "val_decoder_biou": 0.3846593878308497, + "val_decoder_dice": 0.770921132483555, + "val_decoder_iou": 0.6801783568719756, + "val_dice": 0.7868816604672743, + "val_dice_gain": 0.015960527983719275, + "val_dice_loss": 0.0, + "val_entropy": 0.0, + "val_iou": 0.7030990796285206, + "val_iou_gain": 0.022920722756544998, + "val_loss": -0.14075695693463786, + "val_refine_score": 0.566548513612638, + "val_reward": 0.014075695693463786, + "validated_this_epoch": true + }, + { + "alpha": null, + "early_stopping_active": true, + "early_stopping_best_value": 0.5724109242210832, + "early_stopping_improved": true, + "early_stopping_min_delta": 0.0, + "early_stopping_monitor_mode": "max", + "early_stopping_monitor_name": "val_refine_score", + "early_stopping_monitor_value": 0.5724109242210832, + "early_stopping_patience": 30, + "early_stopping_start_epoch": 30, + "early_stopping_wait": 0, + "encoder_lr": 6.878005085641386e-05, + "epoch": 72, + "epoch_seconds": 12.291832377202809, + "grad_norm": 0.8205426335334778, + "lr": 6.878005085641386e-05, + "selection_metric_name": "val_refine_score", + "selection_metric_value": 0.5724109242210832, + "strategy3_bootstrap_loaded": true, + "strategy3_decoder_state": "frozen", + "strategy3_encoder_state": "frozen", + "strategy3_freeze_active": true, + "strategy3_freeze_requested": true, + "strategy3_segmentation_head_state": "frozen", + "train_action_distribution": { + "max_abs_delta": 0.10009765625, + "mean_abs_delta": 0.03478065357458862, + "mean_delta": -0.023836190981621094, + "near_zero_pct": 3.43748646194151e-05, + "negative_pct": 91.14272838289088, + "positive_pct": 8.857239181683822 + }, + "train_actor_loss": -0.022541296999076043, + "train_advantage_mean": 0.0, + "train_advantage_std": 0.0, + "train_alpha": 0.0, + "train_annealed_aux_ce_weight": 0.040000000000000015, + "train_biou_delta_mean": 0.022541296914410355, + "train_ce_loss": 0.1627519726753235, + "train_critic_loss": 0.0, + "train_dice": 0.9080785176438869, + "train_dice_loss": 0.07494265382940118, + "train_effective_steps": 8.0, + "train_entropy": 0.0, + "train_entropy_bonus_used": 0.0, + "train_entropy_loss": 0.0, + "train_iou": 0.8458569006842346, + "train_loss": -0.22065908123146405, + "train_mask_delta_mean": 0.03478171608664773, + "train_mean_reward": 0.022541296999076043, + "train_mean_value_pred": 0.0, + "train_reinforce_loss": 0.0, + "train_reward_zeros_pct": 0.686553050763905, + "train_rl_loss_scale": 10.0, + "train_value_pred_error": 0.0, + "val_actor_loss": -0.014841008371149655, + "val_binary_flips_correct_pct": 0.4027460135665595, + "val_binary_flips_total_pct": 0.7549360686657476, + "val_binary_flips_wrong_pct": 0.3521900550991881, + "val_biou": 0.437004029666552, + "val_biou_gain": 0.05234464183570231, + "val_ce_loss": 0.0, + "val_critic_loss": 0.0, + "val_decoder_biou": 0.3846593878308497, + "val_decoder_dice": 0.770921132483555, + "val_decoder_iou": 0.6801783568719756, + "val_dice": 0.790749972578266, + "val_dice_gain": 0.019828840094710976, + "val_dice_loss": 0.0, + "val_entropy": 0.0, + "val_iou": 0.7078178187756143, + "val_iou_gain": 0.02763946190363875, + "val_loss": -0.14841008371149655, + "val_refine_score": 0.5724109242210832, + "val_reward": 0.014841008371149655, + "validated_this_epoch": true + }, + { + "alpha": null, + "early_stopping_active": true, + "early_stopping_best_value": 0.5724109242210832, + "early_stopping_improved": false, + "early_stopping_min_delta": 0.0, + "early_stopping_monitor_mode": "max", + "early_stopping_monitor_name": "val_refine_score", + "early_stopping_monitor_value": 0.5675205919602867, + "early_stopping_patience": 30, + "early_stopping_start_epoch": 30, + "early_stopping_wait": 1, + "encoder_lr": 6.634835819946531e-05, + "epoch": 73, + "epoch_seconds": 12.349078291561455, + "grad_norm": 0.8111003583127802, + "lr": 6.634835819946531e-05, + "selection_metric_name": "val_refine_score", + "selection_metric_value": 0.5675205919602867, + "strategy3_bootstrap_loaded": true, + "strategy3_decoder_state": "frozen", + "strategy3_encoder_state": "frozen", + "strategy3_freeze_active": true, + "strategy3_freeze_requested": true, + "strategy3_segmentation_head_state": "frozen", + "train_action_distribution": { + "max_abs_delta": 0.10009765625, + "mean_abs_delta": 0.03964948992837559, + "mean_delta": -0.029200964459133418, + "near_zero_pct": 3.9013950470234704e-05, + "negative_pct": 91.15503599697894, + "positive_pct": 8.84492713958025 + }, + "train_actor_loss": -0.022938068067146974, + "train_advantage_mean": 0.0, + "train_advantage_std": 0.0, + "train_alpha": 0.0, + "train_annealed_aux_ce_weight": 0.040000000000000015, + "train_biou_delta_mean": 0.02293806823647835, + "train_ce_loss": 0.16148287464271893, + "train_critic_loss": 0.0, + "train_dice": 0.9096224891955318, + "train_dice_loss": 0.07498335296457465, + "train_effective_steps": 8.0, + "train_entropy": 0.0, + "train_entropy_bonus_used": 0.0, + "train_entropy_loss": 0.0, + "train_iou": 0.8475997661393572, + "train_loss": -0.22465135969898917, + "train_mask_delta_mean": 0.03964510830965909, + "train_mean_reward": 0.022938068067146974, + "train_mean_value_pred": 0.0, + "train_reinforce_loss": 0.0, + "train_reward_zeros_pct": 0.5931020883673971, + "train_rl_loss_scale": 10.0, + "train_value_pred_error": 0.0, + "val_actor_loss": -0.01435835305164801, + "val_binary_flips_correct_pct": 0.3681669048234528, + "val_binary_flips_total_pct": 0.6925508087756587, + "val_binary_flips_wrong_pct": 0.3243839039522059, + "val_biou": 0.4320812869858279, + "val_biou_gain": 0.047421899154978187, + "val_ce_loss": 0.0, + "val_critic_loss": 0.0, + "val_decoder_biou": 0.3846593878308497, + "val_decoder_dice": 0.770921132483555, + "val_decoder_iou": 0.6801783568719756, + "val_dice": 0.7865016261786475, + "val_dice_gain": 0.015580493695092512, + "val_dice_loss": 0.0, + "val_entropy": 0.0, + "val_iou": 0.7029598969347455, + "val_iou_gain": 0.02278154006276989, + "val_loss": -0.1435835305164801, + "val_refine_score": 0.5675205919602867, + "val_reward": 0.01435835305164801, + "validated_this_epoch": true + }, + { + "alpha": null, + "early_stopping_active": true, + "early_stopping_best_value": 0.5724109242210832, + "early_stopping_improved": false, + "early_stopping_min_delta": 0.0, + "early_stopping_monitor_mode": "max", + "early_stopping_monitor_name": "val_refine_score", + "early_stopping_monitor_value": 0.5697360175477583, + "early_stopping_patience": 30, + "early_stopping_start_epoch": 30, + "early_stopping_wait": 2, + "encoder_lr": 6.393910654370494e-05, + "epoch": 74, + "epoch_seconds": 12.427151124924421, + "grad_norm": 0.8302145817063071, + "lr": 6.393910654370494e-05, + "selection_metric_name": "val_refine_score", + "selection_metric_value": 0.5697360175477583, + "strategy3_bootstrap_loaded": true, + "strategy3_decoder_state": "frozen", + "strategy3_encoder_state": "frozen", + "strategy3_freeze_active": true, + "strategy3_freeze_requested": true, + "strategy3_segmentation_head_state": "frozen", + "train_action_distribution": { + "max_abs_delta": 0.10009765625, + "mean_abs_delta": 0.03313180571421981, + "mean_delta": -0.022775523682040246, + "near_zero_pct": 5.277910640250577e-05, + "negative_pct": 91.19687676429749, + "positive_pct": 8.80307253788818 + }, + "train_actor_loss": -0.022723947717829353, + "train_advantage_mean": 0.0, + "train_advantage_std": 0.0, + "train_alpha": 0.0, + "train_annealed_aux_ce_weight": 0.040000000000000015, + "train_biou_delta_mean": 0.0227239477601622, + "train_ce_loss": 0.16360137137499722, + "train_critic_loss": 0.0, + "train_dice": 0.9049210937434123, + "train_dice_loss": 0.07664229111237959, + "train_effective_steps": 8.0, + "train_entropy": 0.0, + "train_entropy_bonus_used": 0.0, + "train_entropy_loss": 0.0, + "train_iou": 0.8429411166026842, + "train_loss": -0.22243460741910068, + "train_mask_delta_mean": 0.033128218217329544, + "train_mean_reward": 0.022723947717829353, + "train_mean_value_pred": 0.0, + "train_reinforce_loss": 0.0, + "train_reward_zeros_pct": 0.6392045645043254, + "train_rl_loss_scale": 10.0, + "train_value_pred_error": 0.0, + "val_actor_loss": -0.01458468063356122, + "val_binary_flips_correct_pct": 0.4243813309015012, + "val_binary_flips_total_pct": 0.7856294220569087, + "val_binary_flips_wrong_pct": 0.36124809115540746, + "val_biou": 0.43353547362241107, + "val_biou_gain": 0.048876085791561386, + "val_ce_loss": 0.0, + "val_critic_loss": 0.0, + "val_decoder_biou": 0.3846593878308497, + "val_decoder_dice": 0.770921132483555, + "val_decoder_iou": 0.6801783568719756, + "val_dice": 0.7892606043527235, + "val_dice_gain": 0.01833947186916851, + "val_dice_loss": 0.0, + "val_entropy": 0.0, + "val_iou": 0.7059365614731055, + "val_iou_gain": 0.025758204601129875, + "val_loss": -0.1458468063356122, + "val_refine_score": 0.5697360175477583, + "val_reward": 0.01458468063356122, + "validated_this_epoch": true + }, + { + "alpha": null, + "early_stopping_active": true, + "early_stopping_best_value": 0.5724109242210832, + "early_stopping_improved": false, + "early_stopping_min_delta": 0.0, + "early_stopping_monitor_mode": "max", + "early_stopping_monitor_name": "val_refine_score", + "early_stopping_monitor_value": 0.570153832059674, + "early_stopping_patience": 30, + "early_stopping_start_epoch": 30, + "early_stopping_wait": 3, + "encoder_lr": 6.155394706987283e-05, + "epoch": 75, + "epoch_seconds": 12.386987598147243, + "grad_norm": 0.9066552248868075, + "lr": 6.155394706987283e-05, + "selection_metric_name": "val_refine_score", + "selection_metric_value": 0.570153832059674, + "strategy3_bootstrap_loaded": true, + "strategy3_decoder_state": "frozen", + "strategy3_encoder_state": "frozen", + "strategy3_freeze_active": true, + "strategy3_freeze_requested": true, + "strategy3_segmentation_head_state": "frozen", + "train_action_distribution": { + "max_abs_delta": 0.10009765625, + "mean_abs_delta": 0.03600374444133856, + "mean_delta": -0.024933837714012374, + "near_zero_pct": 3.4907218093849224e-05, + "negative_pct": 91.13641110333529, + "positive_pct": 8.863556224175476 + }, + "train_actor_loss": -0.022749242044731298, + "train_advantage_mean": 0.0, + "train_advantage_std": 0.0, + "train_alpha": 0.0, + "train_annealed_aux_ce_weight": 0.040000000000000015, + "train_biou_delta_mean": 0.02274924225639552, + "train_ce_loss": 0.16119243746454065, + "train_critic_loss": 0.0, + "train_dice": 0.910556984078869, + "train_dice_loss": 0.07484760067679665, + "train_effective_steps": 8.0, + "train_entropy": 0.0, + "train_entropy_bonus_used": 0.0, + "train_entropy_loss": 0.0, + "train_iou": 0.8483747085939812, + "train_loss": -0.22277161343531174, + "train_mask_delta_mean": 0.03599964488636364, + "train_mean_reward": 0.022749242044731298, + "train_mean_value_pred": 0.0, + "train_reinforce_loss": 0.0, + "train_reward_zeros_pct": 0.5519836654209278, + "train_rl_loss_scale": 10.0, + "train_value_pred_error": 0.0, + "val_actor_loss": -0.014217035815818235, + "val_binary_flips_correct_pct": 0.40708429673138785, + "val_binary_flips_total_pct": 0.7298039455039829, + "val_binary_flips_wrong_pct": 0.32271964877259496, + "val_biou": 0.433290383555929, + "val_biou_gain": 0.04863099572507934, + "val_ce_loss": 0.0, + "val_critic_loss": 0.0, + "val_decoder_biou": 0.3846593878308497, + "val_decoder_dice": 0.770921132483555, + "val_decoder_iou": 0.6801783568719756, + "val_dice": 0.790428966571212, + "val_dice_gain": 0.019507834087656994, + "val_dice_loss": 0.0, + "val_entropy": 0.0, + "val_iou": 0.7070172805634188, + "val_iou_gain": 0.02683892369144325, + "val_loss": -0.14217035815818235, + "val_refine_score": 0.570153832059674, + "val_reward": 0.014217035815818235, + "validated_this_epoch": true + }, + { + "alpha": null, + "early_stopping_active": true, + "early_stopping_best_value": 0.5724109242210832, + "early_stopping_improved": false, + "early_stopping_min_delta": 0.0, + "early_stopping_monitor_mode": "max", + "early_stopping_monitor_name": "val_refine_score", + "early_stopping_monitor_value": 0.5689927409106568, + "early_stopping_patience": 30, + "early_stopping_start_epoch": 30, + "early_stopping_wait": 4, + "encoder_lr": 5.919451444713095e-05, + "epoch": 76, + "epoch_seconds": 12.310517078265548, + "grad_norm": 0.9455583203922618, + "lr": 5.919451444713095e-05, + "selection_metric_name": "val_refine_score", + "selection_metric_value": 0.5689927409106568, + "strategy3_bootstrap_loaded": true, + "strategy3_decoder_state": "frozen", + "strategy3_encoder_state": "frozen", + "strategy3_freeze_active": true, + "strategy3_freeze_requested": true, + "strategy3_segmentation_head_state": "frozen", + "train_action_distribution": { + "max_abs_delta": 0.10009765625, + "mean_abs_delta": 0.034654943653467024, + "mean_delta": -0.024363001173531466, + "near_zero_pct": 3.650428110094336e-05, + "negative_pct": 91.2275684828108, + "positive_pct": 8.772397236051885 + }, + "train_actor_loss": -0.022890333739765498, + "train_advantage_mean": 0.0, + "train_advantage_std": 0.0, + "train_alpha": 0.0, + "train_annealed_aux_ce_weight": 0.040000000000000015, + "train_biou_delta_mean": 0.022890333528101273, + "train_ce_loss": 0.15437175062569705, + "train_critic_loss": 0.0, + "train_dice": 0.911545447073648, + "train_dice_loss": 0.07291199944236061, + "train_effective_steps": 8.0, + "train_entropy": 0.0, + "train_entropy_bonus_used": 0.0, + "train_entropy_loss": 0.0, + "train_iou": 0.8493606778521061, + "train_loss": -0.2243576632304625, + "train_mask_delta_mean": 0.03466796875, + "train_mean_reward": 0.022890333739765498, + "train_mean_value_pred": 0.0, + "train_reinforce_loss": 0.0, + "train_reward_zeros_pct": 0.5407695489173586, + "train_rl_loss_scale": 10.0, + "train_value_pred_error": 0.0, + "val_actor_loss": -0.014455969670962077, + "val_binary_flips_correct_pct": 0.3945257149490655, + "val_binary_flips_total_pct": 0.709836623247932, + "val_binary_flips_wrong_pct": 0.31531090829886643, + "val_biou": 0.43348775411334006, + "val_biou_gain": 0.048828366282490376, + "val_ce_loss": 0.0, + "val_critic_loss": 0.0, + "val_decoder_biou": 0.3846593878308497, + "val_decoder_dice": 0.770921132483555, + "val_decoder_iou": 0.6801783568719756, + "val_dice": 0.7879795462601741, + "val_dice_gain": 0.017058413776619097, + "val_dice_loss": 0.0, + "val_entropy": 0.0, + "val_iou": 0.7044977277079735, + "val_iou_gain": 0.02431937083599789, + "val_loss": -0.14455969670962077, + "val_refine_score": 0.5689927409106568, + "val_reward": 0.014455969670962077, + "validated_this_epoch": true + }, + { + "alpha": null, + "early_stopping_active": true, + "early_stopping_best_value": 0.5724109242210832, + "early_stopping_improved": false, + "early_stopping_min_delta": 0.0, + "early_stopping_monitor_mode": "max", + "early_stopping_monitor_name": "val_refine_score", + "early_stopping_monitor_value": 0.5692083563073268, + "early_stopping_patience": 30, + "early_stopping_start_epoch": 30, + "early_stopping_wait": 5, + "encoder_lr": 5.686242571274264e-05, + "epoch": 77, + "epoch_seconds": 12.35096854204312, + "grad_norm": 0.895832820372148, + "lr": 5.686242571274264e-05, + "selection_metric_name": "val_refine_score", + "selection_metric_value": 0.5692083563073268, + "strategy3_bootstrap_loaded": true, + "strategy3_decoder_state": "frozen", + "strategy3_encoder_state": "frozen", + "strategy3_freeze_active": true, + "strategy3_freeze_requested": true, + "strategy3_segmentation_head_state": "frozen", + "train_action_distribution": { + "max_abs_delta": 0.10009765625, + "mean_abs_delta": 0.0341205351181667, + "mean_delta": -0.02289303472604264, + "near_zero_pct": 3.551562328270434e-05, + "negative_pct": 91.03195836598223, + "positive_pct": 8.96800814873793 + }, + "train_actor_loss": -0.023187085148740814, + "train_advantage_mean": 0.0, + "train_advantage_std": 0.0, + "train_alpha": 0.0, + "train_annealed_aux_ce_weight": 0.040000000000000015, + "train_biou_delta_mean": 0.023187085148740814, + "train_ce_loss": 0.16126721013676037, + "train_critic_loss": 0.0, + "train_dice": 0.9094655606589744, + "train_dice_loss": 0.07393446293744174, + "train_effective_steps": 8.0, + "train_entropy": 0.0, + "train_entropy_bonus_used": 0.0, + "train_entropy_loss": 0.0, + "train_iou": 0.8478420466151959, + "train_loss": -0.22716681794686752, + "train_mask_delta_mean": 0.034113103693181816, + "train_mean_reward": 0.023187085148740814, + "train_mean_value_pred": 0.0, + "train_reinforce_loss": 0.0, + "train_reward_zeros_pct": 0.6591407645663078, + "train_rl_loss_scale": 10.0, + "train_value_pred_error": 0.0, + "val_actor_loss": -0.014346466043207329, + "val_binary_flips_correct_pct": 0.3899555580288756, + "val_binary_flips_total_pct": 0.7118524289598652, + "val_binary_flips_wrong_pct": 0.32189687093098956, + "val_biou": 0.43280989445879287, + "val_biou_gain": 0.04815050662794318, + "val_ce_loss": 0.0, + "val_critic_loss": 0.0, + "val_decoder_biou": 0.3846593878308497, + "val_decoder_dice": 0.770921132483555, + "val_decoder_iou": 0.6801783568719756, + "val_dice": 0.7890897574473195, + "val_dice_gain": 0.01816862496376448, + "val_dice_loss": 0.0, + "val_entropy": 0.0, + "val_iou": 0.7056068181558607, + "val_iou_gain": 0.025428461283885095, + "val_loss": -0.1434646604320733, + "val_refine_score": 0.5692083563073268, + "val_reward": 0.014346466043207329, + "validated_this_epoch": true + }, + { + "alpha": null, + "early_stopping_active": true, + "early_stopping_best_value": 0.5724109242210832, + "early_stopping_improved": false, + "early_stopping_min_delta": 0.0, + "early_stopping_monitor_mode": "max", + "early_stopping_monitor_name": "val_refine_score", + "early_stopping_monitor_value": 0.5685855329721144, + "early_stopping_patience": 30, + "early_stopping_start_epoch": 30, + "early_stopping_wait": 6, + "encoder_lr": 5.4559279163835986e-05, + "epoch": 78, + "epoch_seconds": 12.33479316206649, + "grad_norm": 1.026414621960033, + "lr": 5.4559279163835986e-05, + "selection_metric_name": "val_refine_score", + "selection_metric_value": 0.5685855329721144, + "strategy3_bootstrap_loaded": true, + "strategy3_decoder_state": "frozen", + "strategy3_encoder_state": "frozen", + "strategy3_freeze_active": true, + "strategy3_freeze_requested": true, + "strategy3_segmentation_head_state": "frozen", + "train_action_distribution": { + "max_abs_delta": 0.10009765625, + "mean_abs_delta": 0.03299290331249887, + "mean_delta": -0.02227112633938139, + "near_zero_pct": 7.65068880975212e-05, + "negative_pct": 91.13118276000023, + "positive_pct": 8.868742861192334 + }, + "train_actor_loss": -0.023151956441738133, + "train_advantage_mean": 0.0, + "train_advantage_std": 0.0, + "train_alpha": 0.0, + "train_annealed_aux_ce_weight": 0.040000000000000015, + "train_biou_delta_mean": 0.023151956357072446, + "train_ce_loss": 0.1576103066856211, + "train_critic_loss": 0.0, + "train_dice": 0.912349059139449, + "train_dice_loss": 0.07333709435029463, + "train_effective_steps": 8.0, + "train_entropy": 0.0, + "train_entropy_bonus_used": 0.0, + "train_entropy_loss": 0.0, + "train_iou": 0.8505084297976993, + "train_loss": -0.22690061141144147, + "train_mask_delta_mean": 0.03299227627840909, + "train_mean_reward": 0.023151956441738133, + "train_mean_value_pred": 0.0, + "train_reinforce_loss": 0.0, + "train_reward_zeros_pct": 0.4223983332684094, + "train_rl_loss_scale": 10.0, + "train_value_pred_error": 0.0, + "val_actor_loss": -0.014451093746174593, + "val_binary_flips_correct_pct": 0.4066280290192249, + "val_binary_flips_total_pct": 0.7602317660462623, + "val_binary_flips_wrong_pct": 0.3536037370270374, + "val_biou": 0.43384914856227413, + "val_biou_gain": 0.04918976073142445, + "val_ce_loss": 0.0, + "val_critic_loss": 0.0, + "val_decoder_biou": 0.3846593878308497, + "val_decoder_dice": 0.770921132483555, + "val_decoder_iou": 0.6801783568719756, + "val_dice": 0.7870013539876651, + "val_dice_gain": 0.016080221504110148, + "val_dice_loss": 0.0, + "val_entropy": 0.0, + "val_iou": 0.7033219173819548, + "val_iou_gain": 0.023143560509979233, + "val_loss": -0.14451093746174593, + "val_refine_score": 0.5685855329721144, + "val_reward": 0.014451093746174593, + "validated_this_epoch": true + }, + { + "alpha": null, + "early_stopping_active": true, + "early_stopping_best_value": 0.5724109242210832, + "early_stopping_improved": false, + "early_stopping_min_delta": 0.0, + "early_stopping_monitor_mode": "max", + "early_stopping_monitor_name": "val_refine_score", + "early_stopping_monitor_value": 0.5657321366842216, + "early_stopping_patience": 30, + "early_stopping_start_epoch": 30, + "early_stopping_wait": 7, + "encoder_lr": 5.228665326201092e-05, + "epoch": 79, + "epoch_seconds": 12.390016814693809, + "grad_norm": 1.0521115227179094, + "lr": 5.228665326201092e-05, + "selection_metric_name": "val_refine_score", + "selection_metric_value": 0.5657321366842216, + "strategy3_bootstrap_loaded": true, + "strategy3_decoder_state": "frozen", + "strategy3_encoder_state": "frozen", + "strategy3_freeze_active": true, + "strategy3_freeze_requested": true, + "strategy3_segmentation_head_state": "frozen", + "train_action_distribution": { + "max_abs_delta": 0.10009765625, + "mean_abs_delta": 0.035162937277081335, + "mean_delta": -0.024758873380381952, + "near_zero_pct": 2.8214767217543173e-05, + "negative_pct": 91.07776365496896, + "positive_pct": 8.922210124067284 + }, + "train_actor_loss": -0.022880671834255652, + "train_advantage_mean": 0.0, + "train_advantage_std": 0.0, + "train_alpha": 0.0, + "train_annealed_aux_ce_weight": 0.040000000000000015, + "train_biou_delta_mean": 0.022880671918921344, + "train_ce_loss": 0.15907656265930695, + "train_critic_loss": 0.0, + "train_dice": 0.9112315799649479, + "train_dice_loss": 0.07393779537894508, + "train_effective_steps": 8.0, + "train_entropy": 0.0, + "train_entropy_bonus_used": 0.0, + "train_entropy_loss": 0.0, + "train_iou": 0.8493678722915823, + "train_loss": -0.22414642707868057, + "train_mask_delta_mean": 0.035161798650568184, + "train_mean_reward": 0.022880671834255652, + "train_mean_value_pred": 0.0, + "train_reinforce_loss": 0.0, + "train_reward_zeros_pct": 0.3314394038170576, + "train_rl_loss_scale": 10.0, + "train_value_pred_error": 0.0, + "val_actor_loss": -0.01426248009011033, + "val_binary_flips_correct_pct": 0.3644045661477482, + "val_binary_flips_total_pct": 0.6501478307387408, + "val_binary_flips_wrong_pct": 0.28574326459099264, + "val_biou": 0.4301469756652641, + "val_biou_gain": 0.04548758783441442, + "val_ce_loss": 0.0, + "val_critic_loss": 0.0, + "val_decoder_biou": 0.3846593878308497, + "val_decoder_dice": 0.770921132483555, + "val_decoder_iou": 0.6801783568719756, + "val_dice": 0.7848789960505091, + "val_dice_gain": 0.013957863566954165, + "val_dice_loss": 0.0, + "val_entropy": 0.0, + "val_iou": 0.7013172977031791, + "val_iou_gain": 0.02113894083120349, + "val_loss": -0.1426248009011033, + "val_refine_score": 0.5657321366842216, + "val_reward": 0.01426248009011033, + "validated_this_epoch": true + }, + { + "alpha": null, + "early_stopping_active": true, + "early_stopping_best_value": 0.5724109242210832, + "early_stopping_improved": false, + "early_stopping_min_delta": 0.0, + "early_stopping_monitor_mode": "max", + "early_stopping_monitor_name": "val_refine_score", + "early_stopping_monitor_value": 0.5697424452826639, + "early_stopping_patience": 30, + "early_stopping_start_epoch": 30, + "early_stopping_wait": 8, + "encoder_lr": 5.0046105551540376e-05, + "epoch": 80, + "epoch_seconds": 12.367136507760733, + "grad_norm": 1.4648692553693599, + "lr": 5.0046105551540376e-05, + "selection_metric_name": "val_refine_score", + "selection_metric_value": 0.5697424452826639, + "strategy3_bootstrap_loaded": true, + "strategy3_decoder_state": "frozen", + "strategy3_encoder_state": "frozen", + "strategy3_freeze_active": true, + "strategy3_freeze_requested": true, + "strategy3_segmentation_head_state": "frozen", + "train_action_distribution": { + "max_abs_delta": 0.10009765625, + "mean_abs_delta": 0.03501868290318684, + "mean_delta": -0.024915262485261668, + "near_zero_pct": 5.490852249646526e-05, + "negative_pct": 91.25214435837485, + "positive_pct": 8.747802695936777 + }, + "train_actor_loss": -0.02277681990050372, + "train_advantage_mean": 0.0, + "train_advantage_std": 0.0, + "train_alpha": 0.0, + "train_annealed_aux_ce_weight": 0.040000000000000015, + "train_biou_delta_mean": 0.0227768200698351, + "train_ce_loss": 0.16115524145689877, + "train_critic_loss": 0.0, + "train_dice": 0.9082484362678132, + "train_dice_loss": 0.07498634945262563, + "train_effective_steps": 8.0, + "train_entropy": 0.0, + "train_entropy_bonus_used": 0.0, + "train_entropy_loss": 0.0, + "train_iou": 0.8463954753809407, + "train_loss": -0.223045369440859, + "train_mask_delta_mean": 0.0350341796875, + "train_mean_reward": 0.02277681990050372, + "train_mean_value_pred": 0.0, + "train_reinforce_loss": 0.0, + "train_reward_zeros_pct": 0.6628788076341152, + "train_rl_loss_scale": 10.0, + "train_value_pred_error": 0.0, + "val_actor_loss": -0.014656970612122677, + "val_binary_flips_correct_pct": 0.3901799519856771, + "val_binary_flips_total_pct": 0.7023942236806832, + "val_binary_flips_wrong_pct": 0.31221427169500615, + "val_biou": 0.43543228151724395, + "val_biou_gain": 0.05077289368639426, + "val_ce_loss": 0.0, + "val_critic_loss": 0.0, + "val_decoder_biou": 0.3846593878308497, + "val_decoder_dice": 0.770921132483555, + "val_decoder_iou": 0.6801783568719756, + "val_dice": 0.7870868235974237, + "val_dice_gain": 0.016165691113868674, + "val_dice_loss": 0.0, + "val_entropy": 0.0, + "val_iou": 0.704052609048084, + "val_iou_gain": 0.02387425217610839, + "val_loss": -0.14656970612122677, + "val_refine_score": 0.5697424452826639, + "val_reward": 0.014656970612122677, + "validated_this_epoch": true + }, + { + "alpha": null, + "early_stopping_active": true, + "early_stopping_best_value": 0.5724109242210832, + "early_stopping_improved": false, + "early_stopping_min_delta": 0.0, + "early_stopping_monitor_mode": "max", + "early_stopping_monitor_name": "val_refine_score", + "early_stopping_monitor_value": 0.56996448126039, + "early_stopping_patience": 30, + "early_stopping_start_epoch": 30, + "early_stopping_wait": 9, + "encoder_lr": 4.783917159190718e-05, + "epoch": 81, + "epoch_seconds": 12.385406515095383, + "grad_norm": 1.0327852368354797, + "lr": 4.783917159190718e-05, + "selection_metric_name": "val_refine_score", + "selection_metric_value": 0.56996448126039, + "strategy3_bootstrap_loaded": true, + "strategy3_decoder_state": "frozen", + "strategy3_encoder_state": "frozen", + "strategy3_freeze_active": true, + "strategy3_freeze_requested": true, + "strategy3_segmentation_head_state": "frozen", + "train_action_distribution": { + "max_abs_delta": 0.10009765625, + "mean_abs_delta": 0.03599973230368712, + "mean_delta": -0.025498333027247678, + "near_zero_pct": 4.1599670262051156e-05, + "negative_pct": 91.0963427614082, + "positive_pct": 8.903617242520506 + }, + "train_actor_loss": -0.023793814232869245, + "train_advantage_mean": 0.0, + "train_advantage_std": 0.0, + "train_alpha": 0.0, + "train_annealed_aux_ce_weight": 0.040000000000000015, + "train_biou_delta_mean": 0.023793814275202087, + "train_ce_loss": 0.1541410373015837, + "train_critic_loss": 0.0, + "train_dice": 0.91652447958038, + "train_dice_loss": 0.0727674202485518, + "train_effective_steps": 8.0, + "train_entropy": 0.0, + "train_entropy_bonus_used": 0.0, + "train_entropy_loss": 0.0, + "train_iou": 0.8548628590674876, + "train_loss": -0.23339997773820703, + "train_mask_delta_mean": 0.03600241921164773, + "train_mean_reward": 0.023793814232869245, + "train_mean_value_pred": 0.0, + "train_reinforce_loss": 0.0, + "train_reward_zeros_pct": 0.1657197019085288, + "train_rl_loss_scale": 10.0, + "train_value_pred_error": 0.0, + "val_actor_loss": -0.014700136565807043, + "val_binary_flips_correct_pct": 0.40662428911994486, + "val_binary_flips_total_pct": 0.7291457232306986, + "val_binary_flips_wrong_pct": 0.3225214341107537, + "val_biou": 0.4360505607811584, + "val_biou_gain": 0.051391172950308706, + "val_ce_loss": 0.0, + "val_critic_loss": 0.0, + "val_decoder_biou": 0.3846593878308497, + "val_decoder_dice": 0.770921132483555, + "val_decoder_iou": 0.6801783568719756, + "val_dice": 0.7869498164074481, + "val_dice_gain": 0.016028683923893117, + "val_dice_loss": 0.0, + "val_entropy": 0.0, + "val_iou": 0.7038784017396217, + "val_iou_gain": 0.023700044867646097, + "val_loss": -0.14700136565807043, + "val_refine_score": 0.56996448126039, + "val_reward": 0.014700136565807043, + "validated_this_epoch": true + }, + { + "alpha": null, + "early_stopping_active": true, + "early_stopping_best_value": 0.5724109242210832, + "early_stopping_improved": false, + "early_stopping_min_delta": 0.0, + "early_stopping_monitor_mode": "max", + "early_stopping_monitor_name": "val_refine_score", + "early_stopping_monitor_value": 0.568536690526662, + "early_stopping_patience": 30, + "early_stopping_start_epoch": 30, + "early_stopping_wait": 10, + "encoder_lr": 4.5667363905408535e-05, + "epoch": 82, + "epoch_seconds": 12.347015745937824, + "grad_norm": 1.04018465497277, + "lr": 4.5667363905408535e-05, + "selection_metric_name": "val_refine_score", + "selection_metric_value": 0.568536690526662, + "strategy3_bootstrap_loaded": true, + "strategy3_decoder_state": "frozen", + "strategy3_encoder_state": "frozen", + "strategy3_freeze_active": true, + "strategy3_freeze_requested": true, + "strategy3_segmentation_head_state": "frozen", + "train_action_distribution": { + "max_abs_delta": 0.10009765625, + "mean_abs_delta": 0.03364980216561393, + "mean_delta": -0.02357448931698772, + "near_zero_pct": 8.715397089273128e-05, + "negative_pct": 91.21194034814835, + "positive_pct": 8.787974584001033 + }, + "train_actor_loss": -0.023541237473678353, + "train_advantage_mean": 0.0, + "train_advantage_std": 0.0, + "train_alpha": 0.0, + "train_annealed_aux_ce_weight": 0.040000000000000015, + "train_biou_delta_mean": 0.023541237600676886, + "train_ce_loss": 0.15912367674437436, + "train_critic_loss": 0.0, + "train_dice": 0.910903682211274, + "train_dice_loss": 0.07382385297255083, + "train_effective_steps": 8.0, + "train_entropy": 0.0, + "train_entropy_bonus_used": 0.0, + "train_entropy_loss": 0.0, + "train_iou": 0.8500770616424039, + "train_loss": -0.23075342991135336, + "train_mask_delta_mean": 0.03365256569602273, + "train_mean_reward": 0.023541237473678353, + "train_mean_value_pred": 0.0, + "train_reinforce_loss": 0.0, + "train_reward_zeros_pct": 0.3314394038170576, + "train_rl_loss_scale": 10.0, + "train_value_pred_error": 0.0, + "val_actor_loss": -0.01429525082494365, + "val_binary_flips_correct_pct": 0.3992791269339767, + "val_binary_flips_total_pct": 0.7238874248429841, + "val_binary_flips_wrong_pct": 0.32460829790900736, + "val_biou": 0.4341588942042436, + "val_biou_gain": 0.0494995063733939, + "val_ce_loss": 0.0, + "val_critic_loss": 0.0, + "val_decoder_biou": 0.3846593878308497, + "val_decoder_dice": 0.770921132483555, + "val_decoder_iou": 0.6801783568719756, + "val_dice": 0.7862371646677089, + "val_dice_gain": 0.015316032184153894, + "val_dice_loss": 0.0, + "val_entropy": 0.0, + "val_iou": 0.7029144868490804, + "val_iou_gain": 0.022736129977104835, + "val_loss": -0.1429525082494365, + "val_refine_score": 0.568536690526662, + "val_reward": 0.01429525082494365, + "validated_this_epoch": true + }, + { + "alpha": null, + "early_stopping_active": true, + "early_stopping_best_value": 0.5724109242210832, + "early_stopping_improved": false, + "early_stopping_min_delta": 0.0, + "early_stopping_monitor_mode": "max", + "early_stopping_monitor_name": "val_refine_score", + "early_stopping_monitor_value": 0.5681724217258123, + "early_stopping_patience": 30, + "early_stopping_start_epoch": 30, + "early_stopping_wait": 11, + "encoder_lr": 4.3532170940548435e-05, + "epoch": 83, + "epoch_seconds": 12.356953333131969, + "grad_norm": 0.9818325259468772, + "lr": 4.3532170940548435e-05, + "selection_metric_name": "val_refine_score", + "selection_metric_value": 0.5681724217258123, + "strategy3_bootstrap_loaded": true, + "strategy3_decoder_state": "frozen", + "strategy3_encoder_state": "frozen", + "strategy3_freeze_active": true, + "strategy3_freeze_requested": true, + "strategy3_segmentation_head_state": "frozen", + "train_action_distribution": { + "max_abs_delta": 0.10009765625, + "mean_abs_delta": 0.03589912584390153, + "mean_delta": -0.02524064546874301, + "near_zero_pct": 2.167441692790817e-05, + "negative_pct": 91.13283665342765, + "positive_pct": 8.867143873463977 + }, + "train_actor_loss": -0.02369100801032883, + "train_advantage_mean": 0.0, + "train_advantage_std": 0.0, + "train_alpha": 0.0, + "train_annealed_aux_ce_weight": 0.040000000000000015, + "train_biou_delta_mean": 0.023691008052661677, + "train_ce_loss": 0.15673197534951297, + "train_critic_loss": 0.0, + "train_dice": 0.910381255063977, + "train_dice_loss": 0.073176616972143, + "train_effective_steps": 8.0, + "train_entropy": 0.0, + "train_entropy_bonus_used": 0.0, + "train_entropy_loss": 0.0, + "train_iou": 0.8493232868909593, + "train_loss": -0.23231190578504043, + "train_mask_delta_mean": 0.035894220525568184, + "train_mean_reward": 0.02369100801032883, + "train_mean_value_pred": 0.0, + "train_reinforce_loss": 0.0, + "train_reward_zeros_pct": 0.5445075919851661, + "train_rl_loss_scale": 10.0, + "train_value_pred_error": 0.0, + "val_actor_loss": -0.014412627529964084, + "val_binary_flips_correct_pct": 0.4014146094228707, + "val_binary_flips_total_pct": 0.7074206483130361, + "val_binary_flips_wrong_pct": 0.3060060388901654, + "val_biou": 0.43362715798294504, + "val_biou_gain": 0.04896777015209536, + "val_ce_loss": 0.0, + "val_critic_loss": 0.0, + "val_decoder_biou": 0.3846593878308497, + "val_decoder_dice": 0.770921132483555, + "val_decoder_iou": 0.6801783568719756, + "val_dice": 0.7860015209462333, + "val_dice_gain": 0.01508038846267834, + "val_dice_loss": 0.0, + "val_entropy": 0.0, + "val_iou": 0.7027176854686795, + "val_iou_gain": 0.022539328596703934, + "val_loss": -0.14412627529964084, + "val_refine_score": 0.5681724217258123, + "val_reward": 0.014412627529964084, + "validated_this_epoch": true + }, + { + "alpha": null, + "early_stopping_active": true, + "early_stopping_best_value": 0.5724109242210832, + "early_stopping_improved": false, + "early_stopping_min_delta": 0.0, + "early_stopping_monitor_mode": "max", + "early_stopping_monitor_name": "val_refine_score", + "early_stopping_monitor_value": 0.5701359346433008, + "early_stopping_patience": 30, + "early_stopping_start_epoch": 30, + "early_stopping_wait": 12, + "encoder_lr": 4.143505605192989e-05, + "epoch": 84, + "epoch_seconds": 12.395286740269512, + "grad_norm": 1.020734656940807, + "lr": 4.143505605192989e-05, + "selection_metric_name": "val_refine_score", + "selection_metric_value": 0.5701359346433008, + "strategy3_bootstrap_loaded": true, + "strategy3_decoder_state": "frozen", + "strategy3_encoder_state": "frozen", + "strategy3_freeze_active": true, + "strategy3_freeze_requested": true, + "strategy3_segmentation_head_state": "frozen", + "train_action_distribution": { + "max_abs_delta": 0.10009765625, + "mean_abs_delta": 0.03442072834480892, + "mean_delta": -0.02266700811345469, + "near_zero_pct": 4.2284125615052204e-05, + "negative_pct": 91.16951674222946, + "positive_pct": 8.830443244766105 + }, + "train_actor_loss": -0.02361957618665077, + "train_advantage_mean": 0.0, + "train_advantage_std": 0.0, + "train_alpha": 0.0, + "train_annealed_aux_ce_weight": 0.040000000000000015, + "train_biou_delta_mean": 0.023619576398314992, + "train_ce_loss": 0.1498232504183596, + "train_critic_loss": 0.0, + "train_dice": 0.9150376044306426, + "train_dice_loss": 0.07064851847561923, + "train_effective_steps": 8.0, + "train_entropy": 0.0, + "train_entropy_bonus_used": 0.0, + "train_entropy_loss": 0.0, + "train_iou": 0.854623768263517, + "train_loss": -0.2317863255739212, + "train_mask_delta_mean": 0.034429376775568184, + "train_mean_reward": 0.02361957618665077, + "train_mean_value_pred": 0.0, + "train_reinforce_loss": 0.0, + "train_reward_zeros_pct": 0.3077651606872678, + "train_rl_loss_scale": 10.0, + "train_value_pred_error": 0.0, + "val_actor_loss": -0.014585665900085587, + "val_binary_flips_correct_pct": 0.4023084453507966, + "val_binary_flips_total_pct": 0.7247027228860294, + "val_binary_flips_wrong_pct": 0.32239427753523286, + "val_biou": 0.43595904340378944, + "val_biou_gain": 0.05129965557293975, + "val_ce_loss": 0.0, + "val_critic_loss": 0.0, + "val_decoder_biou": 0.3846593878308497, + "val_decoder_dice": 0.770921132483555, + "val_decoder_iou": 0.6801783568719756, + "val_dice": 0.7875053927796725, + "val_dice_gain": 0.01658426029611748, + "val_dice_loss": 0.0, + "val_entropy": 0.0, + "val_iou": 0.7043128258828121, + "val_iou_gain": 0.02413446901083649, + "val_loss": -0.14585665900085587, + "val_refine_score": 0.5701359346433008, + "val_reward": 0.014585665900085587, + "validated_this_epoch": true + }, + { + "alpha": null, + "early_stopping_active": true, + "early_stopping_best_value": 0.5724109242210832, + "early_stopping_improved": false, + "early_stopping_min_delta": 0.0, + "early_stopping_monitor_mode": "max", + "early_stopping_monitor_name": "val_refine_score", + "early_stopping_monitor_value": 0.5666733663903568, + "early_stopping_patience": 30, + "early_stopping_start_epoch": 30, + "early_stopping_wait": 13, + "encoder_lr": 3.93774564973442e-05, + "epoch": 85, + "epoch_seconds": 12.367900801356882, + "grad_norm": 0.9592854705723849, + "lr": 3.93774564973442e-05, + "selection_metric_name": "val_refine_score", + "selection_metric_value": 0.5666733663903568, + "strategy3_bootstrap_loaded": true, + "strategy3_decoder_state": "frozen", + "strategy3_encoder_state": "frozen", + "strategy3_freeze_active": true, + "strategy3_freeze_requested": true, + "strategy3_segmentation_head_state": "frozen", + "train_action_distribution": { + "max_abs_delta": 0.10009765625, + "mean_abs_delta": 0.03529886494983326, + "mean_delta": -0.025453334801237692, + "near_zero_pct": 4.479379498434355e-05, + "negative_pct": 91.1782796409997, + "positive_pct": 8.821677645160394 + }, + "train_actor_loss": -0.02354776407115754, + "train_advantage_mean": 0.0, + "train_advantage_std": 0.0, + "train_alpha": 0.0, + "train_annealed_aux_ce_weight": 0.040000000000000015, + "train_biou_delta_mean": 0.02354776413465681, + "train_ce_loss": 0.1540398435159163, + "train_critic_loss": 0.0, + "train_dice": 0.9123936866779672, + "train_dice_loss": 0.07193575664000078, + "train_effective_steps": 8.0, + "train_entropy": 0.0, + "train_entropy_bonus_used": 0.0, + "train_entropy_loss": 0.0, + "train_iou": 0.8524457736903722, + "train_loss": -0.23095813393592834, + "train_mask_delta_mean": 0.03529774058948864, + "train_mean_reward": 0.02354776407115754, + "train_mean_value_pred": 0.0, + "train_reinforce_loss": 0.0, + "train_reward_zeros_pct": 0.5681818351149559, + "train_rl_loss_scale": 10.0, + "train_value_pred_error": 0.0, + "val_actor_loss": -0.014192217244271887, + "val_binary_flips_correct_pct": 0.38672802495021447, + "val_binary_flips_total_pct": 0.6881639069201899, + "val_binary_flips_wrong_pct": 0.3014358819699755, + "val_biou": 0.4313143534551839, + "val_biou_gain": 0.04665496562433419, + "val_ce_loss": 0.0, + "val_critic_loss": 0.0, + "val_decoder_biou": 0.3846593878308497, + "val_decoder_dice": 0.770921132483555, + "val_decoder_iou": 0.6801783568719756, + "val_dice": 0.7854204798326975, + "val_dice_gain": 0.014499347349142488, + "val_dice_loss": 0.0, + "val_entropy": 0.0, + "val_iou": 0.7020323793255298, + "val_iou_gain": 0.021854022453554167, + "val_loss": -0.14192217244271887, + "val_refine_score": 0.5666733663903568, + "val_reward": 0.014192217244271887, + "validated_this_epoch": true + }, + { + "alpha": null, + "early_stopping_active": true, + "early_stopping_best_value": 0.5724109242210832, + "early_stopping_improved": false, + "early_stopping_min_delta": 0.0, + "early_stopping_monitor_mode": "max", + "early_stopping_monitor_name": "val_refine_score", + "early_stopping_monitor_value": 0.5690854018897675, + "early_stopping_patience": 30, + "early_stopping_start_epoch": 30, + "early_stopping_wait": 14, + "encoder_lr": 3.736078245274676e-05, + "epoch": 86, + "epoch_seconds": 12.336976921185851, + "grad_norm": 1.1225694255395369, + "lr": 3.736078245274676e-05, + "selection_metric_name": "val_refine_score", + "selection_metric_value": 0.5690854018897675, + "strategy3_bootstrap_loaded": true, + "strategy3_decoder_state": "frozen", + "strategy3_encoder_state": "frozen", + "strategy3_freeze_active": true, + "strategy3_freeze_requested": true, + "strategy3_segmentation_head_state": "frozen", + "train_action_distribution": { + "max_abs_delta": 0.10009765625, + "mean_abs_delta": 0.037783489943566645, + "mean_delta": -0.027256494472649963, + "near_zero_pct": 7.53661289174736e-05, + "negative_pct": 91.19157018986616, + "positive_pct": 8.808356345715849 + }, + "train_actor_loss": -0.02352625974824398, + "train_advantage_mean": 0.0, + "train_advantage_std": 0.0, + "train_alpha": 0.0, + "train_annealed_aux_ce_weight": 0.040000000000000015, + "train_biou_delta_mean": 0.02352625983290967, + "train_ce_loss": 0.15676941993561658, + "train_critic_loss": 0.0, + "train_dice": 0.9083610765773528, + "train_dice_loss": 0.072595552964644, + "train_effective_steps": 8.0, + "train_entropy": 0.0, + "train_entropy_bonus_used": 0.0, + "train_entropy_loss": 0.0, + "train_iou": 0.8482443701973004, + "train_loss": -0.23067529499530792, + "train_mask_delta_mean": 0.037775213068181816, + "train_mean_reward": 0.02352625974824398, + "train_mean_value_pred": 0.0, + "train_reinforce_loss": 0.0, + "train_reward_zeros_pct": 0.7849880536510185, + "train_rl_loss_scale": 10.0, + "train_value_pred_error": 0.0, + "val_actor_loss": -0.01407079979617265, + "val_binary_flips_correct_pct": 0.4231920429304534, + "val_binary_flips_total_pct": 0.8068608302696079, + "val_binary_flips_wrong_pct": 0.38366878733915444, + "val_biou": 0.4338707953760412, + "val_biou_gain": 0.04921140754519149, + "val_ce_loss": 0.0, + "val_critic_loss": 0.0, + "val_decoder_biou": 0.3846593878308497, + "val_decoder_dice": 0.770921132483555, + "val_decoder_iou": 0.6801783568719756, + "val_dice": 0.7881040809577887, + "val_dice_gain": 0.01718294847423374, + "val_dice_loss": 0.0, + "val_entropy": 0.0, + "val_iou": 0.7043000084034938, + "val_iou_gain": 0.02412165153151824, + "val_loss": -0.1407079979617265, + "val_refine_score": 0.5690854018897675, + "val_reward": 0.01407079979617265, + "validated_this_epoch": true + }, + { + "alpha": null, + "early_stopping_active": true, + "early_stopping_best_value": 0.5724109242210832, + "early_stopping_improved": false, + "early_stopping_min_delta": 0.0, + "early_stopping_monitor_mode": "max", + "early_stopping_monitor_name": "val_refine_score", + "early_stopping_monitor_value": 0.5687947227648368, + "early_stopping_patience": 30, + "early_stopping_start_epoch": 30, + "early_stopping_wait": 15, + "encoder_lr": 3.5386416045792574e-05, + "epoch": 87, + "epoch_seconds": 12.35741916205734, + "grad_norm": 1.0067388848824934, + "lr": 3.5386416045792574e-05, + "selection_metric_name": "val_refine_score", + "selection_metric_value": 0.5687947227648368, + "strategy3_bootstrap_loaded": true, + "strategy3_decoder_state": "frozen", + "strategy3_encoder_state": "frozen", + "strategy3_freeze_active": true, + "strategy3_freeze_requested": true, + "strategy3_segmentation_head_state": "frozen", + "train_action_distribution": { + "max_abs_delta": 0.10009765625, + "mean_abs_delta": 0.03686162698167292, + "mean_delta": -0.026945658832449804, + "near_zero_pct": 3.977445611657128e-05, + "negative_pct": 91.23681336641312, + "positive_pct": 8.76314922828566 + }, + "train_actor_loss": -0.023909641810777513, + "train_advantage_mean": 0.0, + "train_advantage_std": 0.0, + "train_alpha": 0.0, + "train_annealed_aux_ce_weight": 0.040000000000000015, + "train_biou_delta_mean": 0.0239096418954432, + "train_ce_loss": 0.14931399510665375, + "train_critic_loss": 0.0, + "train_dice": 0.9156140622221415, + "train_dice_loss": 0.07042172280224887, + "train_effective_steps": 8.0, + "train_entropy": 0.0, + "train_entropy_bonus_used": 0.0, + "train_entropy_loss": 0.0, + "train_iou": 0.855852944495462, + "train_loss": -0.23470170660452408, + "train_mask_delta_mean": 0.036851362748579544, + "train_mean_reward": 0.023909641810777513, + "train_mean_value_pred": 0.0, + "train_reinforce_loss": 0.0, + "train_reward_zeros_pct": 0.3314394038170576, + "train_rl_loss_scale": 10.0, + "train_value_pred_error": 0.0, + "val_actor_loss": -0.01415562099282397, + "val_binary_flips_correct_pct": 0.4112505445293352, + "val_binary_flips_total_pct": 0.7564769071691176, + "val_binary_flips_wrong_pct": 0.34522636263978246, + "val_biou": 0.4334674082111227, + "val_biou_gain": 0.04880802038027299, + "val_ce_loss": 0.0, + "val_critic_loss": 0.0, + "val_decoder_biou": 0.3846593878308497, + "val_decoder_dice": 0.770921132483555, + "val_decoder_iou": 0.6801783568719756, + "val_dice": 0.7878839609641023, + "val_dice_gain": 0.01696282848054731, + "val_dice_loss": 0.0, + "val_entropy": 0.0, + "val_iou": 0.7041220373185509, + "val_iou_gain": 0.023943680446575355, + "val_loss": -0.1415562099282397, + "val_refine_score": 0.5687947227648368, + "val_reward": 0.01415562099282397, + "validated_this_epoch": true + }, + { + "alpha": null, + "early_stopping_active": true, + "early_stopping_best_value": 0.5724109242210832, + "early_stopping_improved": false, + "early_stopping_min_delta": 0.0, + "early_stopping_monitor_mode": "max", + "early_stopping_monitor_name": "val_refine_score", + "early_stopping_monitor_value": 0.5679433886641615, + "early_stopping_patience": 30, + "early_stopping_start_epoch": 30, + "early_stopping_wait": 16, + "encoder_lr": 3.3455710408595215e-05, + "epoch": 88, + "epoch_seconds": 12.313281010836363, + "grad_norm": 0.96778911894018, + "lr": 3.3455710408595215e-05, + "selection_metric_name": "val_refine_score", + "selection_metric_value": 0.5679433886641615, + "strategy3_bootstrap_loaded": true, + "strategy3_decoder_state": "frozen", + "strategy3_encoder_state": "frozen", + "strategy3_freeze_active": true, + "strategy3_freeze_requested": true, + "strategy3_segmentation_head_state": "frozen", + "train_action_distribution": { + "max_abs_delta": 0.10009765625, + "mean_abs_delta": 0.0333885014988482, + "mean_delta": -0.023012201217087833, + "near_zero_pct": 5.0649689791787914e-05, + "negative_pct": 91.09929278492928, + "positive_pct": 8.90065867623145 + }, + "train_actor_loss": -0.0243609720306598, + "train_advantage_mean": 0.0, + "train_advantage_std": 0.0, + "train_alpha": 0.0, + "train_annealed_aux_ce_weight": 0.040000000000000015, + "train_biou_delta_mean": 0.024360971797829156, + "train_ce_loss": 0.15750064904039557, + "train_critic_loss": 0.0, + "train_dice": 0.913614940951191, + "train_dice_loss": 0.07433390075510199, + "train_effective_steps": 8.0, + "train_entropy": 0.0, + "train_entropy_bonus_used": 0.0, + "train_entropy_loss": 0.0, + "train_iou": 0.8545277898865852, + "train_loss": -0.23897303369912234, + "train_mask_delta_mean": 0.03338623046875, + "train_mean_reward": 0.0243609720306598, + "train_mean_value_pred": 0.0, + "train_reinforce_loss": 0.0, + "train_reward_zeros_pct": 0.7812500232830644, + "train_rl_loss_scale": 10.0, + "train_value_pred_error": 0.0, + "val_actor_loss": -0.01414886032580398, + "val_binary_flips_correct_pct": 0.4111121682559743, + "val_binary_flips_total_pct": 0.7701200597426471, + "val_binary_flips_wrong_pct": 0.3590078914866728, + "val_biou": 0.4331252231066854, + "val_biou_gain": 0.0484658352758357, + "val_ce_loss": 0.0, + "val_critic_loss": 0.0, + "val_decoder_biou": 0.3846593878308497, + "val_decoder_dice": 0.770921132483555, + "val_decoder_iou": 0.6801783568719756, + "val_dice": 0.786703829085541, + "val_dice_gain": 0.015782696601986057, + "val_dice_loss": 0.0, + "val_entropy": 0.0, + "val_iou": 0.7027615542216377, + "val_iou_gain": 0.022583197349662076, + "val_loss": -0.1414886032580398, + "val_refine_score": 0.5679433886641615, + "val_reward": 0.01414886032580398, + "validated_this_epoch": true + }, + { + "alpha": null, + "early_stopping_active": true, + "early_stopping_best_value": 0.5724109242210832, + "early_stopping_improved": false, + "early_stopping_min_delta": 0.0, + "early_stopping_monitor_mode": "max", + "early_stopping_monitor_name": "val_refine_score", + "early_stopping_monitor_value": 0.5683102116036225, + "early_stopping_patience": 30, + "early_stopping_start_epoch": 30, + "early_stopping_wait": 17, + "encoder_lr": 3.156998875035742e-05, + "epoch": 89, + "epoch_seconds": 12.363200679887086, + "grad_norm": 0.9277423403479836, + "lr": 3.156998875035742e-05, + "selection_metric_name": "val_refine_score", + "selection_metric_value": 0.5683102116036225, + "strategy3_bootstrap_loaded": true, + "strategy3_decoder_state": "frozen", + "strategy3_encoder_state": "frozen", + "strategy3_freeze_active": true, + "strategy3_freeze_requested": true, + "strategy3_segmentation_head_state": "frozen", + "train_action_distribution": { + "max_abs_delta": 0.10009765625, + "mean_abs_delta": 0.03423508739268238, + "mean_delta": -0.024115687828849663, + "near_zero_pct": 4.707531231092203e-05, + "negative_pct": 91.18092595176263, + "positive_pct": 8.819029370153492 + }, + "train_actor_loss": -0.02405603761805899, + "train_advantage_mean": 0.0, + "train_advantage_std": 0.0, + "train_alpha": 0.0, + "train_annealed_aux_ce_weight": 0.040000000000000015, + "train_biou_delta_mean": 0.02405603766039183, + "train_ce_loss": 0.15328062257983469, + "train_critic_loss": 0.0, + "train_dice": 0.9134207215210872, + "train_dice_loss": 0.07164810462431474, + "train_effective_steps": 8.0, + "train_entropy": 0.0, + "train_entropy_bonus_used": 0.0, + "train_entropy_loss": 0.0, + "train_iou": 0.8525352331382193, + "train_loss": -0.23606180196458643, + "train_mask_delta_mean": 0.03424072265625, + "train_mean_reward": 0.02405603761805899, + "train_mean_value_pred": 0.0, + "train_reinforce_loss": 0.0, + "train_reward_zeros_pct": 0.3077651606872678, + "train_rl_loss_scale": 10.0, + "train_value_pred_error": 0.0, + "val_actor_loss": -0.014242907247535186, + "val_binary_flips_correct_pct": 0.42006922703163296, + "val_binary_flips_total_pct": 0.7844102148916208, + "val_binary_flips_wrong_pct": 0.3643409878599877, + "val_biou": 0.4327293997762711, + "val_biou_gain": 0.04807001194542143, + "val_ce_loss": 0.0, + "val_critic_loss": 0.0, + "val_decoder_biou": 0.3846593878308497, + "val_decoder_dice": 0.770921132483555, + "val_decoder_iou": 0.6801783568719756, + "val_dice": 0.7875654543927662, + "val_dice_gain": 0.01664432190921117, + "val_dice_loss": 0.0, + "val_entropy": 0.0, + "val_iou": 0.7038910234309739, + "val_iou_gain": 0.023712666558998285, + "val_loss": -0.14242907247535186, + "val_refine_score": 0.5683102116036225, + "val_reward": 0.014242907247535186, + "validated_this_epoch": true + }, + { + "alpha": null, + "early_stopping_active": true, + "early_stopping_best_value": 0.5724109242210832, + "early_stopping_improved": false, + "early_stopping_min_delta": 0.0, + "early_stopping_monitor_mode": "max", + "early_stopping_monitor_name": "val_refine_score", + "early_stopping_monitor_value": 0.5689597082214218, + "early_stopping_patience": 30, + "early_stopping_start_epoch": 30, + "early_stopping_wait": 18, + "encoder_lr": 2.973054345050999e-05, + "epoch": 90, + "epoch_seconds": 12.340369545854628, + "grad_norm": 0.9396879347887906, + "lr": 2.973054345050999e-05, + "selection_metric_name": "val_refine_score", + "selection_metric_value": 0.5689597082214218, + "strategy3_bootstrap_loaded": true, + "strategy3_decoder_state": "frozen", + "strategy3_encoder_state": "frozen", + "strategy3_freeze_active": true, + "strategy3_freeze_requested": true, + "strategy3_segmentation_head_state": "frozen", + "train_action_distribution": { + "max_abs_delta": 0.10009765625, + "mean_abs_delta": 0.035250940402461725, + "mean_delta": -0.025365348227999428, + "near_zero_pct": 3.0724436586834514e-05, + "negative_pct": 91.21275903149085, + "positive_pct": 8.787212410772389 + }, + "train_actor_loss": -0.024443591831103815, + "train_advantage_mean": 0.0, + "train_advantage_std": 0.0, + "train_alpha": 0.0, + "train_annealed_aux_ce_weight": 0.040000000000000015, + "train_biou_delta_mean": 0.024443591534773903, + "train_ce_loss": 0.15226948328993536, + "train_critic_loss": 0.0, + "train_dice": 0.9138443882900918, + "train_dice_loss": 0.07196881554343483, + "train_effective_steps": 8.0, + "train_entropy": 0.0, + "train_entropy_bonus_used": 0.0, + "train_entropy_loss": 0.0, + "train_iou": 0.8534829211896133, + "train_loss": -0.2399511526931416, + "train_mask_delta_mean": 0.035261674360795456, + "train_mean_reward": 0.024443591831103815, + "train_mean_value_pred": 0.0, + "train_reinforce_loss": 0.0, + "train_reward_zeros_pct": 0.5170953057875688, + "train_rl_loss_scale": 10.0, + "train_value_pred_error": 0.0, + "val_actor_loss": -0.014163179468596354, + "val_binary_flips_correct_pct": 0.4150091433057598, + "val_binary_flips_total_pct": 0.7948781929764093, + "val_binary_flips_wrong_pct": 0.3798690496706495, + "val_biou": 0.4333498650514805, + "val_biou_gain": 0.0486904772206308, + "val_ce_loss": 0.0, + "val_critic_loss": 0.0, + "val_decoder_biou": 0.3846593878308497, + "val_decoder_dice": 0.770921132483555, + "val_decoder_iou": 0.6801783568719756, + "val_dice": 0.788165231550235, + "val_dice_gain": 0.017244099066680008, + "val_dice_loss": 0.0, + "val_entropy": 0.0, + "val_iou": 0.7045695513913631, + "val_iou_gain": 0.024391194519387538, + "val_loss": -0.14163179468596354, + "val_refine_score": 0.5689597082214218, + "val_reward": 0.014163179468596354, + "validated_this_epoch": true + }, + { + "alpha": null, + "early_stopping_active": true, + "early_stopping_best_value": 0.5724109242210832, + "early_stopping_improved": false, + "early_stopping_min_delta": 0.0, + "early_stopping_monitor_mode": "max", + "early_stopping_monitor_name": "val_refine_score", + "early_stopping_monitor_value": 0.5669322900017265, + "early_stopping_patience": 30, + "early_stopping_start_epoch": 30, + "early_stopping_wait": 19, + "encoder_lr": 2.7938635172978998e-05, + "epoch": 91, + "epoch_seconds": 12.353195954114199, + "grad_norm": 1.003822391683405, + "lr": 2.7938635172978998e-05, + "selection_metric_name": "val_refine_score", + "selection_metric_value": 0.5669322900017265, + "strategy3_bootstrap_loaded": true, + "strategy3_decoder_state": "frozen", + "strategy3_encoder_state": "frozen", + "strategy3_freeze_active": true, + "strategy3_freeze_requested": true, + "strategy3_segmentation_head_state": "frozen", + "train_action_distribution": { + "max_abs_delta": 0.10009765625, + "mean_abs_delta": 0.03577643586322665, + "mean_delta": -0.025289677252823658, + "near_zero_pct": 3.3310156378650966e-05, + "negative_pct": 91.15266840566288, + "positive_pct": 8.84730045429685 + }, + "train_actor_loss": -0.02471621933827092, + "train_advantage_mean": 0.0, + "train_advantage_std": 0.0, + "train_alpha": 0.0, + "train_annealed_aux_ce_weight": 0.040000000000000015, + "train_biou_delta_mean": 0.024716219211272386, + "train_ce_loss": 0.15040427446365356, + "train_critic_loss": 0.0, + "train_dice": 0.9165543913143734, + "train_dice_loss": 0.07129991054534912, + "train_effective_steps": 8.0, + "train_entropy": 0.0, + "train_entropy_bonus_used": 0.0, + "train_entropy_loss": 0.0, + "train_iou": 0.8567277601722377, + "train_loss": -0.24272810870950873, + "train_mask_delta_mean": 0.035780473188920456, + "train_mean_reward": 0.02471621933827092, + "train_mean_value_pred": 0.0, + "train_reinforce_loss": 0.0, + "train_reward_zeros_pct": 0.1657197019085288, + "train_rl_loss_scale": 10.0, + "train_value_pred_error": 0.0, + "val_actor_loss": -0.013706309902772773, + "val_binary_flips_correct_pct": 0.4333982280656403, + "val_binary_flips_total_pct": 0.8418662875306373, + "val_binary_flips_wrong_pct": 0.4084680594649969, + "val_biou": 0.43041356348470167, + "val_biou_gain": 0.04575417565385198, + "val_ce_loss": 0.0, + "val_critic_loss": 0.0, + "val_decoder_biou": 0.3846593878308497, + "val_decoder_dice": 0.770921132483555, + "val_decoder_iou": 0.6801783568719756, + "val_dice": 0.7878729472674341, + "val_dice_gain": 0.016951814783879082, + "val_dice_loss": 0.0, + "val_entropy": 0.0, + "val_iou": 0.7034510165187513, + "val_iou_gain": 0.023272659646775717, + "val_loss": -0.13706309902772773, + "val_refine_score": 0.5669322900017265, + "val_reward": 0.013706309902772773, + "validated_this_epoch": true + }, + { + "alpha": null, + "early_stopping_active": true, + "early_stopping_best_value": 0.5724109242210832, + "early_stopping_improved": false, + "early_stopping_min_delta": 0.0, + "early_stopping_monitor_mode": "max", + "early_stopping_monitor_name": "val_refine_score", + "early_stopping_monitor_value": 0.5662107155230192, + "early_stopping_patience": 30, + "early_stopping_start_epoch": 30, + "early_stopping_wait": 20, + "encoder_lr": 2.6195492002190097e-05, + "epoch": 92, + "epoch_seconds": 12.329163054935634, + "grad_norm": 0.9835955012928356, + "lr": 2.6195492002190097e-05, + "selection_metric_name": "val_refine_score", + "selection_metric_value": 0.5662107155230192, + "strategy3_bootstrap_loaded": true, + "strategy3_decoder_state": "frozen", + "strategy3_encoder_state": "frozen", + "strategy3_freeze_active": true, + "strategy3_freeze_requested": true, + "strategy3_segmentation_head_state": "frozen", + "train_action_distribution": { + "max_abs_delta": 0.10009765625, + "mean_abs_delta": 0.035723974208601496, + "mean_delta": -0.025215879252011127, + "near_zero_pct": 3.612402821318028e-05, + "negative_pct": 91.15028950301084, + "positive_pct": 8.849676393649794 + }, + "train_actor_loss": -0.024416144029766492, + "train_advantage_mean": 0.0, + "train_advantage_std": 0.0, + "train_alpha": 0.0, + "train_annealed_aux_ce_weight": 0.040000000000000015, + "train_biou_delta_mean": 0.024416144156765022, + "train_ce_loss": 0.1573470045219768, + "train_critic_loss": 0.0, + "train_dice": 0.9153220451032763, + "train_dice_loss": 0.07411642508073286, + "train_effective_steps": 8.0, + "train_entropy": 0.0, + "train_entropy_bonus_used": 0.0, + "train_entropy_loss": 0.0, + "train_iou": 0.8555047239937807, + "train_loss": -0.23953217538920316, + "train_mask_delta_mean": 0.03571666370738636, + "train_mean_reward": 0.024416144029766492, + "train_mean_value_pred": 0.0, + "train_reinforce_loss": 0.0, + "train_reward_zeros_pct": 0.44981061946600676, + "train_rl_loss_scale": 10.0, + "train_value_pred_error": 0.0, + "val_actor_loss": -0.013897397642722353, + "val_binary_flips_correct_pct": 0.41224161783854163, + "val_binary_flips_total_pct": 0.8023430319393382, + "val_binary_flips_wrong_pct": 0.3901014141007966, + "val_biou": 0.43104787962453517, + "val_biou_gain": 0.04638849179368548, + "val_ce_loss": 0.0, + "val_critic_loss": 0.0, + "val_decoder_biou": 0.3846593878308497, + "val_decoder_dice": 0.770921132483555, + "val_decoder_iou": 0.6801783568719756, + "val_dice": 0.785732069361731, + "val_dice_gain": 0.014810936878176029, + "val_dice_loss": 0.0, + "val_entropy": 0.0, + "val_iou": 0.7013735514215031, + "val_iou_gain": 0.021195194549527563, + "val_loss": -0.13897397642722353, + "val_refine_score": 0.5662107155230192, + "val_reward": 0.013897397642722353, + "validated_this_epoch": true + }, + { + "alpha": null, + "early_stopping_active": true, + "early_stopping_best_value": 0.5724109242210832, + "early_stopping_improved": false, + "early_stopping_min_delta": 0.0, + "early_stopping_monitor_mode": "max", + "early_stopping_monitor_name": "val_refine_score", + "early_stopping_monitor_value": 0.5686094265228376, + "early_stopping_patience": 30, + "early_stopping_start_epoch": 30, + "early_stopping_wait": 21, + "encoder_lr": 2.450230860140054e-05, + "epoch": 93, + "epoch_seconds": 12.365714922081679, + "grad_norm": 1.1231881109150974, + "lr": 2.450230860140054e-05, + "selection_metric_name": "val_refine_score", + "selection_metric_value": 0.5686094265228376, + "strategy3_bootstrap_loaded": true, + "strategy3_decoder_state": "frozen", + "strategy3_encoder_state": "frozen", + "strategy3_freeze_active": true, + "strategy3_freeze_requested": true, + "strategy3_segmentation_head_state": "frozen", + "train_action_distribution": { + "max_abs_delta": 0.10009765625, + "mean_abs_delta": 0.03387833301993934, + "mean_delta": -0.023818666094236753, + "near_zero_pct": 8.525270567877834e-05, + "negative_pct": 91.04282239621335, + "positive_pct": 8.957094368948178 + }, + "train_actor_loss": -0.024238887822403656, + "train_advantage_mean": 0.0, + "train_advantage_std": 0.0, + "train_alpha": 0.0, + "train_annealed_aux_ce_weight": 0.040000000000000015, + "train_biou_delta_mean": 0.024238887822403656, + "train_ce_loss": 0.15626689114353873, + "train_critic_loss": 0.0, + "train_dice": 0.9134939673726276, + "train_dice_loss": 0.07278157364238393, + "train_effective_steps": 8.0, + "train_entropy": 0.0, + "train_entropy_bonus_used": 0.0, + "train_entropy_loss": 0.0, + "train_iou": 0.8537480715992251, + "train_loss": -0.2378079119053754, + "train_mask_delta_mean": 0.03387173739346591, + "train_mean_reward": 0.024238887822403656, + "train_mean_value_pred": 0.0, + "train_reinforce_loss": 0.0, + "train_reward_zeros_pct": 0.4261363763362169, + "train_rl_loss_scale": 10.0, + "train_value_pred_error": 0.0, + "val_actor_loss": -0.014454267104156315, + "val_binary_flips_correct_pct": 0.40639615526386336, + "val_binary_flips_total_pct": 0.739284590178845, + "val_binary_flips_wrong_pct": 0.3328884349149816, + "val_biou": 0.43395570469843503, + "val_biou_gain": 0.049296316867585344, + "val_ce_loss": 0.0, + "val_critic_loss": 0.0, + "val_decoder_biou": 0.3846593878308497, + "val_decoder_dice": 0.770921132483555, + "val_decoder_iou": 0.6801783568719756, + "val_dice": 0.7865743210939351, + "val_dice_gain": 0.01565318861038012, + "val_dice_loss": 0.0, + "val_entropy": 0.0, + "val_iou": 0.7032631483472401, + "val_iou_gain": 0.023084791475264543, + "val_loss": -0.14454267104156315, + "val_refine_score": 0.5686094265228376, + "val_reward": 0.014454267104156315, + "validated_this_epoch": true + }, + { + "alpha": null, + "early_stopping_active": true, + "early_stopping_best_value": 0.5724109242210832, + "early_stopping_improved": false, + "early_stopping_min_delta": 0.0, + "early_stopping_monitor_mode": "max", + "early_stopping_monitor_name": "val_refine_score", + "early_stopping_monitor_value": 0.5674606688048979, + "early_stopping_patience": 30, + "early_stopping_start_epoch": 30, + "early_stopping_wait": 22, + "encoder_lr": 2.286024539393689e-05, + "epoch": 94, + "epoch_seconds": 12.383852026890963, + "grad_norm": 1.0174602432684465, + "lr": 2.286024539393689e-05, + "selection_metric_name": "val_refine_score", + "selection_metric_value": 0.5674606688048979, + "strategy3_bootstrap_loaded": true, + "strategy3_decoder_state": "frozen", + "strategy3_encoder_state": "frozen", + "strategy3_freeze_active": true, + "strategy3_freeze_requested": true, + "strategy3_segmentation_head_state": "frozen", + "train_action_distribution": { + "max_abs_delta": 0.10009765625, + "mean_abs_delta": 0.035381415096873585, + "mean_delta": -0.024719579822637817, + "near_zero_pct": 3.148494236236068e-05, + "negative_pct": 91.12574607133865, + "positive_pct": 8.874224575067108 + }, + "train_actor_loss": -0.024589614929440853, + "train_advantage_mean": 0.0, + "train_advantage_std": 0.0, + "train_alpha": 0.0, + "train_annealed_aux_ce_weight": 0.040000000000000015, + "train_biou_delta_mean": 0.024589614844775166, + "train_ce_loss": 0.142485266382044, + "train_critic_loss": 0.0, + "train_dice": 0.9190114874281552, + "train_dice_loss": 0.06779916719956831, + "train_effective_steps": 8.0, + "train_entropy": 0.0, + "train_entropy_bonus_used": 0.0, + "train_entropy_loss": 0.0, + "train_iou": 0.8598098233705626, + "train_loss": -0.24169046228582208, + "train_mask_delta_mean": 0.035383744673295456, + "train_mean_reward": 0.024589614929440853, + "train_mean_value_pred": 0.0, + "train_reinforce_loss": 0.0, + "train_reward_zeros_pct": 0.2604166744276881, + "train_rl_loss_scale": 10.0, + "train_value_pred_error": 0.0, + "val_actor_loss": -0.013973255110613536, + "val_binary_flips_correct_pct": 0.44979394650926774, + "val_binary_flips_total_pct": 0.8612352259018843, + "val_binary_flips_wrong_pct": 0.41144127939261643, + "val_biou": 0.4315826932849286, + "val_biou_gain": 0.04692330545407891, + "val_ce_loss": 0.0, + "val_critic_loss": 0.0, + "val_decoder_biou": 0.3846593878308497, + "val_decoder_dice": 0.770921132483555, + "val_decoder_iou": 0.6801783568719756, + "val_dice": 0.7879374766157733, + "val_dice_gain": 0.01701634413221831, + "val_dice_loss": 0.0, + "val_entropy": 0.0, + "val_iou": 0.7033386443248671, + "val_iou_gain": 0.02316028745289156, + "val_loss": -0.13973255110613536, + "val_refine_score": 0.5674606688048979, + "val_reward": 0.013973255110613536, + "validated_this_epoch": true + }, + { + "alpha": null, + "early_stopping_active": true, + "early_stopping_best_value": 0.5724109242210832, + "early_stopping_improved": false, + "early_stopping_min_delta": 0.0, + "early_stopping_monitor_mode": "max", + "early_stopping_monitor_name": "val_refine_score", + "early_stopping_monitor_value": 0.5696560664535744, + "early_stopping_patience": 30, + "early_stopping_start_epoch": 30, + "early_stopping_wait": 23, + "encoder_lr": 2.1270427767898626e-05, + "epoch": 95, + "epoch_seconds": 12.371166835073382, + "grad_norm": 0.9790084741332314, + "lr": 2.1270427767898626e-05, + "selection_metric_name": "val_refine_score", + "selection_metric_value": 0.5696560664535744, + "strategy3_bootstrap_loaded": true, + "strategy3_decoder_state": "frozen", + "strategy3_encoder_state": "frozen", + "strategy3_freeze_active": true, + "strategy3_freeze_requested": true, + "strategy3_segmentation_head_state": "frozen", + "train_action_distribution": { + "max_abs_delta": 0.10009765625, + "mean_abs_delta": 0.03524389981546185, + "mean_delta": -0.02475905179215426, + "near_zero_pct": 4.661900887144425e-05, + "negative_pct": 91.14634828134017, + "positive_pct": 8.853607049042528 + }, + "train_actor_loss": -0.024628912363286046, + "train_advantage_mean": 0.0, + "train_advantage_std": 0.0, + "train_alpha": 0.0, + "train_annealed_aux_ce_weight": 0.040000000000000015, + "train_biou_delta_mean": 0.024628912193954668, + "train_ce_loss": 0.1576985554261641, + "train_critic_loss": 0.0, + "train_dice": 0.9138474438535412, + "train_dice_loss": 0.0730579061941667, + "train_effective_steps": 8.0, + "train_entropy": 0.0, + "train_entropy_bonus_used": 0.0, + "train_entropy_loss": 0.0, + "train_iou": 0.8544155544606742, + "train_loss": -0.24167399108409882, + "train_mask_delta_mean": 0.03524502840909091, + "train_mean_reward": 0.024628912363286046, + "train_mean_value_pred": 0.0, + "train_reinforce_loss": 0.0, + "train_reward_zeros_pct": 0.3314394038170576, + "train_rl_loss_scale": 10.0, + "train_value_pred_error": 0.0, + "val_actor_loss": -0.014269147788581904, + "val_binary_flips_correct_pct": 0.43819277894263176, + "val_binary_flips_total_pct": 0.828092238482307, + "val_binary_flips_wrong_pct": 0.3898994595396752, + "val_biou": 0.4337149281021249, + "val_biou_gain": 0.04905554027127523, + "val_ce_loss": 0.0, + "val_critic_loss": 0.0, + "val_decoder_biou": 0.3846593878308497, + "val_decoder_dice": 0.770921132483555, + "val_decoder_iou": 0.6801783568719756, + "val_dice": 0.7893871902600232, + "val_dice_gain": 0.01846605777646826, + "val_dice_loss": 0.0, + "val_entropy": 0.0, + "val_iou": 0.7055972048050237, + "val_iou_gain": 0.02541884793304816, + "val_loss": -0.14269147788581904, + "val_refine_score": 0.5696560664535744, + "val_reward": 0.014269147788581904, + "validated_this_epoch": true + }, + { + "alpha": null, + "early_stopping_active": true, + "early_stopping_best_value": 0.5724109242210832, + "early_stopping_improved": false, + "early_stopping_min_delta": 0.0, + "early_stopping_monitor_mode": "max", + "early_stopping_monitor_name": "val_refine_score", + "early_stopping_monitor_value": 0.5699364110626828, + "early_stopping_patience": 30, + "early_stopping_start_epoch": 30, + "early_stopping_wait": 24, + "encoder_lr": 1.973394530487351e-05, + "epoch": 96, + "epoch_seconds": 12.35915036033839, + "grad_norm": 1.0578352483836087, + "lr": 1.973394530487351e-05, + "selection_metric_name": "val_refine_score", + "selection_metric_value": 0.5699364110626828, + "strategy3_bootstrap_loaded": true, + "strategy3_decoder_state": "frozen", + "strategy3_encoder_state": "frozen", + "strategy3_freeze_active": true, + "strategy3_freeze_requested": true, + "strategy3_segmentation_head_state": "frozen", + "train_action_distribution": { + "max_abs_delta": 0.10009765625, + "mean_abs_delta": 0.03477531777356158, + "mean_delta": -0.02428042626177723, + "near_zero_pct": 3.080048700935963e-05, + "negative_pct": 91.23264347965068, + "positive_pct": 8.767328182743354 + }, + "train_actor_loss": -0.02469782714615576, + "train_advantage_mean": 0.0, + "train_advantage_std": 0.0, + "train_alpha": 0.0, + "train_annealed_aux_ce_weight": 0.040000000000000015, + "train_biou_delta_mean": 0.024697827103822914, + "train_ce_loss": 0.15822376378557898, + "train_critic_loss": 0.0, + "train_dice": 0.9125000671320576, + "train_dice_loss": 0.07458508014678955, + "train_effective_steps": 8.0, + "train_entropy": 0.0, + "train_entropy_bonus_used": 0.0, + "train_entropy_loss": 0.0, + "train_iou": 0.853172526701907, + "train_loss": -0.242322100834413, + "train_mask_delta_mean": 0.034773393110795456, + "train_mean_reward": 0.02469782714615576, + "train_mean_value_pred": 0.0, + "train_reinforce_loss": 0.0, + "train_reward_zeros_pct": 0.4024621332064271, + "train_rl_loss_scale": 10.0, + "train_value_pred_error": 0.0, + "val_actor_loss": -0.01452591248380486, + "val_binary_flips_correct_pct": 0.42790431602328427, + "val_binary_flips_total_pct": 0.7790883382161458, + "val_binary_flips_wrong_pct": 0.35118402219286154, + "val_biou": 0.4355351951027164, + "val_biou_gain": 0.05087580727186669, + "val_ce_loss": 0.0, + "val_critic_loss": 0.0, + "val_decoder_biou": 0.3846593878308497, + "val_decoder_dice": 0.770921132483555, + "val_decoder_iou": 0.6801783568719756, + "val_dice": 0.7877066699189565, + "val_dice_gain": 0.016785537435401565, + "val_dice_loss": 0.0, + "val_entropy": 0.0, + "val_iou": 0.7043376270226491, + "val_iou_gain": 0.02415927015067354, + "val_loss": -0.1452591248380486, + "val_refine_score": 0.5699364110626828, + "val_reward": 0.01452591248380486, + "validated_this_epoch": true + }, + { + "alpha": null, + "early_stopping_active": true, + "early_stopping_best_value": 0.5724109242210832, + "early_stopping_improved": false, + "early_stopping_min_delta": 0.0, + "early_stopping_monitor_mode": "max", + "early_stopping_monitor_name": "val_refine_score", + "early_stopping_monitor_value": 0.5702480578930486, + "early_stopping_patience": 30, + "early_stopping_start_epoch": 30, + "early_stopping_wait": 25, + "encoder_lr": 1.8251851033192653e-05, + "epoch": 97, + "epoch_seconds": 12.338033674284816, + "grad_norm": 1.0607248490506953, + "lr": 1.8251851033192653e-05, + "selection_metric_name": "val_refine_score", + "selection_metric_value": 0.5702480578930486, + "strategy3_bootstrap_loaded": true, + "strategy3_decoder_state": "frozen", + "strategy3_encoder_state": "frozen", + "strategy3_freeze_active": true, + "strategy3_freeze_requested": true, + "strategy3_segmentation_head_state": "frozen", + "train_action_distribution": { + "max_abs_delta": 0.10009765625, + "mean_abs_delta": 0.03336188656447286, + "mean_delta": -0.022779643662612547, + "near_zero_pct": 7.985311456919094e-05, + "negative_pct": 91.15662229332057, + "positive_pct": 8.843299691480668 + }, + "train_actor_loss": -0.024736739411971277, + "train_advantage_mean": 0.0, + "train_advantage_std": 0.0, + "train_alpha": 0.0, + "train_annealed_aux_ce_weight": 0.040000000000000015, + "train_biou_delta_mean": 0.024736739877632564, + "train_ce_loss": 0.15664756839925592, + "train_critic_loss": 0.0, + "train_dice": 0.9126987500482384, + "train_dice_loss": 0.07466457106850365, + "train_effective_steps": 8.0, + "train_entropy": 0.0, + "train_entropy_bonus_used": 0.0, + "train_entropy_loss": 0.0, + "train_iou": 0.8542994262427046, + "train_loss": -0.24274115128950638, + "train_mask_delta_mean": 0.03336819735440341, + "train_mean_reward": 0.024736739411971277, + "train_mean_value_pred": 0.0, + "train_reinforce_loss": 0.0, + "train_reward_zeros_pct": 0.5445075919851661, + "train_rl_loss_scale": 10.0, + "train_value_pred_error": 0.0, + "val_actor_loss": -0.01452956760476809, + "val_binary_flips_correct_pct": 0.44108746098537066, + "val_binary_flips_total_pct": 0.8193857529584099, + "val_binary_flips_wrong_pct": 0.3782982919730392, + "val_biou": 0.4349465645934743, + "val_biou_gain": 0.05028717676262462, + "val_ce_loss": 0.0, + "val_critic_loss": 0.0, + "val_decoder_biou": 0.3846593878308497, + "val_decoder_dice": 0.770921132483555, + "val_decoder_iou": 0.6801783568719756, + "val_dice": 0.7888680156506115, + "val_dice_gain": 0.017946883167056504, + "val_dice_loss": 0.0, + "val_entropy": 0.0, + "val_iou": 0.7055495511926227, + "val_iou_gain": 0.02537119432064716, + "val_loss": -0.1452956760476809, + "val_refine_score": 0.5702480578930486, + "val_reward": 0.01452956760476809, + "validated_this_epoch": true + }, + { + "alpha": null, + "early_stopping_active": true, + "early_stopping_best_value": 0.5724109242210832, + "early_stopping_improved": false, + "early_stopping_min_delta": 0.0, + "early_stopping_monitor_mode": "max", + "early_stopping_monitor_name": "val_refine_score", + "early_stopping_monitor_value": 0.5711344430162328, + "early_stopping_patience": 30, + "early_stopping_start_epoch": 30, + "early_stopping_wait": 26, + "encoder_lr": 1.682516070623759e-05, + "epoch": 98, + "epoch_seconds": 12.365045913960785, + "grad_norm": 1.030560477213426, + "lr": 1.682516070623759e-05, + "selection_metric_name": "val_refine_score", + "selection_metric_value": 0.5711344430162328, + "strategy3_bootstrap_loaded": true, + "strategy3_decoder_state": "frozen", + "strategy3_encoder_state": "frozen", + "strategy3_freeze_active": true, + "strategy3_freeze_requested": true, + "strategy3_segmentation_head_state": "frozen", + "train_action_distribution": { + "max_abs_delta": 0.10009765625, + "mean_abs_delta": 0.03851897900246761, + "mean_delta": -0.028185339940881186, + "near_zero_pct": 2.205466981567125e-05, + "negative_pct": 91.23336313800378, + "positive_pct": 8.766616677696055 + }, + "train_actor_loss": -0.024676751345396042, + "train_advantage_mean": 0.0, + "train_advantage_std": 0.0, + "train_alpha": 0.0, + "train_annealed_aux_ce_weight": 0.040000000000000015, + "train_biou_delta_mean": 0.02467675143006173, + "train_ce_loss": 0.15709589692679318, + "train_critic_loss": 0.0, + "train_dice": 0.9124403108562672, + "train_dice_loss": 0.07379612597552213, + "train_effective_steps": 8.0, + "train_entropy": 0.0, + "train_entropy_bonus_used": 0.0, + "train_entropy_loss": 0.0, + "train_iou": 0.8531665183895503, + "train_loss": -0.2421496713703329, + "train_mask_delta_mean": 0.038527055220170456, + "train_mean_reward": 0.024676751345396042, + "train_mean_value_pred": 0.0, + "train_reinforce_loss": 0.0, + "train_reward_zeros_pct": 0.6591407645663078, + "train_rl_loss_scale": 10.0, + "train_value_pred_error": 0.0, + "val_actor_loss": -0.014560741608875105, + "val_binary_flips_correct_pct": 0.4284241620232077, + "val_binary_flips_total_pct": 0.7787704467773438, + "val_binary_flips_wrong_pct": 0.35034628475413604, + "val_biou": 0.4367731449385604, + "val_biou_gain": 0.05211375710771071, + "val_ce_loss": 0.0, + "val_critic_loss": 0.0, + "val_decoder_biou": 0.3846593878308497, + "val_decoder_dice": 0.770921132483555, + "val_decoder_iou": 0.6801783568719756, + "val_dice": 0.7886238135872568, + "val_dice_gain": 0.017702681103701767, + "val_dice_loss": 0.0, + "val_entropy": 0.0, + "val_iou": 0.7054957410939053, + "val_iou_gain": 0.02531738422192975, + "val_loss": -0.14560741608875105, + "val_refine_score": 0.5711344430162328, + "val_reward": 0.014560741608875105, + "validated_this_epoch": true + }, + { + "alpha": null, + "early_stopping_active": true, + "early_stopping_best_value": 0.5724109242210832, + "early_stopping_improved": false, + "early_stopping_min_delta": 0.0, + "early_stopping_monitor_mode": "max", + "early_stopping_monitor_name": "val_refine_score", + "early_stopping_monitor_value": 0.5690949051290249, + "early_stopping_patience": 30, + "early_stopping_start_epoch": 30, + "early_stopping_wait": 27, + "encoder_lr": 1.5454852106293665e-05, + "epoch": 99, + "epoch_seconds": 12.351480906829238, + "grad_norm": 1.148032779043371, + "lr": 1.5454852106293665e-05, + "selection_metric_name": "val_refine_score", + "selection_metric_value": 0.5690949051290249, + "strategy3_bootstrap_loaded": true, + "strategy3_decoder_state": "frozen", + "strategy3_encoder_state": "frozen", + "strategy3_freeze_active": true, + "strategy3_freeze_requested": true, + "strategy3_segmentation_head_state": "frozen", + "train_action_distribution": { + "max_abs_delta": 0.10009765625, + "mean_abs_delta": 0.034685858779332855, + "mean_delta": -0.023991809438236734, + "near_zero_pct": 4.593455364763279e-05, + "negative_pct": 91.08160253275524, + "positive_pct": 8.918353610418059 + }, + "train_actor_loss": -0.024689325459555468, + "train_advantage_mean": 0.0, + "train_advantage_std": 0.0, + "train_alpha": 0.0, + "train_annealed_aux_ce_weight": 0.040000000000000015, + "train_biou_delta_mean": 0.024689325544221156, + "train_ce_loss": 0.15300403128970752, + "train_critic_loss": 0.0, + "train_dice": 0.9157528996247126, + "train_dice_loss": 0.07152439789338545, + "train_effective_steps": 8.0, + "train_entropy": 0.0, + "train_entropy_bonus_used": 0.0, + "train_entropy_loss": 0.0, + "train_iou": 0.8560929915629303, + "train_loss": -0.24240268631414932, + "train_mask_delta_mean": 0.03469016335227273, + "train_mean_reward": 0.024689325459555468, + "train_mean_value_pred": 0.0, + "train_reinforce_loss": 0.0, + "train_reward_zeros_pct": 0.21306818816810846, + "train_rl_loss_scale": 10.0, + "train_value_pred_error": 0.0, + "val_actor_loss": -0.0143795009716996, + "val_binary_flips_correct_pct": 0.4187789617800245, + "val_binary_flips_total_pct": 0.7654077866498161, + "val_binary_flips_wrong_pct": 0.3466288248697917, + "val_biou": 0.4350228690977857, + "val_biou_gain": 0.05036348126693602, + "val_ce_loss": 0.0, + "val_critic_loss": 0.0, + "val_decoder_biou": 0.3846593878308497, + "val_decoder_dice": 0.770921132483555, + "val_decoder_iou": 0.6801783568719756, + "val_dice": 0.7867222178521778, + "val_dice_gain": 0.01580108536862279, + "val_dice_loss": 0.0, + "val_entropy": 0.0, + "val_iou": 0.7031669411602642, + "val_iou_gain": 0.02298858428828865, + "val_loss": -0.143795009716996, + "val_refine_score": 0.5690949051290249, + "val_reward": 0.0143795009716996, + "validated_this_epoch": true + }, + { + "alpha": null, + "early_stopping_active": true, + "early_stopping_best_value": 0.5724109242210832, + "early_stopping_improved": false, + "early_stopping_min_delta": 0.0, + "early_stopping_monitor_mode": "max", + "early_stopping_monitor_name": "val_refine_score", + "early_stopping_monitor_value": 0.5686842875829772, + "early_stopping_patience": 30, + "early_stopping_start_epoch": 30, + "early_stopping_wait": 28, + "encoder_lr": 1.4141864374426834e-05, + "epoch": 100, + "epoch_seconds": 12.286030116956681, + "grad_norm": 1.023216653953899, + "lr": 1.4141864374426834e-05, + "selection_metric_name": "val_refine_score", + "selection_metric_value": 0.5686842875829772, + "strategy3_bootstrap_loaded": true, + "strategy3_decoder_state": "frozen", + "strategy3_encoder_state": "frozen", + "strategy3_freeze_active": true, + "strategy3_freeze_requested": true, + "strategy3_segmentation_head_state": "frozen", + "train_action_distribution": { + "max_abs_delta": 0.10009765625, + "mean_abs_delta": 0.0350327531976456, + "mean_delta": -0.02443999183279547, + "near_zero_pct": 4.661900900063384e-05, + "negative_pct": 91.21757183562626, + "positive_pct": 8.782383681020953 + }, + "train_actor_loss": -0.02497342688200826, + "train_advantage_mean": 0.0, + "train_advantage_std": 0.0, + "train_alpha": 0.0, + "train_annealed_aux_ce_weight": 0.040000000000000015, + "train_biou_delta_mean": 0.024973426776176148, + "train_ce_loss": 0.15558706833557648, + "train_critic_loss": 0.0, + "train_dice": 0.9139479465129895, + "train_dice_loss": 0.07367732308127663, + "train_effective_steps": 8.0, + "train_entropy": 0.0, + "train_entropy_bonus_used": 0.0, + "train_entropy_loss": 0.0, + "train_iou": 0.8544321113206618, + "train_loss": -0.24514897980473258, + "train_mask_delta_mean": 0.03503695401278409, + "train_mean_reward": 0.02497342688200826, + "train_mean_value_pred": 0.0, + "train_reinforce_loss": 0.0, + "train_reward_zeros_pct": 0.18939394503831863, + "train_rl_loss_scale": 10.0, + "train_value_pred_error": 0.0, + "val_actor_loss": -0.014264148754591588, + "val_binary_flips_correct_pct": 0.42153526754940257, + "val_binary_flips_total_pct": 0.7906969855813419, + "val_binary_flips_wrong_pct": 0.3691617180319393, + "val_biou": 0.4339809377126035, + "val_biou_gain": 0.0493215498817538, + "val_ce_loss": 0.0, + "val_critic_loss": 0.0, + "val_decoder_biou": 0.3846593878308497, + "val_decoder_dice": 0.770921132483555, + "val_decoder_iou": 0.6801783568719756, + "val_dice": 0.7870532432597384, + "val_dice_gain": 0.016132110776183373, + "val_dice_loss": 0.0, + "val_entropy": 0.0, + "val_iou": 0.703387637453351, + "val_iou_gain": 0.02320928058137539, + "val_loss": -0.14264148754591588, + "val_refine_score": 0.5686842875829772, + "val_reward": 0.014264148754591588, + "validated_this_epoch": true + }, + { + "alpha": null, + "early_stopping_active": true, + "early_stopping_best_value": 0.5724109242210832, + "early_stopping_improved": false, + "early_stopping_min_delta": 0.0, + "early_stopping_monitor_mode": "max", + "early_stopping_monitor_name": "val_refine_score", + "early_stopping_monitor_value": 0.5683388473191863, + "early_stopping_patience": 30, + "early_stopping_start_epoch": 30, + "early_stopping_wait": 29, + "encoder_lr": 1.2887097366843346e-05, + "epoch": 101, + "epoch_seconds": 12.358948207926005, + "grad_norm": 0.9941880106925964, + "lr": 1.2887097366843346e-05, + "selection_metric_name": "val_refine_score", + "selection_metric_value": 0.5683388473191863, + "strategy3_bootstrap_loaded": true, + "strategy3_decoder_state": "frozen", + "strategy3_encoder_state": "frozen", + "strategy3_freeze_active": true, + "strategy3_freeze_requested": true, + "strategy3_segmentation_head_state": "frozen", + "train_action_distribution": { + "max_abs_delta": 0.10009765625, + "mean_abs_delta": 0.03621322433040901, + "mean_delta": -0.0259111578237604, + "near_zero_pct": 3.3994611602462434e-05, + "negative_pct": 91.22473042119633, + "positive_pct": 8.77523771063848 + }, + "train_actor_loss": -0.024924880258781326, + "train_advantage_mean": 0.0, + "train_advantage_std": 0.0, + "train_alpha": 0.0, + "train_annealed_aux_ce_weight": 0.040000000000000015, + "train_biou_delta_mean": 0.02492488038577986, + "train_ce_loss": 0.15277709744193338, + "train_critic_loss": 0.0, + "train_dice": 0.9164424706958975, + "train_dice_loss": 0.07188438285480846, + "train_effective_steps": 8.0, + "train_entropy": 0.0, + "train_entropy_bonus_used": 0.0, + "train_entropy_loss": 0.0, + "train_iou": 0.857844511347994, + "train_loss": -0.24475557966665787, + "train_mask_delta_mean": 0.036224365234375, + "train_mean_reward": 0.024924880258781326, + "train_mean_value_pred": 0.0, + "train_reinforce_loss": 0.0, + "train_reward_zeros_pct": 0.28409091755747795, + "train_rl_loss_scale": 10.0, + "train_value_pred_error": 0.0, + "val_actor_loss": -0.0142309549919446, + "val_binary_flips_correct_pct": 0.42477402032590383, + "val_binary_flips_total_pct": 0.7994184307023591, + "val_binary_flips_wrong_pct": 0.3746444103764553, + "val_biou": 0.4331201994074814, + "val_biou_gain": 0.048460811576631735, + "val_ce_loss": 0.0, + "val_critic_loss": 0.0, + "val_decoder_biou": 0.3846593878308497, + "val_decoder_dice": 0.770921132483555, + "val_decoder_iou": 0.6801783568719756, + "val_dice": 0.7874819407408016, + "val_dice_gain": 0.016560808257246595, + "val_dice_loss": 0.0, + "val_entropy": 0.0, + "val_iou": 0.7035574952308911, + "val_iou_gain": 0.023379138358915474, + "val_loss": -0.142309549919446, + "val_refine_score": 0.5683388473191863, + "val_reward": 0.0142309549919446, + "validated_this_epoch": true + }, + { + "alpha": null, + "early_stopping_active": true, + "early_stopping_best_value": 0.5724109242210832, + "early_stopping_improved": false, + "early_stopping_min_delta": 0.0, + "early_stopping_monitor_mode": "max", + "early_stopping_monitor_name": "val_refine_score", + "early_stopping_monitor_value": 0.5695229813245142, + "early_stopping_patience": 30, + "early_stopping_start_epoch": 30, + "early_stopping_wait": 30, + "encoder_lr": 1.1691411038173145e-05, + "epoch": 102, + "epoch_seconds": 12.320805978961289, + "grad_norm": 1.0652080557563088, + "lr": 1.1691411038173145e-05, + "selection_metric_name": "val_refine_score", + "selection_metric_value": 0.5695229813245142, + "strategy3_bootstrap_loaded": true, + "strategy3_decoder_state": "frozen", + "strategy3_encoder_state": "frozen", + "strategy3_freeze_active": true, + "strategy3_freeze_requested": true, + "strategy3_segmentation_head_state": "frozen", + "train_action_distribution": { + "max_abs_delta": 0.10009765625, + "mean_abs_delta": 0.03473747741769661, + "mean_delta": -0.024175674315880646, + "near_zero_pct": 6.258963183695828e-05, + "negative_pct": 91.04640456763181, + "positive_pct": 8.953535031865943 + }, + "train_actor_loss": -0.024896120832471006, + "train_advantage_mean": 0.0, + "train_advantage_std": 0.0, + "train_alpha": 0.0, + "train_annealed_aux_ce_weight": 0.040000000000000015, + "train_biou_delta_mean": 0.02489612066313963, + "train_ce_loss": 0.1484851065007123, + "train_critic_loss": 0.0, + "train_dice": 0.917348215862672, + "train_dice_loss": 0.06998814777894453, + "train_effective_steps": 8.0, + "train_entropy": 0.0, + "train_entropy_bonus_used": 0.0, + "train_entropy_loss": 0.0, + "train_iou": 0.8597564265433086, + "train_loss": -0.2445917319167744, + "train_mask_delta_mean": 0.034734552556818184, + "train_mean_reward": 0.024896120832471006, + "train_mean_value_pred": 0.0, + "train_reinforce_loss": 0.0, + "train_reward_zeros_pct": 0.7102272938936949, + "train_rl_loss_scale": 10.0, + "train_value_pred_error": 0.0, + "val_actor_loss": -0.01438979983504396, + "val_binary_flips_correct_pct": 0.4225001615636489, + "val_binary_flips_total_pct": 0.7859622730928308, + "val_binary_flips_wrong_pct": 0.36346211152918195, + "val_biou": 0.4352229784749724, + "val_biou_gain": 0.05056359064412269, + "val_ce_loss": 0.0, + "val_critic_loss": 0.0, + "val_decoder_biou": 0.3846593878308497, + "val_decoder_dice": 0.770921132483555, + "val_decoder_iou": 0.6801783568719756, + "val_dice": 0.7873964804584491, + "val_dice_gain": 0.01647534797489414, + "val_dice_loss": 0.0, + "val_entropy": 0.0, + "val_iou": 0.703822984174056, + "val_iou_gain": 0.02364462730208039, + "val_loss": -0.1438979983504396, + "val_refine_score": 0.5695229813245142, + "val_reward": 0.01438979983504396, + "validated_this_epoch": true + } +] \ No newline at end of file diff --git a/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/phase_010/pct_100/repeat_01/strategy_3/final/low_iou_samples.csv b/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/phase_010/pct_100/repeat_01/strategy_3/final/low_iou_samples.csv new file mode 100644 index 0000000000000000000000000000000000000000..379ae05f1ee23efe277846067ef8a16a08c1fc9e --- /dev/null +++ b/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/phase_010/pct_100/repeat_01/strategy_3/final/low_iou_samples.csv @@ -0,0 +1,2 @@ +sample_id +BUSI_0302_B diff --git a/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/phase_010/pct_100/repeat_01/strategy_3/final/run_config.json b/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/phase_010/pct_100/repeat_01/strategy_3/final/run_config.json new file mode 100644 index 0000000000000000000000000000000000000000..6ea0e81e3aea0ae6b776d170c57937d9ba434c2e --- /dev/null +++ b/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/phase_010/pct_100/repeat_01/strategy_3/final/run_config.json @@ -0,0 +1,112 @@ +{ + "a3c_entropy_coeff": 0.0, + "aux_action_ce_mix": 0.8726103361457451, + "backbone_family": "smp", + "base_split_manifest_path": "/workspace/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/manifests/splits/phase_010.json", + "best_checkpoint_metric_name": "val_refine_score", + "best_checkpoint_metrics": { + "2": "val_iou", + "3": "val_refine_score" + }, + "biou_reward_weight": 1.0, + "boundary_reward_weight": 0.5, + "critic_loss_weight": 1.4015767132796022, + "data_root": "/workspace/BUSI_with_classes", + "dataset_name": "BUSI_with_classes", + "dataset_percent": 1.0, + "dataset_split_policy": "stratified", + "dataset_splits_path": "/workspace/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/manifests/splits/phase_010.json", + "decoder_lr": 0.0, + "dropout_p": 0.015714592843367126, + "early_stopping_min_delta": 0.0, + "early_stopping_mode": "auto", + "early_stopping_monitor": "val_refine_score", + "early_stopping_patience": 30, + "early_stopping_start_epoch": 30, + "elastic_aug_prob": 0.4303652916281717, + "encoder_lr": 0.0, + "entropy_alpha_init": 0.005, + "entropy_lr": 6.618595597183474e-05, + "entropy_target_ratio": 0.2, + "epoch_probe_mode": "rolling_random", + "evaluation_checkpoint_mode": "best", + "execution_mode": "train_eval", + "folds_experiment_name": "stratified_holdout_v1", + "gae_lambda": 0.8306320445782609, + "gamma": 0.95, + "grad_clip_norm": 6.0, + "head_lr": 0.0001971844222061614, + "iou_reward_weight": 1.0, + "keep_correct_reward_weight": 0.05, + "max_epochs": 120, + "min_alpha": 0.00017019223026554014, + "normalization_cache_path": "/workspace/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/phase_010/pct_100/repeat_01/norm_stats_BUSI_with_classes_stratified_80_10_10_100pct_phase010_repeat01.json", + "num_actions": 3, + "percent_sampling_mode": "incremental", + "phase_count": 10, + "phase_index": 10, + "phase_test_fold_index": 10, + "phase_val_fold_index": 1, + "project_dir": "/workspace", + "refine_delta_large": 0.08, + "refine_delta_small": 0.03, + "rl_lr": 0.0001971844222061614, + "run_name": "phase=010 | repeat=01 | strategy=3 | pct=100%", + "run_type": "final", + "save_history_incrementally": false, + "scheduler_factor": 0.5, + "scheduler_min_lr": 1e-05, + "scheduler_patience": 5, + "scheduler_threshold": 0.001, + "selected_split_manifest_path": "/workspace/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/manifests/subsets/phase_010_pct_100_repeat_01.json", + "smp_decoder_type": "UPerNet", + "smp_encoder_depth": 5, + "smp_encoder_name": "tu-pvt_v2_b2", + "smp_encoder_proj_dim": 192, + "smp_encoder_weights": "imagenet", + "split_generation_mode": "fixed_stratified_phases_8_1_1", + "split_repeat_index": 10, + "split_seed": 723450912, + "split_type": "80_10_10", + "strategy": 3, + "strategy2_checkpoint_mode": "best", + "strategy2_checkpoint_path": "/workspace/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/phase_010/pct_100/repeat_01/strategy_2/final/checkpoints/best.pt", + "strategy3_advantage_normalize": false, + "strategy3_aux_boundary_dice_weight": 0.6979509040767587, + "strategy3_aux_ce_anneal_epochs": 15, + "strategy3_aux_ce_anneal_start_epoch": 25, + "strategy3_aux_ce_floor_fraction": 0.1, + "strategy3_aux_ce_weight": 0.4, + "strategy3_decoder_ce_weight": 0.0, + "strategy3_decoder_dice_weight": 0.0, + "strategy3_delta_max": 0.1, + "strategy3_exploration_eps": 0.1, + "strategy3_exploration_eps_epochs": 20, + "strategy3_freeze_bootstrapped_segmentation": true, + "strategy3_mc_disk_cache_enabled": true, + "strategy3_mc_disk_cache_read": true, + "strategy3_mc_disk_cache_write": true, + "strategy3_mc_dropout_enabled": true, + "strategy3_mc_dropout_p": 0.2, + "strategy3_mc_dropout_samples": 5, + "strategy3_r1_progress_weight": 1.0, + "strategy3_rl_grad_clip_norm": 0.25, + "strategy3_rl_loss_scale": 10.0, + "strategy3_sam_attention_grid": 64, + "strategy3_variant": "lite", + "subset_manifest_path": "/workspace/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/manifests/subsets/phase_010_pct_100_repeat_01.json", + "subset_repeat_index": 1, + "subset_sampling_source": "incremental_chain", + "subset_seed": 1653428179, + "threshold": 0.5922320465492188, + "tmax": 8, + "train_resume_mode": "off", + "train_resume_specific_checkpoint": "", + "train_subset_key": "100", + "train_subset_source": "incremental_chain", + "train_subset_variant": 1, + "vgg_feature_dilation": 1, + "vgg_feature_scales": 4, + "weight_decay": 2.7012557725439094e-06, + "write_epoch_diagnostic": false +} \ No newline at end of file diff --git a/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/phase_010/pct_100/repeat_01/strategy_3/final/summary.json b/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/phase_010/pct_100/repeat_01/strategy_3/final/summary.json new file mode 100644 index 0000000000000000000000000000000000000000..e4941a82d668fe507e2f8f585784f512c860beb3 --- /dev/null +++ b/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/phase_010/pct_100/repeat_01/strategy_3/final/summary.json @@ -0,0 +1,34 @@ +{ + "best_epoch": 72, + "best_model_metric": 0.5724109242210832, + "best_model_metric_name": "val_refine_score", + "best_val_biou": 0.437004029666552, + "best_val_biou_gain": 0.05234464183570231, + "best_val_dice": 0.7927068797303527, + "best_val_iou": 0.708380159951118, + "best_val_iou_gain": 0.02820180307914244, + "device_used": "cuda", + "early_stopping_best_value": 0.5724109242210832, + "early_stopping_min_delta": 0.0, + "early_stopping_monitor_mode": "max", + "early_stopping_monitor_name": "val_refine_score", + "early_stopping_patience": 30, + "early_stopping_start_epoch": 30, + "elapsed_seconds": 1276.2680625915527, + "epochs_to_best_checkpoint": 72, + "final_epoch": 102, + "gpu_name": "NVIDIA A100 80GB PCIe", + "resumed": false, + "run_type": "final", + "seconds_per_epoch": 12.512431986191693, + "seconds_per_epoch_measured_mean": 12.408194299632063, + "seconds_per_epoch_measured_std": 0.8456643552471369, + "strategy": 3, + "strategy3_bootstrap_loaded": true, + "strategy3_decoder_state": "frozen", + "strategy3_encoder_state": "frozen", + "strategy3_freeze_active": true, + "strategy3_freeze_requested": true, + "strategy3_segmentation_head_state": "frozen", + "time_to_best_seconds": 894.9727710350417 +} \ No newline at end of file diff --git a/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/phase_010/pct_100/repeat_01/strategy_3/final/timing.csv b/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/phase_010/pct_100/repeat_01/strategy_3/final/timing.csv new file mode 100644 index 0000000000000000000000000000000000000000..4cb6d43514a4dbf6a4a0882ef7526c1a5774951d --- /dev/null +++ b/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/phase_010/pct_100/repeat_01/strategy_3/final/timing.csv @@ -0,0 +1,2 @@ +scope,strategy,tmax,device,num_batches,num_samples,total_inference_ms,avg_batch_inference_ms,std_batch_inference_ms,avg_sample_inference_ms,std_sample_inference_ms,mean_per_image_inference_ms,std_per_image_inference_ms,mean_per_image_inference_seconds,std_per_image_inference_seconds +test_set_evaluation,3,8,cuda,2,64,623.334601,311.667301,139.421997,9.739603,0.592205,9.739603,0.592205,0.009739603,0.000592205 diff --git a/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/phase_timing_summary.json b/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/phase_timing_summary.json new file mode 100644 index 0000000000000000000000000000000000000000..ddb03480ca27e8a6d9529389cd30649cfa66d1ab --- /dev/null +++ b/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/phase_timing_summary.json @@ -0,0 +1,155 @@ +{ + "definition": "training elapsed_seconds from summary.json, falling back to the ledger checkpoint elapsed_seconds", + "phase_count": 5, + "phases": [ + { + "completed_strategies": [ + 2, + 3 + ], + "completed_strategy_count": 2, + "phase_index": 2, + "runs": [ + { + "dataset_percent": 100, + "phase_index": 2, + "run_dir": "/workspace/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/phase_002/pct_100/repeat_01/strategy_2/final", + "strategy": 2, + "subset_repeat_index": 1, + "training_elapsed_seconds": 377.0015754699707 + }, + { + "dataset_percent": 100, + "phase_index": 2, + "run_dir": "/workspace/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/phase_002/pct_100/repeat_01/strategy_3/final", + "strategy": 3, + "subset_repeat_index": 1, + "training_elapsed_seconds": 1512.7809295654297 + } + ], + "training_elapsed_seconds_mean": 944.8912525177002, + "training_elapsed_seconds_std": 567.8896770477295, + "updated_at": "2026-08-03T14:08:36.540222+00:00" + }, + { + "completed_strategies": [ + 2, + 3 + ], + "completed_strategy_count": 2, + "phase_index": 3, + "runs": [ + { + "dataset_percent": 100, + "phase_index": 3, + "run_dir": "/workspace/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/phase_003/pct_100/repeat_01/strategy_2/final", + "strategy": 2, + "subset_repeat_index": 1, + "training_elapsed_seconds": 123.31218004226685 + }, + { + "dataset_percent": 100, + "phase_index": 3, + "run_dir": "/workspace/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/phase_003/pct_100/repeat_01/strategy_3/final", + "strategy": 3, + "subset_repeat_index": 1, + "training_elapsed_seconds": 1497.953530550003 + } + ], + "training_elapsed_seconds_mean": 810.632855296135, + "training_elapsed_seconds_std": 687.3206752538681, + "updated_at": "2026-08-03T14:39:36.867555+00:00" + }, + { + "completed_strategies": [ + 2, + 3 + ], + "completed_strategy_count": 2, + "phase_index": 4, + "runs": [ + { + "dataset_percent": 100, + "phase_index": 4, + "run_dir": "/workspace/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/phase_004/pct_100/repeat_01/strategy_2/final", + "strategy": 2, + "subset_repeat_index": 1, + "training_elapsed_seconds": 125.54964017868042 + }, + { + "dataset_percent": 100, + "phase_index": 4, + "run_dir": "/workspace/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/phase_004/pct_100/repeat_01/strategy_3/final", + "strategy": 3, + "subset_repeat_index": 1, + "training_elapsed_seconds": 1488.3410377502441 + } + ], + "training_elapsed_seconds_mean": 806.9453389644623, + "training_elapsed_seconds_std": 681.3956987857819, + "updated_at": "2026-08-03T15:10:30.882697+00:00" + }, + { + "completed_strategies": [ + 2, + 3 + ], + "completed_strategy_count": 2, + "phase_index": 9, + "runs": [ + { + "dataset_percent": 100, + "phase_index": 9, + "run_dir": "/workspace/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/phase_009/pct_100/repeat_01/strategy_2/final", + "strategy": 2, + "subset_repeat_index": 1, + "training_elapsed_seconds": 155.30842065811157 + }, + { + "dataset_percent": 100, + "phase_index": 9, + "run_dir": "/workspace/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/phase_009/pct_100/repeat_01/strategy_3/final", + "strategy": 3, + "subset_repeat_index": 1, + "training_elapsed_seconds": 1512.5201861858368 + } + ], + "training_elapsed_seconds_mean": 833.9143034219742, + "training_elapsed_seconds_std": 678.6058827638626, + "updated_at": "2026-08-03T15:42:04.569624+00:00" + }, + { + "completed_strategies": [ + 2, + 3 + ], + "completed_strategy_count": 2, + "phase_index": 10, + "runs": [ + { + "dataset_percent": 100, + "phase_index": 10, + "run_dir": "/workspace/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/phase_010/pct_100/repeat_01/strategy_2/final", + "strategy": 2, + "subset_repeat_index": 1, + "training_elapsed_seconds": 127.74087882041931 + }, + { + "dataset_percent": 100, + "phase_index": 10, + "run_dir": "/workspace/runs/UPerNet_PVTv2_b2/repeated_holdout/stratified_holdout_v1/phase_010/pct_100/repeat_01/strategy_3/final", + "strategy": 3, + "subset_repeat_index": 1, + "training_elapsed_seconds": 1276.2680625915527 + } + ], + "training_elapsed_seconds_mean": 702.004470705986, + "training_elapsed_seconds_std": 574.2635918855667, + "updated_at": "2026-08-03T16:09:05.516969+00:00" + } + ], + "scope": "fixed_phase_training_time", + "training_elapsed_seconds_mean_across_phases": 819.6776441812515, + "training_elapsed_seconds_std_across_phases": 77.42354388274894, + "updated_at": "2026-08-03T16:09:05.517103+00:00" +} \ No newline at end of file diff --git a/runs/_plots/summary_s2_vs_s3.csv b/runs/_plots/summary_s2_vs_s3.csv new file mode 100644 index 0000000000000000000000000000000000000000..57b02b3c8c0137f924041d46aaad15bda937638f --- /dev/null +++ b/runs/_plots/summary_s2_vs_s3.csv @@ -0,0 +1,13 @@ +model,strategy,metric,mean,std,n_phases +UPerNet_PVTv2_b2,2,biou,0.387658,0.018166,5 +UPerNet_PVTv2_b2,2,biou_contour,0.106588,0.007340,5 +UPerNet_PVTv2_b2,2,infer_ms,1.381536,0.387893,5 +UPerNet_PVTv2_b2,2,train_min,3.029709,1.638305,5 +UPerNet_PVTv2_b2,2,epoch_sec,1.894138,0.952402,5 +UPerNet_PVTv2_b2,2,time_to_best_min,2.572189,1.699196,5 +UPerNet_PVTv2_b2,3,biou,0.451670,0.030928,5 +UPerNet_PVTv2_b2,3,biou_contour,0.159780,0.021218,5 +UPerNet_PVTv2_b2,3,infer_ms,9.926945,0.148849,5 +UPerNet_PVTv2_b2,3,train_min,24.292879,1.518696,5 +UPerNet_PVTv2_b2,3,epoch_sec,12.521813,0.077118,5 +UPerNet_PVTv2_b2,3,time_to_best_min,19.787100,2.816359,5 diff --git a/runs/_stats/ALL_MODELS_summary.csv b/runs/_stats/ALL_MODELS_summary.csv new file mode 100644 index 0000000000000000000000000000000000000000..1e8d78bba313b4aea39642ab632cdd6ca78b761c --- /dev/null +++ b/runs/_stats/ALL_MODELS_summary.csv @@ -0,0 +1,15 @@ +Model,Metric,Level,n_pairs,S3_minus_S2,Wilcoxon_p_raw,p_Holm_global,Sig_global,Better_arm,Cohens_dz,boot_CI_low,boot_CI_high +UPerNet_PVTv2_b2,biou_contour,per_image,323,0.05323689972250793,5.718497206218795e-26,2.287398882487518e-24,Yes,S3 (refinement),0.5976812828087569,0.04388856770935864,0.0631788819574603 +UPerNet_PVTv2_b2,biou_contour,phase_level,5,0.05319270071814397,0.0625,0.904454777261137,No,n.s.,2.7898246582797013,0.03994488089272243,0.06847578049149965 +UPerNet_PVTv2_b2,biou,per_image,323,0.06405450550476223,1.7289307098031236e-35,7.261508981173119e-34,Yes,S3 (refinement),0.7106123430299262,0.054621372643315846,0.07419702627070363 +UPerNet_PVTv2_b2,biou,phase_level,5,0.06401235940982118,0.0625,0.904454777261137,No,n.s.,3.2112497773429203,0.04877197464166473,0.07925274417797765 +UPerNet_PVTv2_b2,dice,per_image,323,0.024717042764589976,1.6137224260354095e-21,5.970772976331016e-20,Yes,S3 (refinement),0.3369163551465658,0.01758011096126462,0.033468297370947586 +UPerNet_PVTv2_b2,dice,phase_level,5,0.024705393755753292,0.0625,0.904454777261137,No,n.s.,2.355188925592429,0.01679677571245599,0.032571750830933756 +UPerNet_PVTv2_b2,iou,per_image,323,0.03349147755422749,8.927138942126266e-23,3.392312798007981e-21,Yes,S3 (refinement),0.4283906438768904,0.025532213233220028,0.04245785713177373 +UPerNet_PVTv2_b2,iou,phase_level,5,0.0334679205953595,0.0625,0.904454777261137,No,n.s.,2.6542353345316627,0.023657582805408372,0.04327825838531063 +UPerNet_PVTv2_b2,ppv,per_image,323,0.015432132519286663,9.692831383221536e-21,3.489419297959753e-19,Yes,S3 (refinement),0.14679531799469125,0.003600603527365194,0.026376065855223244 +UPerNet_PVTv2_b2,ppv,phase_level,5,0.015397503612966967,0.0625,0.904454777261137,No,n.s.,1.1086750057065942,0.005221036805826839,0.026911534432880545 +UPerNet_PVTv2_b2,sen,per_image,323,0.018927612716654368,0.028008282190094113,0.5041490794216941,No,S3 (refinement),0.22135844946187674,0.01042786989469917,0.02880240613683837 +UPerNet_PVTv2_b2,sen,phase_level,5,0.018952392346317716,0.0625,0.904454777261137,No,n.s.,1.660638095810431,0.010383693878889844,0.028426579776123572 +UPerNet_PVTv2_b2,hd95,per_image,323,-1.30639897336755,1.4906865581005058e-05,0.0004919265641731669,Yes,S3 (refinement),-0.11436884240155197,-2.6939560695612763,-0.26375395856774686 +UPerNet_PVTv2_b2,hd95,phase_level,5,-1.301247094144427,0.0625,0.904454777261137,No,n.s.,-1.4379107639344506,-2.0157415708953055,-0.5867526173935488 diff --git a/runs/_stats/ALL_MODELS_summary.xlsx b/runs/_stats/ALL_MODELS_summary.xlsx new file mode 100644 index 0000000000000000000000000000000000000000..6c12612e6b97f1f29cf5a29a848cfdb6b1d286bc Binary files /dev/null and b/runs/_stats/ALL_MODELS_summary.xlsx differ