diff --git a/.gitignore b/.gitignore
deleted file mode 100644
index 73bee79529b0c61be6d32d1f698cd6b969326428..0000000000000000000000000000000000000000
--- a/.gitignore
+++ /dev/null
@@ -1,3 +0,0 @@
-ssd_mobilenet_v2_coco_2018_03_29/demo
-
-**/demo
diff --git a/east_text_detection/LICENSE b/east_text_detection/LICENSE
deleted file mode 100644
index f288702d2fa16d3cdf0035b15a9fcbc552cd88e7..0000000000000000000000000000000000000000
--- a/east_text_detection/LICENSE
+++ /dev/null
@@ -1,674 +0,0 @@
- GNU GENERAL PUBLIC LICENSE
- Version 3, 29 June 2007
-
- Copyright (C) 2007 Free Software Foundation, Inc.
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
- Preamble
-
- The GNU General Public License is a free, copyleft license for
-software and other kinds of works.
-
- The licenses for most software and other practical works are designed
-to take away your freedom to share and change the works. By contrast,
-the GNU General Public License is intended to guarantee your freedom to
-share and change all versions of a program--to make sure it remains free
-software for all its users. We, the Free Software Foundation, use the
-GNU General Public License for most of our software; it applies also to
-any other work released this way by its authors. You can apply it to
-your programs, too.
-
- When we speak of free software, we are referring to freedom, not
-price. Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-them if you wish), that you receive source code or can get it if you
-want it, that you can change the software or use pieces of it in new
-free programs, and that you know you can do these things.
-
- To protect your rights, we need to prevent others from denying you
-these rights or asking you to surrender the rights. Therefore, you have
-certain responsibilities if you distribute copies of the software, or if
-you modify it: responsibilities to respect the freedom of others.
-
- For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must pass on to the recipients the same
-freedoms that you received. You must make sure that they, too, receive
-or can get the source code. And you must show them these terms so they
-know their rights.
-
- Developers that use the GNU GPL protect your rights with two steps:
-(1) assert copyright on the software, and (2) offer you this License
-giving you legal permission to copy, distribute and/or modify it.
-
- For the developers' and authors' protection, the GPL clearly explains
-that there is no warranty for this free software. For both users' and
-authors' sake, the GPL requires that modified versions be marked as
-changed, so that their problems will not be attributed erroneously to
-authors of previous versions.
-
- Some devices are designed to deny users access to install or run
-modified versions of the software inside them, although the manufacturer
-can do so. This is fundamentally incompatible with the aim of
-protecting users' freedom to change the software. The systematic
-pattern of such abuse occurs in the area of products for individuals to
-use, which is precisely where it is most unacceptable. Therefore, we
-have designed this version of the GPL to prohibit the practice for those
-products. If such problems arise substantially in other domains, we
-stand ready to extend this provision to those domains in future versions
-of the GPL, as needed to protect the freedom of users.
-
- Finally, every program is threatened constantly by software patents.
-States should not allow patents to restrict development and use of
-software on general-purpose computers, but in those that do, we wish to
-avoid the special danger that patents applied to a free program could
-make it effectively proprietary. To prevent this, the GPL assures that
-patents cannot be used to render the program non-free.
-
- The precise terms and conditions for copying, distribution and
-modification follow.
-
- TERMS AND CONDITIONS
-
- 0. Definitions.
-
- "This License" refers to version 3 of the GNU General Public License.
-
- "Copyright" also means copyright-like laws that apply to other kinds of
-works, such as semiconductor masks.
-
- "The Program" refers to any copyrightable work licensed under this
-License. Each licensee is addressed as "you". "Licensees" and
-"recipients" may be individuals or organizations.
-
- To "modify" a work means to copy from or adapt all or part of the work
-in a fashion requiring copyright permission, other than the making of an
-exact copy. The resulting work is called a "modified version" of the
-earlier work or a work "based on" the earlier work.
-
- A "covered work" means either the unmodified Program or a work based
-on the Program.
-
- To "propagate" a work means to do anything with it that, without
-permission, would make you directly or secondarily liable for
-infringement under applicable copyright law, except executing it on a
-computer or modifying a private copy. Propagation includes copying,
-distribution (with or without modification), making available to the
-public, and in some countries other activities as well.
-
- To "convey" a work means any kind of propagation that enables other
-parties to make or receive copies. Mere interaction with a user through
-a computer network, with no transfer of a copy, is not conveying.
-
- An interactive user interface displays "Appropriate Legal Notices"
-to the extent that it includes a convenient and prominently visible
-feature that (1) displays an appropriate copyright notice, and (2)
-tells the user that there is no warranty for the work (except to the
-extent that warranties are provided), that licensees may convey the
-work under this License, and how to view a copy of this License. If
-the interface presents a list of user commands or options, such as a
-menu, a prominent item in the list meets this criterion.
-
- 1. Source Code.
-
- The "source code" for a work means the preferred form of the work
-for making modifications to it. "Object code" means any non-source
-form of a work.
-
- A "Standard Interface" means an interface that either is an official
-standard defined by a recognized standards body, or, in the case of
-interfaces specified for a particular programming language, one that
-is widely used among developers working in that language.
-
- The "System Libraries" of an executable work include anything, other
-than the work as a whole, that (a) is included in the normal form of
-packaging a Major Component, but which is not part of that Major
-Component, and (b) serves only to enable use of the work with that
-Major Component, or to implement a Standard Interface for which an
-implementation is available to the public in source code form. A
-"Major Component", in this context, means a major essential component
-(kernel, window system, and so on) of the specific operating system
-(if any) on which the executable work runs, or a compiler used to
-produce the work, or an object code interpreter used to run it.
-
- The "Corresponding Source" for a work in object code form means all
-the source code needed to generate, install, and (for an executable
-work) run the object code and to modify the work, including scripts to
-control those activities. However, it does not include the work's
-System Libraries, or general-purpose tools or generally available free
-programs which are used unmodified in performing those activities but
-which are not part of the work. For example, Corresponding Source
-includes interface definition files associated with source files for
-the work, and the source code for shared libraries and dynamically
-linked subprograms that the work is specifically designed to require,
-such as by intimate data communication or control flow between those
-subprograms and other parts of the work.
-
- The Corresponding Source need not include anything that users
-can regenerate automatically from other parts of the Corresponding
-Source.
-
- The Corresponding Source for a work in source code form is that
-same work.
-
- 2. Basic Permissions.
-
- All rights granted under this License are granted for the term of
-copyright on the Program, and are irrevocable provided the stated
-conditions are met. This License explicitly affirms your unlimited
-permission to run the unmodified Program. The output from running a
-covered work is covered by this License only if the output, given its
-content, constitutes a covered work. This License acknowledges your
-rights of fair use or other equivalent, as provided by copyright law.
-
- You may make, run and propagate covered works that you do not
-convey, without conditions so long as your license otherwise remains
-in force. You may convey covered works to others for the sole purpose
-of having them make modifications exclusively for you, or provide you
-with facilities for running those works, provided that you comply with
-the terms of this License in conveying all material for which you do
-not control copyright. Those thus making or running the covered works
-for you must do so exclusively on your behalf, under your direction
-and control, on terms that prohibit them from making any copies of
-your copyrighted material outside their relationship with you.
-
- Conveying under any other circumstances is permitted solely under
-the conditions stated below. Sublicensing is not allowed; section 10
-makes it unnecessary.
-
- 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
-
- No covered work shall be deemed part of an effective technological
-measure under any applicable law fulfilling obligations under article
-11 of the WIPO copyright treaty adopted on 20 December 1996, or
-similar laws prohibiting or restricting circumvention of such
-measures.
-
- When you convey a covered work, you waive any legal power to forbid
-circumvention of technological measures to the extent such circumvention
-is effected by exercising rights under this License with respect to
-the covered work, and you disclaim any intention to limit operation or
-modification of the work as a means of enforcing, against the work's
-users, your or third parties' legal rights to forbid circumvention of
-technological measures.
-
- 4. Conveying Verbatim Copies.
-
- You may convey verbatim copies of the Program's source code as you
-receive it, in any medium, provided that you conspicuously and
-appropriately publish on each copy an appropriate copyright notice;
-keep intact all notices stating that this License and any
-non-permissive terms added in accord with section 7 apply to the code;
-keep intact all notices of the absence of any warranty; and give all
-recipients a copy of this License along with the Program.
-
- You may charge any price or no price for each copy that you convey,
-and you may offer support or warranty protection for a fee.
-
- 5. Conveying Modified Source Versions.
-
- You may convey a work based on the Program, or the modifications to
-produce it from the Program, in the form of source code under the
-terms of section 4, provided that you also meet all of these conditions:
-
- a) The work must carry prominent notices stating that you modified
- it, and giving a relevant date.
-
- b) The work must carry prominent notices stating that it is
- released under this License and any conditions added under section
- 7. This requirement modifies the requirement in section 4 to
- "keep intact all notices".
-
- c) You must license the entire work, as a whole, under this
- License to anyone who comes into possession of a copy. This
- License will therefore apply, along with any applicable section 7
- additional terms, to the whole of the work, and all its parts,
- regardless of how they are packaged. This License gives no
- permission to license the work in any other way, but it does not
- invalidate such permission if you have separately received it.
-
- d) If the work has interactive user interfaces, each must display
- Appropriate Legal Notices; however, if the Program has interactive
- interfaces that do not display Appropriate Legal Notices, your
- work need not make them do so.
-
- A compilation of a covered work with other separate and independent
-works, which are not by their nature extensions of the covered work,
-and which are not combined with it such as to form a larger program,
-in or on a volume of a storage or distribution medium, is called an
-"aggregate" if the compilation and its resulting copyright are not
-used to limit the access or legal rights of the compilation's users
-beyond what the individual works permit. Inclusion of a covered work
-in an aggregate does not cause this License to apply to the other
-parts of the aggregate.
-
- 6. Conveying Non-Source Forms.
-
- You may convey a covered work in object code form under the terms
-of sections 4 and 5, provided that you also convey the
-machine-readable Corresponding Source under the terms of this License,
-in one of these ways:
-
- a) Convey the object code in, or embodied in, a physical product
- (including a physical distribution medium), accompanied by the
- Corresponding Source fixed on a durable physical medium
- customarily used for software interchange.
-
- b) Convey the object code in, or embodied in, a physical product
- (including a physical distribution medium), accompanied by a
- written offer, valid for at least three years and valid for as
- long as you offer spare parts or customer support for that product
- model, to give anyone who possesses the object code either (1) a
- copy of the Corresponding Source for all the software in the
- product that is covered by this License, on a durable physical
- medium customarily used for software interchange, for a price no
- more than your reasonable cost of physically performing this
- conveying of source, or (2) access to copy the
- Corresponding Source from a network server at no charge.
-
- c) Convey individual copies of the object code with a copy of the
- written offer to provide the Corresponding Source. This
- alternative is allowed only occasionally and noncommercially, and
- only if you received the object code with such an offer, in accord
- with subsection 6b.
-
- d) Convey the object code by offering access from a designated
- place (gratis or for a charge), and offer equivalent access to the
- Corresponding Source in the same way through the same place at no
- further charge. You need not require recipients to copy the
- Corresponding Source along with the object code. If the place to
- copy the object code is a network server, the Corresponding Source
- may be on a different server (operated by you or a third party)
- that supports equivalent copying facilities, provided you maintain
- clear directions next to the object code saying where to find the
- Corresponding Source. Regardless of what server hosts the
- Corresponding Source, you remain obligated to ensure that it is
- available for as long as needed to satisfy these requirements.
-
- e) Convey the object code using peer-to-peer transmission, provided
- you inform other peers where the object code and Corresponding
- Source of the work are being offered to the general public at no
- charge under subsection 6d.
-
- A separable portion of the object code, whose source code is excluded
-from the Corresponding Source as a System Library, need not be
-included in conveying the object code work.
-
- A "User Product" is either (1) a "consumer product", which means any
-tangible personal property which is normally used for personal, family,
-or household purposes, or (2) anything designed or sold for incorporation
-into a dwelling. In determining whether a product is a consumer product,
-doubtful cases shall be resolved in favor of coverage. For a particular
-product received by a particular user, "normally used" refers to a
-typical or common use of that class of product, regardless of the status
-of the particular user or of the way in which the particular user
-actually uses, or expects or is expected to use, the product. A product
-is a consumer product regardless of whether the product has substantial
-commercial, industrial or non-consumer uses, unless such uses represent
-the only significant mode of use of the product.
-
- "Installation Information" for a User Product means any methods,
-procedures, authorization keys, or other information required to install
-and execute modified versions of a covered work in that User Product from
-a modified version of its Corresponding Source. The information must
-suffice to ensure that the continued functioning of the modified object
-code is in no case prevented or interfered with solely because
-modification has been made.
-
- If you convey an object code work under this section in, or with, or
-specifically for use in, a User Product, and the conveying occurs as
-part of a transaction in which the right of possession and use of the
-User Product is transferred to the recipient in perpetuity or for a
-fixed term (regardless of how the transaction is characterized), the
-Corresponding Source conveyed under this section must be accompanied
-by the Installation Information. But this requirement does not apply
-if neither you nor any third party retains the ability to install
-modified object code on the User Product (for example, the work has
-been installed in ROM).
-
- The requirement to provide Installation Information does not include a
-requirement to continue to provide support service, warranty, or updates
-for a work that has been modified or installed by the recipient, or for
-the User Product in which it has been modified or installed. Access to a
-network may be denied when the modification itself materially and
-adversely affects the operation of the network or violates the rules and
-protocols for communication across the network.
-
- Corresponding Source conveyed, and Installation Information provided,
-in accord with this section must be in a format that is publicly
-documented (and with an implementation available to the public in
-source code form), and must require no special password or key for
-unpacking, reading or copying.
-
- 7. Additional Terms.
-
- "Additional permissions" are terms that supplement the terms of this
-License by making exceptions from one or more of its conditions.
-Additional permissions that are applicable to the entire Program shall
-be treated as though they were included in this License, to the extent
-that they are valid under applicable law. If additional permissions
-apply only to part of the Program, that part may be used separately
-under those permissions, but the entire Program remains governed by
-this License without regard to the additional permissions.
-
- When you convey a copy of a covered work, you may at your option
-remove any additional permissions from that copy, or from any part of
-it. (Additional permissions may be written to require their own
-removal in certain cases when you modify the work.) You may place
-additional permissions on material, added by you to a covered work,
-for which you have or can give appropriate copyright permission.
-
- Notwithstanding any other provision of this License, for material you
-add to a covered work, you may (if authorized by the copyright holders of
-that material) supplement the terms of this License with terms:
-
- a) Disclaiming warranty or limiting liability differently from the
- terms of sections 15 and 16 of this License; or
-
- b) Requiring preservation of specified reasonable legal notices or
- author attributions in that material or in the Appropriate Legal
- Notices displayed by works containing it; or
-
- c) Prohibiting misrepresentation of the origin of that material, or
- requiring that modified versions of such material be marked in
- reasonable ways as different from the original version; or
-
- d) Limiting the use for publicity purposes of names of licensors or
- authors of the material; or
-
- e) Declining to grant rights under trademark law for use of some
- trade names, trademarks, or service marks; or
-
- f) Requiring indemnification of licensors and authors of that
- material by anyone who conveys the material (or modified versions of
- it) with contractual assumptions of liability to the recipient, for
- any liability that these contractual assumptions directly impose on
- those licensors and authors.
-
- All other non-permissive additional terms are considered "further
-restrictions" within the meaning of section 10. If the Program as you
-received it, or any part of it, contains a notice stating that it is
-governed by this License along with a term that is a further
-restriction, you may remove that term. If a license document contains
-a further restriction but permits relicensing or conveying under this
-License, you may add to a covered work material governed by the terms
-of that license document, provided that the further restriction does
-not survive such relicensing or conveying.
-
- If you add terms to a covered work in accord with this section, you
-must place, in the relevant source files, a statement of the
-additional terms that apply to those files, or a notice indicating
-where to find the applicable terms.
-
- Additional terms, permissive or non-permissive, may be stated in the
-form of a separately written license, or stated as exceptions;
-the above requirements apply either way.
-
- 8. Termination.
-
- You may not propagate or modify a covered work except as expressly
-provided under this License. Any attempt otherwise to propagate or
-modify it is void, and will automatically terminate your rights under
-this License (including any patent licenses granted under the third
-paragraph of section 11).
-
- However, if you cease all violation of this License, then your
-license from a particular copyright holder is reinstated (a)
-provisionally, unless and until the copyright holder explicitly and
-finally terminates your license, and (b) permanently, if the copyright
-holder fails to notify you of the violation by some reasonable means
-prior to 60 days after the cessation.
-
- Moreover, your license from a particular copyright holder is
-reinstated permanently if the copyright holder notifies you of the
-violation by some reasonable means, this is the first time you have
-received notice of violation of this License (for any work) from that
-copyright holder, and you cure the violation prior to 30 days after
-your receipt of the notice.
-
- Termination of your rights under this section does not terminate the
-licenses of parties who have received copies or rights from you under
-this License. If your rights have been terminated and not permanently
-reinstated, you do not qualify to receive new licenses for the same
-material under section 10.
-
- 9. Acceptance Not Required for Having Copies.
-
- You are not required to accept this License in order to receive or
-run a copy of the Program. Ancillary propagation of a covered work
-occurring solely as a consequence of using peer-to-peer transmission
-to receive a copy likewise does not require acceptance. However,
-nothing other than this License grants you permission to propagate or
-modify any covered work. These actions infringe copyright if you do
-not accept this License. Therefore, by modifying or propagating a
-covered work, you indicate your acceptance of this License to do so.
-
- 10. Automatic Licensing of Downstream Recipients.
-
- Each time you convey a covered work, the recipient automatically
-receives a license from the original licensors, to run, modify and
-propagate that work, subject to this License. You are not responsible
-for enforcing compliance by third parties with this License.
-
- An "entity transaction" is a transaction transferring control of an
-organization, or substantially all assets of one, or subdividing an
-organization, or merging organizations. If propagation of a covered
-work results from an entity transaction, each party to that
-transaction who receives a copy of the work also receives whatever
-licenses to the work the party's predecessor in interest had or could
-give under the previous paragraph, plus a right to possession of the
-Corresponding Source of the work from the predecessor in interest, if
-the predecessor has it or can get it with reasonable efforts.
-
- You may not impose any further restrictions on the exercise of the
-rights granted or affirmed under this License. For example, you may
-not impose a license fee, royalty, or other charge for exercise of
-rights granted under this License, and you may not initiate litigation
-(including a cross-claim or counterclaim in a lawsuit) alleging that
-any patent claim is infringed by making, using, selling, offering for
-sale, or importing the Program or any portion of it.
-
- 11. Patents.
-
- A "contributor" is a copyright holder who authorizes use under this
-License of the Program or a work on which the Program is based. The
-work thus licensed is called the contributor's "contributor version".
-
- A contributor's "essential patent claims" are all patent claims
-owned or controlled by the contributor, whether already acquired or
-hereafter acquired, that would be infringed by some manner, permitted
-by this License, of making, using, or selling its contributor version,
-but do not include claims that would be infringed only as a
-consequence of further modification of the contributor version. For
-purposes of this definition, "control" includes the right to grant
-patent sublicenses in a manner consistent with the requirements of
-this License.
-
- Each contributor grants you a non-exclusive, worldwide, royalty-free
-patent license under the contributor's essential patent claims, to
-make, use, sell, offer for sale, import and otherwise run, modify and
-propagate the contents of its contributor version.
-
- In the following three paragraphs, a "patent license" is any express
-agreement or commitment, however denominated, not to enforce a patent
-(such as an express permission to practice a patent or covenant not to
-sue for patent infringement). To "grant" such a patent license to a
-party means to make such an agreement or commitment not to enforce a
-patent against the party.
-
- If you convey a covered work, knowingly relying on a patent license,
-and the Corresponding Source of the work is not available for anyone
-to copy, free of charge and under the terms of this License, through a
-publicly available network server or other readily accessible means,
-then you must either (1) cause the Corresponding Source to be so
-available, or (2) arrange to deprive yourself of the benefit of the
-patent license for this particular work, or (3) arrange, in a manner
-consistent with the requirements of this License, to extend the patent
-license to downstream recipients. "Knowingly relying" means you have
-actual knowledge that, but for the patent license, your conveying the
-covered work in a country, or your recipient's use of the covered work
-in a country, would infringe one or more identifiable patents in that
-country that you have reason to believe are valid.
-
- If, pursuant to or in connection with a single transaction or
-arrangement, you convey, or propagate by procuring conveyance of, a
-covered work, and grant a patent license to some of the parties
-receiving the covered work authorizing them to use, propagate, modify
-or convey a specific copy of the covered work, then the patent license
-you grant is automatically extended to all recipients of the covered
-work and works based on it.
-
- A patent license is "discriminatory" if it does not include within
-the scope of its coverage, prohibits the exercise of, or is
-conditioned on the non-exercise of one or more of the rights that are
-specifically granted under this License. You may not convey a covered
-work if you are a party to an arrangement with a third party that is
-in the business of distributing software, under which you make payment
-to the third party based on the extent of your activity of conveying
-the work, and under which the third party grants, to any of the
-parties who would receive the covered work from you, a discriminatory
-patent license (a) in connection with copies of the covered work
-conveyed by you (or copies made from those copies), or (b) primarily
-for and in connection with specific products or compilations that
-contain the covered work, unless you entered into that arrangement,
-or that patent license was granted, prior to 28 March 2007.
-
- Nothing in this License shall be construed as excluding or limiting
-any implied license or other defenses to infringement that may
-otherwise be available to you under applicable patent law.
-
- 12. No Surrender of Others' Freedom.
-
- If conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot convey a
-covered work so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you may
-not convey it at all. For example, if you agree to terms that obligate you
-to collect a royalty for further conveying from those to whom you convey
-the Program, the only way you could satisfy both those terms and this
-License would be to refrain entirely from conveying the Program.
-
- 13. Use with the GNU Affero General Public License.
-
- Notwithstanding any other provision of this License, you have
-permission to link or combine any covered work with a work licensed
-under version 3 of the GNU Affero General Public License into a single
-combined work, and to convey the resulting work. The terms of this
-License will continue to apply to the part which is the covered work,
-but the special requirements of the GNU Affero General Public License,
-section 13, concerning interaction through a network will apply to the
-combination as such.
-
- 14. Revised Versions of this License.
-
- The Free Software Foundation may publish revised and/or new versions of
-the GNU General Public License from time to time. Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
- Each version is given a distinguishing version number. If the
-Program specifies that a certain numbered version of the GNU General
-Public License "or any later version" applies to it, you have the
-option of following the terms and conditions either of that numbered
-version or of any later version published by the Free Software
-Foundation. If the Program does not specify a version number of the
-GNU General Public License, you may choose any version ever published
-by the Free Software Foundation.
-
- If the Program specifies that a proxy can decide which future
-versions of the GNU General Public License can be used, that proxy's
-public statement of acceptance of a version permanently authorizes you
-to choose that version for the Program.
-
- Later license versions may give you additional or different
-permissions. However, no additional obligations are imposed on any
-author or copyright holder as a result of your choosing to follow a
-later version.
-
- 15. Disclaimer of Warranty.
-
- THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
-APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
-HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
-OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
-THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
-IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
-ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
- 16. Limitation of Liability.
-
- IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
-THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
-GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
-USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
-DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
-PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
-EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGES.
-
- 17. Interpretation of Sections 15 and 16.
-
- If the disclaimer of warranty and limitation of liability provided
-above cannot be given local legal effect according to their terms,
-reviewing courts shall apply local law that most closely approximates
-an absolute waiver of all civil liability in connection with the
-Program, unless a warranty or assumption of liability accompanies a
-copy of the Program in return for a fee.
-
- END OF TERMS AND CONDITIONS
-
- How to Apply These Terms to Your New Programs
-
- If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
- To do so, attach the following notices to the program. It is safest
-to attach them to the start of each source file to most effectively
-state the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
-
- Copyright (C)
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see .
-
-Also add information on how to contact you by electronic and paper mail.
-
- If the program does terminal interaction, make it output a short
-notice like this when it starts in an interactive mode:
-
- Copyright (C)
- This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
- This is free software, and you are welcome to redistribute it
- under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License. Of course, your program's commands
-might be different; for a GUI interface, you would use an "about box".
-
- You should also get your employer (if you work as a programmer) or school,
-if any, to sign a "copyright disclaimer" for the program, if necessary.
-For more information on this, and how to apply and follow the GNU GPL, see
-.
-
- The GNU General Public License does not permit incorporating your program
-into proprietary programs. If your program is a subroutine library, you
-may consider it more useful to permit linking proprietary applications with
-the library. If this is what you want to do, use the GNU Lesser General
-Public License instead of this License. But first, please read
-.
diff --git a/east_text_detection/README.md b/east_text_detection/README.md
deleted file mode 100644
index 61a0eb010d733a7f48d7fe111340c6482f70bbe7..0000000000000000000000000000000000000000
--- a/east_text_detection/README.md
+++ /dev/null
@@ -1,67 +0,0 @@
-# EAST Text Detection
-
-Scene-text detection with the EAST (Efficient and Accurate Scene Text) detector.
-The model was originally distributed as a frozen TensorFlow graph
-(`frozen_east_text_detection.pb`) and converted to ONNX for use with OpenCV's DNN module.
-
-## Model Details
-- **Architecture**: EAST with a ResNet-50 backbone and a feature-fusion head
-- **Input**: RGB image, 320×320, raw 0–255 float, mean `(123.68, 116.78, 103.94)`, swapRB,
- NCHW layout (`input_images:0`, shape `[1, 3, 320, 320]`)
-- **Outputs**:
- - `feature_fusion/Conv_7/Sigmoid:0` — score map, shape `[1, 1, 80, 80]`
- - `feature_fusion/concat_3:0` — RBOX geometry, shape `[1, 5, 80, 80]`
-- **Post-processing**: OpenCV's `TextDetectionModel_EAST` decodes the score/geometry maps
- into rotated boxes (confidence threshold + rotated-NMS)
-- **Framework**: ONNX (converted from the TensorFlow frozen graph via tf2onnx, opset 15)
-- **Original weights**: https://github.com/argman/EAST
-
-Both input and outputs are emitted in NCHW so OpenCV consumes them directly.
-
-## Usage
-
-### Python
-```bash
-python demo.py --model east_text_detection_2026jul.onnx --image example_outputs/input_image.png --output example_outputs/output_image.png
-```
-
-Or import directly:
-```python
-import cv2
-
-model = cv2.dnn.TextDetectionModel_EAST("east_text_detection_2026jul.onnx")
-# see demo.py for the full inference pipeline
-```
-
-### C++
-The C++ demo runs inference with OpenCV's DNN module (default engine — no ONNX Runtime
-needed). Adjust the OpenCV paths to your setup:
-```bash
-OCV=/path/to/opencv # OpenCV source tree
-OCVBUILD=/path/to/opencv/build # OpenCV build directory (generated headers + libs)
-g++ -std=c++17 demo.cpp -o demo \
- -I$OCV/include \
- -I$OCV/modules/core/include \
- -I$OCV/modules/dnn/include \
- -I$OCV/modules/imgproc/include \
- -I$OCV/modules/imgcodecs/include \
- -I$OCVBUILD \
- -L$OCVBUILD/lib -Wl,-rpath,$OCVBUILD/lib -lopencv_dnn -lopencv_imgcodecs -lopencv_imgproc -lopencv_core
-./demo --model east_text_detection_2026jul.onnx --image example_outputs/input_image.png
-```
-
-## Conversion
-The ONNX model was exported from the frozen TensorFlow graph with tf2onnx (opset 15)
-via [convert_to_onnx.py](./convert_to_onnx.py) — input `input_images:0`, outputs
-`feature_fusion/Conv_7/Sigmoid:0` and `feature_fusion/concat_3:0`. Both the input and the
-outputs are forced to NCHW (`inputs_as_nchw` / `outputs_as_nchw`) so the tensors match
-OpenCV's layout; without `outputs_as_nchw` the score/geometry maps come out as NHWC and the
-EAST decoder rejects them. Requires `tensorflow`, `tf2onnx`, and `onnx`.
-
-```bash
-python convert_to_onnx.py --pb ../pb/frozen_east_text_detection.pb
-```
-
-## License
-See [LICENSE](./LICENSE) — the model originates from [argman/EAST](https://github.com/argman/EAST),
-released under the GNU General Public License v3.0.
diff --git a/east_text_detection/convert_to_onnx.py b/east_text_detection/convert_to_onnx.py
deleted file mode 100644
index a48f80e54c53b801c19228a632bba33af6333010..0000000000000000000000000000000000000000
--- a/east_text_detection/convert_to_onnx.py
+++ /dev/null
@@ -1,44 +0,0 @@
-import argparse
-import datetime
-
-import onnx
-import tensorflow as tf
-import tf2onnx
-
-
-def load_graph_def(pb_path):
- with tf.io.gfile.GFile(pb_path, "rb") as f:
- graph_def = tf.compat.v1.GraphDef()
- graph_def.ParseFromString(f.read())
- return graph_def
-
-
-def main():
- parser = argparse.ArgumentParser(description="Export frozen_east_text_detection.pb to ONNX")
- parser.add_argument("--pb", default="../pb/frozen_east_text_detection.pb")
- parser.add_argument("--opset", type=int, default=15)
- args = parser.parse_args()
-
- graph_def = load_graph_def(args.pb)
-
- outputs = ["feature_fusion/Conv_7/Sigmoid:0", "feature_fusion/concat_3:0"]
- model_proto, _ = tf2onnx.convert.from_graph_def(
- graph_def,
- input_names=["input_images:0"],
- output_names=outputs,
- inputs_as_nchw=["input_images:0"],
- outputs_as_nchw=outputs,
- opset=args.opset,
- shape_override={"input_images:0": [1, 320, 320, 3]},
- )
- onnx.checker.check_model(model_proto)
-
- stamp = datetime.datetime.now().strftime("%Y%b").lower()
- onnx_path = "east_text_detection_%s.onnx" % stamp
- with open(onnx_path, "wb") as f:
- f.write(model_proto.SerializeToString())
- print("wrote", onnx_path)
-
-
-if __name__ == "__main__":
- main()
diff --git a/east_text_detection/demo.cpp b/east_text_detection/demo.cpp
deleted file mode 100644
index e8b413242e7e82059a025f93c6cac9acdd72ff1f..0000000000000000000000000000000000000000
--- a/east_text_detection/demo.cpp
+++ /dev/null
@@ -1,49 +0,0 @@
-#include
-#include
-#include
-#include
-#include
-#include
-
-static std::string argVal(int argc, char** argv, const std::string& key, const std::string& def)
-{
- for (int i = 1; i + 1 < argc; ++i)
- if (key == argv[i]) return argv[i + 1];
- return def;
-}
-
-int main(int argc, char** argv)
-{
- std::string model = argVal(argc, argv, "--model", "east_text_detection_2026jul.onnx");
- std::string image = argVal(argc, argv, "--image", "example_outputs/input_image.png");
- std::string output = argVal(argc, argv, "--output", "example_outputs/output_image.png");
-
- cv::Mat img = cv::imread(image);
- if (img.empty())
- {
- std::cerr << "could not read image: " << image << std::endl;
- return 1;
- }
-
- cv::dnn::TextDetectionModel_EAST east(model);
- east.setConfidenceThreshold(0.5f).setNMSThreshold(0.4f);
- east.setInputParams(1.0, cv::Size(320, 320), cv::Scalar(123.68, 116.78, 103.94), true, false);
-
- std::vector boxes;
- east.detectTextRectangles(img, boxes);
- std::cout << "detections " << boxes.size() << std::endl;
-
- cv::Mat out = img.clone();
- for (const cv::RotatedRect& box : boxes)
- {
- cv::Mat pts;
- cv::boxPoints(box, pts);
- std::vector poly(4);
- for (int i = 0; i < 4; ++i)
- poly[i] = cv::Point(cvRound(pts.at(i, 0)), cvRound(pts.at(i, 1)));
- cv::polylines(out, poly, true, cv::Scalar(0, 255, 0), 2);
- }
- cv::imwrite(output, out);
- std::cout << "wrote " << output << std::endl;
- return 0;
-}
diff --git a/east_text_detection/demo.py b/east_text_detection/demo.py
deleted file mode 100644
index e6029f4fc64258a88f1b43190822e7567d17025f..0000000000000000000000000000000000000000
--- a/east_text_detection/demo.py
+++ /dev/null
@@ -1,39 +0,0 @@
-import argparse
-import os
-
-import cv2 as cv
-import numpy as np
-
-here = os.path.dirname(os.path.abspath(__file__))
-
-
-def main():
- parser = argparse.ArgumentParser(description="EAST scene-text detection (ONNX) demo")
- parser.add_argument("--model", default=os.path.join(here, "east_text_detection_2026jul.onnx"))
- parser.add_argument("--image", default=os.path.join(here, "example_outputs", "input_image.png"))
- parser.add_argument("--output", default=os.path.join(here, "example_outputs", "output_image.png"))
- parser.add_argument("--conf", type=float, default=0.5, help="confidence threshold")
- parser.add_argument("--nms", type=float, default=0.4, help="NMS threshold")
- args = parser.parse_args()
-
- img = cv.imread(args.image)
- if img is None:
- raise SystemExit("could not read image: %s" % args.image)
-
- model = cv.dnn.TextDetectionModel_EAST(args.model)
- model.setConfidenceThreshold(args.conf).setNMSThreshold(args.nms)
- model.setInputParams(1.0, (320, 320), (123.68, 116.78, 103.94), True, False)
-
- boxes, confidences = model.detectTextRectangles(img)
- print("detections", len(boxes))
-
- out = img.copy()
- for box in boxes:
- pts = cv.boxPoints(box).astype(np.int32)
- cv.polylines(out, [pts], True, (0, 255, 0), 2)
- cv.imwrite(args.output, out)
- print("wrote", args.output)
-
-
-if __name__ == "__main__":
- main()
diff --git a/east_text_detection/east_text_detection_2026jul.onnx b/east_text_detection/east_text_detection_2026jul.onnx
deleted file mode 100644
index 86eb4d3fff6a2cc92e7d18f4ccc5c9dc1bd39a52..0000000000000000000000000000000000000000
--- a/east_text_detection/east_text_detection_2026jul.onnx
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:63f96881e90b81f3f0e7fd79dc705ead31276da70d3c7dca008ca28d3554883a
-size 96217443
diff --git a/east_text_detection/example_outputs/input_image.png b/east_text_detection/example_outputs/input_image.png
deleted file mode 100644
index 7895b60bcc0e0eb44ab900815765d4b7834e34e1..0000000000000000000000000000000000000000
--- a/east_text_detection/example_outputs/input_image.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:6106d611b5b287f756e82f783d7490df243f0dcade7bef9a29a326c2c973d1e9
-size 905243
diff --git a/east_text_detection/example_outputs/output_image.png b/east_text_detection/example_outputs/output_image.png
deleted file mode 100644
index 045e9b2afa0bc371f2861c6601c447e53557babb..0000000000000000000000000000000000000000
--- a/east_text_detection/example_outputs/output_image.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:d7a50b512308b9d0d1aa7618ce253fe1b73a1ed38a27fa6d7c0a99fd6bb26dd3
-size 904889
diff --git a/efficientdet-d0/LICENSE b/efficientdet-d0/LICENSE
deleted file mode 100644
index 51c79d9ae037822dda676b455f685345b7effdb6..0000000000000000000000000000000000000000
--- a/efficientdet-d0/LICENSE
+++ /dev/null
@@ -1,203 +0,0 @@
-Copyright 2020 Google Research. All rights reserved.
-
- 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
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright 2020, Google Research.
-
- 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.
diff --git a/efficientdet-d0/README.md b/efficientdet-d0/README.md
deleted file mode 100644
index 147dc3157766be833a56300dc0e48f9f426c8ad6..0000000000000000000000000000000000000000
--- a/efficientdet-d0/README.md
+++ /dev/null
@@ -1,62 +0,0 @@
-# EfficientDet-D0
-
-Object detection with EfficientDet-D0 trained on COCO. The model was originally
-distributed as a frozen TensorFlow graph (`efficientdet-d0.pb`) and converted to
-ONNX for use with OpenCV's DNN module. This is a **backbone-only** export: the
-graph emits raw class logits and box regressions, while anchor generation, sigmoid,
-box decoding and non-maximum suppression are performed in host code (see the demos).
-
-## Model Details
-- **Architecture**: EfficientDet-D0
-- **Input**: RGB image, 512×512, raw uint8, NHWC layout (`image_arrays:0`, shape `[1, 512, 512, 3]`)
-- **Output**: raw class logits (`concat:0`, shape `[1, 49104, 90]`) and box regression (`concat_1:0`, shape `[1, 49104, 4]`); anchor decode + NMS are done in host code, not in the graph
-- **Framework**: ONNX (converted from the TensorFlow frozen graph via tf2onnx, opset 18)
-- **Original weights**: https://www.dropbox.com/s/9mqp99fd2tpuqn6/efficientdet-d0.pb?dl=1
-
-The graph outputs are per-anchor predictions only. The demos build the 49104 anchors
-(5 pyramid levels × 9 anchors/cell), apply sigmoid to the logits, decode the box
-regressions relative to the anchors, threshold on confidence and run NMS (IoU 0.6).
-
-## Usage
-
-### Python
-```bash
-python demo.py --model efficientdet-d0_2026jul.onnx --image example_outputs/input_image.png --output example_outputs/output_image.png --conf 0.4
-```
-
-Or import directly:
-```python
-import cv2
-
-net = cv2.dnn.readNet("efficientdet-d0_2026jul.onnx")
-# see demo.py for the full anchor decode + NMS pipeline
-```
-
-### C++
-The C++ demo runs inference with OpenCV's DNN module. Adjust the OpenCV paths to your setup:
-```bash
-OCV=/path/to/opencv # OpenCV source tree
-OCVBUILD=/path/to/opencv/build # OpenCV build directory (generated headers + libs)
-g++ -std=c++17 demo.cpp -o demo \
- -I$OCV/include \
- -I$OCV/modules/core/include \
- -I$OCV/modules/dnn/include \
- -I$OCV/modules/imgproc/include \
- -I$OCV/modules/imgcodecs/include \
- -I$OCVBUILD \
- -L$OCVBUILD/lib -Wl,-rpath,$OCVBUILD/lib -lopencv_dnn -lopencv_imgcodecs -lopencv_imgproc -lopencv_core
-./demo --model efficientdet-d0_2026jul.onnx --image example_outputs/input_image.png --output example_outputs/output_image.png
-```
-
-## Conversion
-The ONNX model was exported from the frozen TensorFlow graph with tf2onnx (opset 18)
-via [convert_to_onnx.py](./convert_to_onnx.py) — input `image_arrays:0`, outputs
-`concat:0` and `concat_1:0`, input shape overridden to `[1, 512, 512, 3]`. Requires
-`tensorflow`, `tf2onnx`, and `onnx`.
-
-```bash
-python convert_to_onnx.py --pb ../pb/efficientdet-d0.pb
-```
-
-## License
-See [LICENSE](./LICENSE) — released under the Apache License 2.0.
diff --git a/efficientdet-d0/convert_to_onnx.py b/efficientdet-d0/convert_to_onnx.py
deleted file mode 100644
index 5fc9423d6238c292f8cac7a45382a5588ddfed0c..0000000000000000000000000000000000000000
--- a/efficientdet-d0/convert_to_onnx.py
+++ /dev/null
@@ -1,41 +0,0 @@
-import argparse
-import datetime
-
-import onnx
-import tensorflow as tf
-import tf2onnx
-
-
-def load_graph_def(pb_path):
- with tf.io.gfile.GFile(pb_path, "rb") as f:
- graph_def = tf.compat.v1.GraphDef()
- graph_def.ParseFromString(f.read())
- return graph_def
-
-
-def main():
- parser = argparse.ArgumentParser(description="Export efficientdet-d0.pb to ONNX")
- parser.add_argument("--pb", default="../pb/efficientdet-d0.pb")
- parser.add_argument("--opset", type=int, default=18)
- args = parser.parse_args()
-
- graph_def = load_graph_def(args.pb)
-
- model_proto, _ = tf2onnx.convert.from_graph_def(
- graph_def,
- input_names=["image_arrays:0"],
- output_names=["concat:0", "concat_1:0"],
- opset=args.opset,
- shape_override={"image_arrays:0": [1, 512, 512, 3]},
- )
- onnx.checker.check_model(model_proto)
-
- stamp = datetime.datetime.now().strftime("%Y%b").lower()
- onnx_path = "efficientdet-d0_%s.onnx" % stamp
- with open(onnx_path, "wb") as f:
- f.write(model_proto.SerializeToString())
- print("wrote", onnx_path)
-
-
-if __name__ == "__main__":
- main()
diff --git a/efficientdet-d0/demo.cpp b/efficientdet-d0/demo.cpp
deleted file mode 100644
index 68a3375f55f13f3cdee9e5d651087de3bc7e16a5..0000000000000000000000000000000000000000
--- a/efficientdet-d0/demo.cpp
+++ /dev/null
@@ -1,127 +0,0 @@
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-using namespace cv;
-
-static std::string argVal(int argc, char** argv, const std::string& key, const std::string& def)
-{
- for (int i = 1; i + 1 < argc; ++i)
- if (key == argv[i]) return argv[i + 1];
- return def;
-}
-
-struct Det { float x1, y1, x2, y2, score; int cid; };
-
-int main(int argc, char** argv)
-{
- std::string model = argVal(argc, argv, "--model", "efficientdet-d0_2026jul.onnx");
- std::string image = argVal(argc, argv, "--image", "example_outputs/input_image.png");
- std::string output = argVal(argc, argv, "--output", "example_outputs/output_image.png");
- float conf = std::stof(argVal(argc, argv, "--conf", "0.4"));
-
- const int sz = 512;
-
- Mat img = imread(image);
- if (img.empty()) { std::cerr << "could not read image: " << image << std::endl; return 1; }
-
- Mat rgb;
- cvtColor(img, rgb, COLOR_BGR2RGB);
- resize(rgb, rgb, Size(sz, sz));
- if (!rgb.isContinuous()) rgb = rgb.clone();
-
- int blobShape[] = {1, sz, sz, 3};
- Mat blob(4, blobShape, CV_8U, rgb.data);
- dnn::Net net = dnn::readNetFromONNX(model);
- net.setInput(blob);
- std::vector outs;
- net.forward(outs, net.getUnconnectedOutLayersNames());
-
- const float* boxp = nullptr;
- const float* clsp = nullptr;
- int n = 0, nc = 0;
- for (size_t i = 0; i < outs.size(); ++i)
- {
- const Mat& o = outs[i];
- const float* p = (const float*)o.data;
- int last = o.size[o.dims - 1];
- if (last == 4) { boxp = p; n = o.size[o.dims - 2]; }
- else { clsp = p; nc = last; }
- }
-
- std::vector> baseWH;
- double asp[3][2] = {{1.0, 1.0}, {1.4, 0.7}, {0.7, 1.4}};
- for (int i = 0; i < 3; ++i) {
- double s = std::pow(2.0, i / 3.0);
- for (int a = 0; a < 3; ++a)
- baseWH.push_back({(float)(32.0 * s * asp[a][0]), (float)(32.0 * s * asp[a][1])});
- }
- std::vector acx, acy, aw, ah;
- for (int lvl = 0; lvl < 5; ++lvl) {
- int f = sz / (8 << lvl);
- int step = 8 << lvl;
- int m = 1 << lvl;
- for (int y = 0; y < f; ++y)
- for (int x = 0; x < f; ++x) {
- float cx = (x + 0.5f) * step;
- float cy = (y + 0.5f) * step;
- for (auto& b : baseWH) {
- acx.push_back(cx); acy.push_back(cy);
- aw.push_back(b[0] * m); ah.push_back(b[1] * m);
- }
- }
- }
-
- std::vector dets;
- for (int a = 0; a < n; ++a) {
- const float* bp = boxp + (size_t)a * 4;
- float ycenter = bp[0] * ah[a] + acy[a];
- float xcenter = bp[1] * aw[a] + acx[a];
- float bhv = std::exp(bp[2]) * ah[a];
- float bwv = std::exp(bp[3]) * aw[a];
- const float* cp = clsp + (size_t)a * nc;
- int best = 0; float bestLogit = cp[0];
- for (int c = 1; c < nc; ++c) if (cp[c] > bestLogit) { bestLogit = cp[c]; best = c; }
- float score = 1.0f / (1.0f + std::exp(-bestLogit));
- if (score > conf)
- dets.push_back({(xcenter - bwv / 2) / sz, (ycenter - bhv / 2) / sz,
- (xcenter + bwv / 2) / sz, (ycenter + bhv / 2) / sz, score, best});
- }
-
- std::sort(dets.begin(), dets.end(), [](const Det& a, const Det& b) { return a.score > b.score; });
- std::vector removed(dets.size(), 0);
- std::vector pick;
- for (size_t i = 0; i < dets.size(); ++i) {
- if (removed[i]) continue;
- pick.push_back((int)i);
- for (size_t j = i + 1; j < dets.size(); ++j) {
- if (removed[j]) continue;
- float xx1 = std::max(dets[i].x1, dets[j].x1);
- float yy1 = std::max(dets[i].y1, dets[j].y1);
- float xx2 = std::min(dets[i].x2, dets[j].x2);
- float yy2 = std::min(dets[i].y2, dets[j].y2);
- float inter = std::max(0.0f, xx2 - xx1) * std::max(0.0f, yy2 - yy1);
- float ai = (dets[i].x2 - dets[i].x1) * (dets[i].y2 - dets[i].y1);
- float aj = (dets[j].x2 - dets[j].x1) * (dets[j].y2 - dets[j].y1);
- if (inter / (ai + aj - inter + 1e-9f) > 0.6f) removed[j] = 1;
- }
- }
-
- std::cout << "efficientdet-d0 " << pick.size() << " detections" << std::endl;
- int w = img.cols, h = img.rows;
- for (int idx : pick) {
- const Det& d = dets[idx];
- std::cout << format("%d %.3f %.3f %.3f %.3f %.3f", d.cid, d.score, d.x1, d.y1, d.x2, d.y2) << std::endl;
- rectangle(img, Point((int)(d.x1 * w), (int)(d.y1 * h)), Point((int)(d.x2 * w), (int)(d.y2 * h)), Scalar(0, 255, 0), 2);
- putText(img, format("%d:%.2f", d.cid, d.score), Point((int)(d.x1 * w), (int)(d.y1 * h) - 5), FONT_HERSHEY_SIMPLEX, 0.5, Scalar(0, 255, 0), 1);
- }
- imwrite(output, img);
- std::cout << "wrote " << output << std::endl;
- return 0;
-}
diff --git a/efficientdet-d0/demo.py b/efficientdet-d0/demo.py
deleted file mode 100644
index 3c0a600d524fcb744643e6e3ab84ffdb23894436..0000000000000000000000000000000000000000
--- a/efficientdet-d0/demo.py
+++ /dev/null
@@ -1,105 +0,0 @@
-import argparse
-import glob
-import os
-
-import cv2 as cv
-import numpy as np
-
-here = os.path.dirname(os.path.abspath(__file__))
-sz = 512
-
-
-def build_anchors():
- scales = [2.0 ** (i / 3.0) for i in range(3)]
- aspects = [(1.0, 1.0), (1.4, 0.7), (0.7, 1.4)]
- base = []
- for s in scales:
- for aw, ah in aspects:
- base.append((32.0 * s * aw, 32.0 * s * ah))
- anchors = []
- for lvl in range(5):
- f = sz // (8 * 2 ** lvl)
- step = 8 * 2 ** lvl
- m = 2 ** lvl
- for y in range(f):
- for x in range(f):
- cx = (x + 0.5) * step
- cy = (y + 0.5) * step
- for bw, bh in base:
- anchors.append((cx, cy, bw * m, bh * m))
- return np.array(anchors, np.float32)
-
-
-def main():
- parser = argparse.ArgumentParser(description="EfficientDet-D0 (ONNX) object detection demo")
- parser.add_argument("--model", default=None)
- parser.add_argument("--image", default=os.path.join(here, "example_outputs", "input_image.png"))
- parser.add_argument("--output", default=os.path.join(here, "example_outputs", "output_image.png"))
- parser.add_argument("--conf", type=float, default=0.4)
- args = parser.parse_args()
-
- model = args.model
- if model is None:
- found = glob.glob(os.path.join(here, "*.onnx"))
- if not found:
- raise SystemExit("no onnx, run convert_to_onnx.py")
- model = found[0]
-
- img = cv.imread(args.image)
- if img is None:
- raise SystemExit("could not read image: %s" % args.image)
-
- anchors = build_anchors()
- acx, acy, aw, ah = anchors[:, 0], anchors[:, 1], anchors[:, 2], anchors[:, 3]
-
- net = cv.dnn.readNetFromONNX(model)
- inp = cv.resize(cv.cvtColor(img, cv.COLOR_BGR2RGB), (sz, sz))
- net.setInput(inp[None].astype(np.uint8))
- res = net.forward(net.getUnconnectedOutLayersNames())
- box = next(a for a in res if a.shape[-1] == 4).reshape(-1, 4)
- cls = next(a for a in res if a.shape[-1] != 4).reshape(box.shape[0], -1)
-
- ycenter = box[:, 0] * ah + acy
- xcenter = box[:, 1] * aw + acx
- bh = np.exp(box[:, 2]) * ah
- bw = np.exp(box[:, 3]) * aw
- boxes = np.stack([xcenter - bw / 2, ycenter - bh / 2, xcenter + bw / 2, ycenter + bh / 2], 1) / sz
-
- prob = 1.0 / (1.0 + np.exp(-cls))
- cid = prob.argmax(1)
- scores = prob.max(1)
-
- keep = scores > args.conf
- boxes = boxes[keep]
- scores = scores[keep]
- cid = cid[keep]
- order = scores.argsort()[::-1]
- pick = []
- while order.size:
- i = order[0]
- pick.append(i)
- xx1 = np.maximum(boxes[i, 0], boxes[order[1:], 0])
- yy1 = np.maximum(boxes[i, 1], boxes[order[1:], 1])
- xx2 = np.minimum(boxes[i, 2], boxes[order[1:], 2])
- yy2 = np.minimum(boxes[i, 3], boxes[order[1:], 3])
- iw = np.maximum(0, xx2 - xx1)
- ih = np.maximum(0, yy2 - yy1)
- inter = iw * ih
- ai = (boxes[i, 2] - boxes[i, 0]) * (boxes[i, 3] - boxes[i, 1])
- aj = (boxes[order[1:], 2] - boxes[order[1:], 0]) * (boxes[order[1:], 3] - boxes[order[1:], 1])
- iou = inter / (ai + aj - inter + 1e-9)
- order = order[1:][iou <= 0.6]
-
- print("efficientdet-d0", len(pick), "detections")
- h, w = img.shape[:2]
- for i in pick:
- x1, y1, x2, y2 = boxes[i]
- print(int(cid[i]), round(float(scores[i]), 3), round(float(x1), 3), round(float(y1), 3), round(float(x2), 3), round(float(y2), 3))
- cv.rectangle(img, (int(x1 * w), int(y1 * h)), (int(x2 * w), int(y2 * h)), (0, 255, 0), 2)
- cv.putText(img, "%d:%.2f" % (int(cid[i]), scores[i]), (int(x1 * w), int(y1 * h) - 5), cv.FONT_HERSHEY_SIMPLEX, 0.5, (0, 255, 0), 1)
- cv.imwrite(args.output, img)
- print("wrote", args.output)
-
-
-if __name__ == "__main__":
- main()
diff --git a/efficientdet-d0/efficientdet-d0_2026jul.onnx b/efficientdet-d0/efficientdet-d0_2026jul.onnx
deleted file mode 100644
index 58f974d0aac25051d126f062134fb3edc10c3796..0000000000000000000000000000000000000000
--- a/efficientdet-d0/efficientdet-d0_2026jul.onnx
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:db344f69adf1c529e08a36bbaa1779d98b4b81621a2f046656fb966bdfdc6298
-size 15671001
diff --git a/efficientdet-d0/example_outputs/input_image.png b/efficientdet-d0/example_outputs/input_image.png
deleted file mode 100644
index 326ece9829794ab70eaf0b1e3feac0a762099689..0000000000000000000000000000000000000000
--- a/efficientdet-d0/example_outputs/input_image.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:61db162464c0770138c5136af0e999ce3b6556244cec257945427396480d9caf
-size 414310
diff --git a/efficientdet-d0/example_outputs/output_image.png b/efficientdet-d0/example_outputs/output_image.png
deleted file mode 100644
index 3896e4cefbcb3c1c9e8c3b1f07f6bc7fb133a640..0000000000000000000000000000000000000000
--- a/efficientdet-d0/example_outputs/output_image.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:6edda1b62da08b28f04a227bc0054152b76b4dcbc04a50f856e6912fd8ea9b3a
-size 330619
diff --git a/faster_rcnn_inception_v2_coco_2018_01_28/LICENSE b/faster_rcnn_inception_v2_coco_2018_01_28/LICENSE
deleted file mode 100644
index 4421e8e7b19941bd420a2723bb31d0abc15cd3d7..0000000000000000000000000000000000000000
--- a/faster_rcnn_inception_v2_coco_2018_01_28/LICENSE
+++ /dev/null
@@ -1,203 +0,0 @@
-Copyright 2015 The TensorFlow Authors. All rights reserved.
-
- 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
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright 2015, The TensorFlow Authors.
-
- 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.
\ No newline at end of file
diff --git a/faster_rcnn_inception_v2_coco_2018_01_28/README.md b/faster_rcnn_inception_v2_coco_2018_01_28/README.md
deleted file mode 100644
index d38446c01db2261da0581ef2d4dec39396ece56e..0000000000000000000000000000000000000000
--- a/faster_rcnn_inception_v2_coco_2018_01_28/README.md
+++ /dev/null
@@ -1,49 +0,0 @@
-# Faster-RCNN InceptionV2 (COCO)
-
-Object detection with the Faster-RCNN meta-architecture and an Inception v2 backbone,
-trained on the COCO dataset. The model was originally distributed as a frozen TensorFlow
-graph (`faster_rcnn_inception_v2_coco_2018_01_28.pb`) from the TensorFlow Object Detection
-API and converted to ONNX for inference with OpenCV's DNN module.
-
-## Model Details
-- **Architecture**: Faster-RCNN with an Inception v2 backbone
-- **Input**: RGB image, uint8, NHWC layout (`image_tensor:0`, shape `[1, H, W, 3]`)
-- **Output**: `detection_boxes:0` (normalized `[ymin, xmin, ymax, xmax]`), `detection_scores:0`, `detection_classes:0` (1-based COCO ids), `num_detections:0`
-- **Framework**: ONNX (converted from the TensorFlow frozen graph via tf2onnx, opset 18)
-- **Original weights**: http://download.tensorflow.org/models/object_detection/faster_rcnn_inception_v2_coco_2018_01_28.tar.gz
-
-## Usage
-
-### Python
-```bash
-python demo.py --model faster_rcnn_inception_v2_coco_2018_01_28_2026jul.onnx --image example_outputs/input_image.png --output example_outputs/output_image.png --conf 0.3
-```
-
-### C++
-The C++ demo runs inference with OpenCV's DNN module. Adjust the OpenCV paths to your setup:
-```bash
-OCV=/path/to/opencv # OpenCV source tree
-OCVBUILD=/path/to/opencv/build # OpenCV build directory (generated headers + libs)
-g++ -std=c++17 demo.cpp -o demo \
- -I$OCV/include \
- -I$OCV/modules/core/include \
- -I$OCV/modules/dnn/include \
- -I$OCV/modules/imgproc/include \
- -I$OCV/modules/imgcodecs/include \
- -I$OCVBUILD \
- -L$OCVBUILD/lib -Wl,-rpath,$OCVBUILD/lib -lopencv_dnn -lopencv_imgcodecs -lopencv_imgproc -lopencv_core
-./demo --model faster_rcnn_inception_v2_coco_2018_01_28_2026jul.onnx --image example_outputs/input_image.png --output example_outputs/output_image.png
-```
-
-## Conversion
-The ONNX model was exported from the frozen TensorFlow graph with tf2onnx (opset 18)
-via [convert_to_onnx.py](./convert_to_onnx.py) — input `image_tensor:0`, outputs
-`detection_boxes:0`, `detection_scores:0`, `detection_classes:0`, `num_detections:0`.
-Requires `tensorflow`, `tf2onnx`, and `onnx`.
-
-```bash
-python convert_to_onnx.py --pb ../pb/faster_rcnn_inception_v2_coco_2018_01_28.pb
-```
-
-## License
-See [LICENSE](./LICENSE) — the model is released by the TensorFlow Authors under the Apache License 2.0.
diff --git a/faster_rcnn_inception_v2_coco_2018_01_28/convert_to_onnx.py b/faster_rcnn_inception_v2_coco_2018_01_28/convert_to_onnx.py
deleted file mode 100644
index 7a068fa3176b9570edec5b4cfd5bb30ad93d15f0..0000000000000000000000000000000000000000
--- a/faster_rcnn_inception_v2_coco_2018_01_28/convert_to_onnx.py
+++ /dev/null
@@ -1,40 +0,0 @@
-import argparse
-import datetime
-
-import onnx
-import tensorflow as tf
-import tf2onnx
-
-
-def load_graph_def(pb_path):
- with tf.io.gfile.GFile(pb_path, "rb") as f:
- graph_def = tf.compat.v1.GraphDef()
- graph_def.ParseFromString(f.read())
- return graph_def
-
-
-def main():
- parser = argparse.ArgumentParser(description="Export faster_rcnn_inception_v2_coco_2018_01_28.pb to ONNX")
- parser.add_argument("--pb", default="../pb/faster_rcnn_inception_v2_coco_2018_01_28.pb")
- parser.add_argument("--opset", type=int, default=18)
- args = parser.parse_args()
-
- graph_def = load_graph_def(args.pb)
-
- model_proto, _ = tf2onnx.convert.from_graph_def(
- graph_def,
- input_names=["image_tensor:0"],
- output_names=["detection_boxes:0", "detection_scores:0", "detection_classes:0", "num_detections:0"],
- opset=args.opset,
- )
- onnx.checker.check_model(model_proto)
-
- stamp = datetime.datetime.now().strftime("%Y%b").lower()
- onnx_path = "faster_rcnn_inception_v2_coco_2018_01_28_%s.onnx" % stamp
- with open(onnx_path, "wb") as f:
- f.write(model_proto.SerializeToString())
- print("wrote", onnx_path)
-
-
-if __name__ == "__main__":
- main()
diff --git a/faster_rcnn_inception_v2_coco_2018_01_28/demo.cpp b/faster_rcnn_inception_v2_coco_2018_01_28/demo.cpp
deleted file mode 100644
index 549dd511c8479af904b1156ec2af5f8a8e9d782c..0000000000000000000000000000000000000000
--- a/faster_rcnn_inception_v2_coco_2018_01_28/demo.cpp
+++ /dev/null
@@ -1,83 +0,0 @@
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-static std::string argVal(int argc, char** argv, const std::string& key, const std::string& def)
-{
- for (int i = 1; i + 1 < argc; ++i)
- if (key == argv[i]) return argv[i + 1];
- return def;
-}
-
-int main(int argc, char** argv)
-{
- std::string model = argVal(argc, argv, "--model", "faster_rcnn_inception_v2_coco_2018_01_28_2026jul.onnx");
- std::string image = argVal(argc, argv, "--image", "example_outputs/input_image.png");
- std::string output = argVal(argc, argv, "--output", "example_outputs/output_image.png");
- float conf = std::stof(argVal(argc, argv, "--conf", "0.3"));
-
- cv::Mat img = cv::imread(image);
- if (img.empty())
- {
- std::cerr << "could not read image: " << image << std::endl;
- return 1;
- }
-
- const int W = 800, H = 600;
- cv::Mat rgb;
- cv::cvtColor(img, rgb, cv::COLOR_BGR2RGB);
- cv::resize(rgb, rgb, cv::Size(W, H));
- if (!rgb.isContinuous()) rgb = rgb.clone();
-
- int blobShape[] = {1, H, W, 3};
- cv::Mat blob(4, blobShape, CV_8U, rgb.data);
- cv::dnn::Net net = cv::dnn::readNetFromONNX(model, cv::dnn::ENGINE_ORT);
- net.setInput(blob);
- std::vector out_strs = {"detection_boxes:0", "detection_scores:0", "detection_classes:0", "num_detections:0"};
- std::vector outs;
- net.forward(outs, out_strs);
-
- float* boxes = nullptr;
- float* scores = nullptr;
- float* classes = nullptr;
- float* numd = nullptr;
- for (size_t i = 0; i < out_strs.size(); ++i)
- {
- float* p = (float*)outs[i].data;
- const std::string& n = out_strs[i];
- if (n.find("detection_boxes") != std::string::npos) boxes = p;
- else if (n.find("detection_scores") != std::string::npos) scores = p;
- else if (n.find("detection_classes") != std::string::npos) classes = p;
- else if (n.find("num_detections") != std::string::npos) numd = p;
- }
- int nd = (int)numd[0];
-
- int w = img.cols, h = img.rows;
- std::vector kept;
- for (int i = 0; i < nd; ++i)
- if (scores[i] >= conf) kept.push_back(i);
-
- std::cout << "faster_rcnn_inception_v2_coco_2018_01_28 " << kept.size() << " detections" << std::endl;
- for (int i : kept)
- {
- int cls = (int)classes[i] - 1;
- float score = scores[i];
- float ymin = boxes[i * 4 + 0], xmin = boxes[i * 4 + 1];
- float ymax = boxes[i * 4 + 2], xmax = boxes[i * 4 + 3];
- cv::Point p1((int)(xmin * w), (int)(ymin * h));
- cv::Point p2((int)(xmax * w), (int)(ymax * h));
- cv::rectangle(img, p1, p2, cv::Scalar(0, 255, 0), 2);
- cv::putText(img, cv::format("%d:%.2f", cls, score), cv::Point(p1.x, p1.y - 5),
- cv::FONT_HERSHEY_SIMPLEX, 0.5, cv::Scalar(0, 255, 0), 1);
- std::cout << cls << " " << cv::format("%.3f %.3f %.3f %.3f %.3f", score, xmin, ymin, xmax, ymax) << std::endl;
- }
-
- cv::imwrite(output, img);
- std::cout << "wrote " << output << std::endl;
- return 0;
-}
diff --git a/faster_rcnn_inception_v2_coco_2018_01_28/demo.py b/faster_rcnn_inception_v2_coco_2018_01_28/demo.py
deleted file mode 100644
index 893a190e01899a36d3a65d55386f8283a91ad1b0..0000000000000000000000000000000000000000
--- a/faster_rcnn_inception_v2_coco_2018_01_28/demo.py
+++ /dev/null
@@ -1,51 +0,0 @@
-import argparse
-import glob
-import os
-
-import cv2 as cv
-import numpy as np
-
-here = os.path.dirname(os.path.abspath(__file__))
-
-
-def main():
- parser = argparse.ArgumentParser(description="Faster-RCNN InceptionV2 (COCO) ONNX detection demo")
- parser.add_argument("--model", default=None)
- parser.add_argument("--image", default=os.path.join(here, "example_outputs", "input_image.png"))
- parser.add_argument("--output", default=os.path.join(here, "example_outputs", "output_image.png"))
- parser.add_argument("--conf", type=float, default=0.3)
- args = parser.parse_args()
-
- model = args.model or glob.glob(os.path.join(here, "*.onnx"))[0]
- img = cv.imread(args.image)
- if img is None:
- raise SystemExit("could not read image: %s" % args.image)
-
- rgb = cv.resize(cv.cvtColor(img, cv.COLOR_BGR2RGB), (800, 600))
- net = cv.dnn.readNetFromONNX(model, cv.dnn.ENGINE_ORT)
- onames = ["detection_boxes:0", "detection_scores:0", "detection_classes:0", "num_detections:0"]
- net.setInput(rgb[None].astype(np.uint8))
- res = net.forward(onames)
- boxes = res[[i for i, n in enumerate(onames) if "detection_boxes" in n][0]].reshape(-1, 4)
- scores = res[[i for i, n in enumerate(onames) if "detection_scores" in n][0]].reshape(-1)
- classes = res[[i for i, n in enumerate(onames) if "detection_classes" in n][0]].reshape(-1)
- nd = int(res[[i for i, n in enumerate(onames) if "num_detections" in n][0]].reshape(-1)[0])
-
- out = np.zeros((nd, 7), np.float32)
- out[:, 1] = classes[:nd] - 1
- out[:, 2] = scores[:nd]
- out[:, 3:7] = boxes[:nd][:, [1, 0, 3, 2]]
-
- h, w = img.shape[:2]
- kept = [row for row in out if row[2] >= args.conf]
- print(os.path.basename(here), len(kept), "detections")
- for row in kept:
- cv.rectangle(img, (int(row[3] * w), int(row[4] * h)), (int(row[5] * w), int(row[6] * h)), (0, 255, 0), 2)
- cv.putText(img, "%d:%.2f" % (int(row[1]), row[2]), (int(row[3] * w), int(row[4] * h) - 5), cv.FONT_HERSHEY_SIMPLEX, 0.5, (0, 255, 0), 1)
- print(int(row[1]), round(float(row[2]), 3), round(float(row[3]), 3), round(float(row[4]), 3), round(float(row[5]), 3), round(float(row[6]), 3))
- cv.imwrite(args.output, img)
- print("wrote", args.output)
-
-
-if __name__ == "__main__":
- main()
diff --git a/faster_rcnn_inception_v2_coco_2018_01_28/example_outputs/input_image.png b/faster_rcnn_inception_v2_coco_2018_01_28/example_outputs/input_image.png
deleted file mode 100644
index 326ece9829794ab70eaf0b1e3feac0a762099689..0000000000000000000000000000000000000000
--- a/faster_rcnn_inception_v2_coco_2018_01_28/example_outputs/input_image.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:61db162464c0770138c5136af0e999ce3b6556244cec257945427396480d9caf
-size 414310
diff --git a/faster_rcnn_inception_v2_coco_2018_01_28/example_outputs/output_image.png b/faster_rcnn_inception_v2_coco_2018_01_28/example_outputs/output_image.png
deleted file mode 100644
index ad9513ad6240fdfba347889986ffc2761d1780b9..0000000000000000000000000000000000000000
--- a/faster_rcnn_inception_v2_coco_2018_01_28/example_outputs/output_image.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:ef5519b779267068a419b329f67bab3b3529549ffbc5ffc26e79f154c4411a4d
-size 323543
diff --git a/faster_rcnn_inception_v2_coco_2018_01_28/faster_rcnn_inception_v2_coco_2018_01_28_2026jul.onnx b/faster_rcnn_inception_v2_coco_2018_01_28/faster_rcnn_inception_v2_coco_2018_01_28_2026jul.onnx
deleted file mode 100644
index d794f127217042b3a3fb5505d5c5741f42c00ff0..0000000000000000000000000000000000000000
--- a/faster_rcnn_inception_v2_coco_2018_01_28/faster_rcnn_inception_v2_coco_2018_01_28_2026jul.onnx
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:bcf541da5a58e9d8ab6c16e4c803ccc4e0da7dd62ad89311ae2a75c36b39835b
-size 57016094
diff --git a/faster_rcnn_resnet50_coco_2018_01_28/LICENSE b/faster_rcnn_resnet50_coco_2018_01_28/LICENSE
deleted file mode 100644
index 4421e8e7b19941bd420a2723bb31d0abc15cd3d7..0000000000000000000000000000000000000000
--- a/faster_rcnn_resnet50_coco_2018_01_28/LICENSE
+++ /dev/null
@@ -1,203 +0,0 @@
-Copyright 2015 The TensorFlow Authors. All rights reserved.
-
- 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
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright 2015, The TensorFlow Authors.
-
- 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.
\ No newline at end of file
diff --git a/faster_rcnn_resnet50_coco_2018_01_28/README.md b/faster_rcnn_resnet50_coco_2018_01_28/README.md
deleted file mode 100644
index c0152dd30eb5371d58f7f0ad71499a7ce0b8d9b4..0000000000000000000000000000000000000000
--- a/faster_rcnn_resnet50_coco_2018_01_28/README.md
+++ /dev/null
@@ -1,49 +0,0 @@
-# Faster-RCNN ResNet-50 (COCO)
-
-Object detection with the Faster-RCNN meta-architecture and a ResNet-50 backbone,
-trained on the COCO dataset. The model was originally distributed as a frozen TensorFlow
-graph (`faster_rcnn_resnet50_coco_2018_01_28.pb`) from the TensorFlow Object Detection
-API and converted to ONNX for inference with OpenCV's DNN module.
-
-## Model Details
-- **Architecture**: Faster-RCNN with a ResNet-50 backbone
-- **Input**: RGB image, uint8, NHWC layout (`image_tensor:0`, shape `[1, H, W, 3]`)
-- **Output**: `detection_boxes:0` (normalized `[ymin, xmin, ymax, xmax]`), `detection_scores:0`, `detection_classes:0` (1-based COCO ids), `num_detections:0`
-- **Framework**: ONNX (converted from the TensorFlow frozen graph via tf2onnx, opset 18)
-- **Original weights**: http://download.tensorflow.org/models/object_detection/faster_rcnn_resnet50_coco_2018_01_28.tar.gz
-
-## Usage
-
-### Python
-```bash
-python demo.py --model faster_rcnn_resnet50_coco_2018_01_28_2026jul.onnx --image example_outputs/input_image.png --output example_outputs/output_image.png --conf 0.3
-```
-
-### C++
-The C++ demo runs inference with OpenCV's DNN module. Adjust the OpenCV paths to your setup:
-```bash
-OCV=/path/to/opencv # OpenCV source tree
-OCVBUILD=/path/to/opencv/build # OpenCV build directory (generated headers + libs)
-g++ -std=c++17 demo.cpp -o demo \
- -I$OCV/include \
- -I$OCV/modules/core/include \
- -I$OCV/modules/dnn/include \
- -I$OCV/modules/imgproc/include \
- -I$OCV/modules/imgcodecs/include \
- -I$OCVBUILD \
- -L$OCVBUILD/lib -Wl,-rpath,$OCVBUILD/lib -lopencv_dnn -lopencv_imgcodecs -lopencv_imgproc -lopencv_core
-./demo --model faster_rcnn_resnet50_coco_2018_01_28_2026jul.onnx --image example_outputs/input_image.png --output example_outputs/output_image.png
-```
-
-## Conversion
-The ONNX model was exported from the frozen TensorFlow graph with tf2onnx (opset 18)
-via [convert_to_onnx.py](./convert_to_onnx.py) — input `image_tensor:0`, outputs
-`detection_boxes:0`, `detection_scores:0`, `detection_classes:0`, `num_detections:0`.
-Requires `tensorflow`, `tf2onnx`, and `onnx`.
-
-```bash
-python convert_to_onnx.py --pb ../pb/faster_rcnn_resnet50_coco_2018_01_28.pb
-```
-
-## License
-See [LICENSE](./LICENSE) — the model is released by the TensorFlow Authors under the Apache License 2.0.
diff --git a/faster_rcnn_resnet50_coco_2018_01_28/convert_to_onnx.py b/faster_rcnn_resnet50_coco_2018_01_28/convert_to_onnx.py
deleted file mode 100644
index e03a172b75d9ee116d6655433a37af9361c3f3d2..0000000000000000000000000000000000000000
--- a/faster_rcnn_resnet50_coco_2018_01_28/convert_to_onnx.py
+++ /dev/null
@@ -1,40 +0,0 @@
-import argparse
-import datetime
-
-import onnx
-import tensorflow as tf
-import tf2onnx
-
-
-def load_graph_def(pb_path):
- with tf.io.gfile.GFile(pb_path, "rb") as f:
- graph_def = tf.compat.v1.GraphDef()
- graph_def.ParseFromString(f.read())
- return graph_def
-
-
-def main():
- parser = argparse.ArgumentParser(description="Export faster_rcnn_resnet50_coco_2018_01_28.pb to ONNX")
- parser.add_argument("--pb", default="../pb/faster_rcnn_resnet50_coco_2018_01_28.pb")
- parser.add_argument("--opset", type=int, default=18)
- args = parser.parse_args()
-
- graph_def = load_graph_def(args.pb)
-
- model_proto, _ = tf2onnx.convert.from_graph_def(
- graph_def,
- input_names=["image_tensor:0"],
- output_names=["detection_boxes:0", "detection_scores:0", "detection_classes:0", "num_detections:0"],
- opset=args.opset,
- )
- onnx.checker.check_model(model_proto)
-
- stamp = datetime.datetime.now().strftime("%Y%b").lower()
- onnx_path = "faster_rcnn_resnet50_coco_2018_01_28_%s.onnx" % stamp
- with open(onnx_path, "wb") as f:
- f.write(model_proto.SerializeToString())
- print("wrote", onnx_path)
-
-
-if __name__ == "__main__":
- main()
diff --git a/faster_rcnn_resnet50_coco_2018_01_28/demo.cpp b/faster_rcnn_resnet50_coco_2018_01_28/demo.cpp
deleted file mode 100644
index cee9206ab323aa8caeef9e48e5a8576a1f531786..0000000000000000000000000000000000000000
--- a/faster_rcnn_resnet50_coco_2018_01_28/demo.cpp
+++ /dev/null
@@ -1,83 +0,0 @@
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-static std::string argVal(int argc, char** argv, const std::string& key, const std::string& def)
-{
- for (int i = 1; i + 1 < argc; ++i)
- if (key == argv[i]) return argv[i + 1];
- return def;
-}
-
-int main(int argc, char** argv)
-{
- std::string model = argVal(argc, argv, "--model", "faster_rcnn_resnet50_coco_2018_01_28_2026jul.onnx");
- std::string image = argVal(argc, argv, "--image", "example_outputs/input_image.png");
- std::string output = argVal(argc, argv, "--output", "example_outputs/output_image.png");
- float conf = std::stof(argVal(argc, argv, "--conf", "0.3"));
-
- cv::Mat img = cv::imread(image);
- if (img.empty())
- {
- std::cerr << "could not read image: " << image << std::endl;
- return 1;
- }
-
- const int W = 800, H = 600;
- cv::Mat rgb;
- cv::cvtColor(img, rgb, cv::COLOR_BGR2RGB);
- cv::resize(rgb, rgb, cv::Size(W, H));
- if (!rgb.isContinuous()) rgb = rgb.clone();
-
- int blobShape[] = {1, H, W, 3};
- cv::Mat blob(4, blobShape, CV_8U, rgb.data);
- cv::dnn::Net net = cv::dnn::readNetFromONNX(model, cv::dnn::ENGINE_ORT);
- net.setInput(blob);
- std::vector out_strs = {"detection_boxes:0", "detection_scores:0", "detection_classes:0", "num_detections:0"};
- std::vector outs;
- net.forward(outs, out_strs);
-
- float* boxes = nullptr;
- float* scores = nullptr;
- float* classes = nullptr;
- float* numd = nullptr;
- for (size_t i = 0; i < out_strs.size(); ++i)
- {
- float* p = (float*)outs[i].data;
- const std::string& n = out_strs[i];
- if (n.find("detection_boxes") != std::string::npos) boxes = p;
- else if (n.find("detection_scores") != std::string::npos) scores = p;
- else if (n.find("detection_classes") != std::string::npos) classes = p;
- else if (n.find("num_detections") != std::string::npos) numd = p;
- }
- int nd = (int)numd[0];
-
- int w = img.cols, h = img.rows;
- std::vector kept;
- for (int i = 0; i < nd; ++i)
- if (scores[i] >= conf) kept.push_back(i);
-
- std::cout << "faster_rcnn_resnet50_coco_2018_01_28 " << kept.size() << " detections" << std::endl;
- for (int i : kept)
- {
- int cls = (int)classes[i] - 1;
- float score = scores[i];
- float ymin = boxes[i * 4 + 0], xmin = boxes[i * 4 + 1];
- float ymax = boxes[i * 4 + 2], xmax = boxes[i * 4 + 3];
- cv::Point p1((int)(xmin * w), (int)(ymin * h));
- cv::Point p2((int)(xmax * w), (int)(ymax * h));
- cv::rectangle(img, p1, p2, cv::Scalar(0, 255, 0), 2);
- cv::putText(img, cv::format("%d:%.2f", cls, score), cv::Point(p1.x, p1.y - 5),
- cv::FONT_HERSHEY_SIMPLEX, 0.5, cv::Scalar(0, 255, 0), 1);
- std::cout << cls << " " << cv::format("%.3f %.3f %.3f %.3f %.3f", score, xmin, ymin, xmax, ymax) << std::endl;
- }
-
- cv::imwrite(output, img);
- std::cout << "wrote " << output << std::endl;
- return 0;
-}
diff --git a/faster_rcnn_resnet50_coco_2018_01_28/demo.py b/faster_rcnn_resnet50_coco_2018_01_28/demo.py
deleted file mode 100644
index 3648d5933e465a2a2d807423b8bd9aaceab7c361..0000000000000000000000000000000000000000
--- a/faster_rcnn_resnet50_coco_2018_01_28/demo.py
+++ /dev/null
@@ -1,51 +0,0 @@
-import argparse
-import glob
-import os
-
-import cv2 as cv
-import numpy as np
-
-here = os.path.dirname(os.path.abspath(__file__))
-
-
-def main():
- parser = argparse.ArgumentParser(description="Faster-RCNN ResNet-50 (COCO) ONNX detection demo")
- parser.add_argument("--model", default=None)
- parser.add_argument("--image", default=os.path.join(here, "example_outputs", "input_image.png"))
- parser.add_argument("--output", default=os.path.join(here, "example_outputs", "output_image.png"))
- parser.add_argument("--conf", type=float, default=0.3)
- args = parser.parse_args()
-
- model = args.model or glob.glob(os.path.join(here, "*.onnx"))[0]
- img = cv.imread(args.image)
- if img is None:
- raise SystemExit("could not read image: %s" % args.image)
-
- rgb = cv.resize(cv.cvtColor(img, cv.COLOR_BGR2RGB), (800, 600))
- net = cv.dnn.readNetFromONNX(model, cv.dnn.ENGINE_ORT)
- onames = ["detection_boxes:0", "detection_scores:0", "detection_classes:0", "num_detections:0"]
- net.setInput(rgb[None].astype(np.uint8))
- res = net.forward(onames)
- boxes = res[[i for i, n in enumerate(onames) if "detection_boxes" in n][0]].reshape(-1, 4)
- scores = res[[i for i, n in enumerate(onames) if "detection_scores" in n][0]].reshape(-1)
- classes = res[[i for i, n in enumerate(onames) if "detection_classes" in n][0]].reshape(-1)
- nd = int(res[[i for i, n in enumerate(onames) if "num_detections" in n][0]].reshape(-1)[0])
-
- out = np.zeros((nd, 7), np.float32)
- out[:, 1] = classes[:nd] - 1
- out[:, 2] = scores[:nd]
- out[:, 3:7] = boxes[:nd][:, [1, 0, 3, 2]]
-
- h, w = img.shape[:2]
- kept = [row for row in out if row[2] >= args.conf]
- print(os.path.basename(here), len(kept), "detections")
- for row in kept:
- cv.rectangle(img, (int(row[3] * w), int(row[4] * h)), (int(row[5] * w), int(row[6] * h)), (0, 255, 0), 2)
- cv.putText(img, "%d:%.2f" % (int(row[1]), row[2]), (int(row[3] * w), int(row[4] * h) - 5), cv.FONT_HERSHEY_SIMPLEX, 0.5, (0, 255, 0), 1)
- print(int(row[1]), round(float(row[2]), 3), round(float(row[3]), 3), round(float(row[4]), 3), round(float(row[5]), 3), round(float(row[6]), 3))
- cv.imwrite(args.output, img)
- print("wrote", args.output)
-
-
-if __name__ == "__main__":
- main()
diff --git a/faster_rcnn_resnet50_coco_2018_01_28/example_outputs/input_image.png b/faster_rcnn_resnet50_coco_2018_01_28/example_outputs/input_image.png
deleted file mode 100644
index 326ece9829794ab70eaf0b1e3feac0a762099689..0000000000000000000000000000000000000000
--- a/faster_rcnn_resnet50_coco_2018_01_28/example_outputs/input_image.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:61db162464c0770138c5136af0e999ce3b6556244cec257945427396480d9caf
-size 414310
diff --git a/faster_rcnn_resnet50_coco_2018_01_28/example_outputs/output_image.png b/faster_rcnn_resnet50_coco_2018_01_28/example_outputs/output_image.png
deleted file mode 100644
index 76e0171686a9e15bda4c23f971d80146628e658e..0000000000000000000000000000000000000000
--- a/faster_rcnn_resnet50_coco_2018_01_28/example_outputs/output_image.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:1111a91eb2db29d6293ef1b0da18e2ca39c878ad709e10e1892ec4e028e9d4cc
-size 328177
diff --git a/faster_rcnn_resnet50_coco_2018_01_28/faster_rcnn_resnet50_coco_2018_01_28_2026jul.onnx b/faster_rcnn_resnet50_coco_2018_01_28/faster_rcnn_resnet50_coco_2018_01_28_2026jul.onnx
deleted file mode 100644
index 56f77d974e05fa0d85053a2acd61547e01f23c86..0000000000000000000000000000000000000000
--- a/faster_rcnn_resnet50_coco_2018_01_28/faster_rcnn_resnet50_coco_2018_01_28_2026jul.onnx
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:217613103b36eba4771087bdae63a7c04ed545e7850087f205990db7e5f18b88
-size 120414387
diff --git a/mask_rcnn_inception_v2_coco_2018_01_28/LICENSE b/mask_rcnn_inception_v2_coco_2018_01_28/LICENSE
deleted file mode 100644
index 4421e8e7b19941bd420a2723bb31d0abc15cd3d7..0000000000000000000000000000000000000000
--- a/mask_rcnn_inception_v2_coco_2018_01_28/LICENSE
+++ /dev/null
@@ -1,203 +0,0 @@
-Copyright 2015 The TensorFlow Authors. All rights reserved.
-
- 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
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright 2015, The TensorFlow Authors.
-
- 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.
\ No newline at end of file
diff --git a/mask_rcnn_inception_v2_coco_2018_01_28/README.md b/mask_rcnn_inception_v2_coco_2018_01_28/README.md
deleted file mode 100644
index f3f36e1123ad2ef769f059f2c9e4f04c7bfa7351..0000000000000000000000000000000000000000
--- a/mask_rcnn_inception_v2_coco_2018_01_28/README.md
+++ /dev/null
@@ -1,51 +0,0 @@
-# Mask-RCNN Inception v2 COCO
-
-Instance segmentation with the Mask-RCNN Inception v2 network trained on the COCO dataset.
-The model was originally distributed as a frozen TensorFlow graph
-(`mask_rcnn_inception_v2_coco_2018_01_28.pb`) from the TensorFlow Object Detection API
-and converted to ONNX for use with OpenCV's DNN module.
-
-## Model Details
-- **Architecture**: Mask-RCNN with an Inception v2 backbone
-- **Input**: RGB image, uint8, NHWC layout (`image_tensor:0`); the demo resizes to 800×800
-- **Output**: `num_detections:0`, `detection_boxes:0` (normalized `[ymin, xmin, ymax, xmax]`),
- `detection_scores:0`, `detection_classes:0` (COCO ids, subtract 1 for a 0-based label),
- and `detection_masks:0` (a 15×15 mask per detection, resized to its box)
-- **Framework**: ONNX (converted from the TensorFlow frozen graph via tf2onnx, opset 18)
-- **Original weights**: http://download.tensorflow.org/models/object_detection/mask_rcnn_inception_v2_coco_2018_01_28.tar.gz
-
-## Usage
-
-### Python
-```bash
-python demo.py --model mask_rcnn_inception_v2_coco_2018_01_28_2026jul.onnx --image example_outputs/input_image.png --output example_outputs/output_image.png --conf 0.3
-```
-
-### C++
-The C++ demo runs inference with OpenCV's DNN module. Adjust the OpenCV paths to your setup:
-```bash
-OCV=/path/to/opencv # OpenCV source tree
-OCVBUILD=/path/to/opencv/build # OpenCV build directory (generated headers + libs)
-g++ -std=c++17 demo.cpp -o demo \
- -I$OCV/include \
- -I$OCV/modules/core/include \
- -I$OCV/modules/dnn/include \
- -I$OCV/modules/imgproc/include \
- -I$OCV/modules/imgcodecs/include \
- -I$OCVBUILD \
- -L$OCVBUILD/lib -Wl,-rpath,$OCVBUILD/lib -lopencv_dnn -lopencv_imgcodecs -lopencv_imgproc -lopencv_core
-./demo --model mask_rcnn_inception_v2_coco_2018_01_28_2026jul.onnx --image example_outputs/input_image.png --output example_outputs/output_image.png
-```
-
-## Conversion
-The ONNX model was exported from the frozen TensorFlow graph with tf2onnx (opset 18)
-via [convert_to_onnx.py](./convert_to_onnx.py) — input `image_tensor:0`, outputs
-`num_detections:0`, `detection_boxes:0`, `detection_scores:0`, `detection_classes:0`,
-and `detection_masks:0`. Requires `tensorflow`, `tf2onnx`, and `onnx`.
-
-```bash
-python convert_to_onnx.py --pb ../pb/mask_rcnn_inception_v2_coco_2018_01_28.pb
-```
-
-## License
-See [LICENSE](./LICENSE) — the model is released by the TensorFlow Authors under the Apache License 2.0.
diff --git a/mask_rcnn_inception_v2_coco_2018_01_28/convert_to_onnx.py b/mask_rcnn_inception_v2_coco_2018_01_28/convert_to_onnx.py
deleted file mode 100644
index 07eb1d0756c951feeeedc2030f195a074a0bdf00..0000000000000000000000000000000000000000
--- a/mask_rcnn_inception_v2_coco_2018_01_28/convert_to_onnx.py
+++ /dev/null
@@ -1,46 +0,0 @@
-import argparse
-import datetime
-
-import onnx
-import tensorflow as tf
-import tf2onnx
-
-
-def load_graph_def(pb_path):
- with tf.io.gfile.GFile(pb_path, "rb") as f:
- graph_def = tf.compat.v1.GraphDef()
- graph_def.ParseFromString(f.read())
- return graph_def
-
-
-def main():
- parser = argparse.ArgumentParser(description="Export mask_rcnn_inception_v2_coco_2018_01_28.pb to ONNX")
- parser.add_argument("--pb", default="../pb/mask_rcnn_inception_v2_coco_2018_01_28.pb")
- parser.add_argument("--opset", type=int, default=18)
- args = parser.parse_args()
-
- graph_def = load_graph_def(args.pb)
-
- model_proto, _ = tf2onnx.convert.from_graph_def(
- graph_def,
- input_names=["image_tensor:0"],
- output_names=[
- "num_detections:0",
- "detection_boxes:0",
- "detection_scores:0",
- "detection_classes:0",
- "detection_masks:0",
- ],
- opset=args.opset,
- )
- onnx.checker.check_model(model_proto)
-
- stamp = datetime.datetime.now().strftime("%Y%b").lower()
- onnx_path = "mask_rcnn_inception_v2_coco_2018_01_28_%s.onnx" % stamp
- with open(onnx_path, "wb") as f:
- f.write(model_proto.SerializeToString())
- print("wrote", onnx_path)
-
-
-if __name__ == "__main__":
- main()
diff --git a/mask_rcnn_inception_v2_coco_2018_01_28/demo.cpp b/mask_rcnn_inception_v2_coco_2018_01_28/demo.cpp
deleted file mode 100644
index 49c7faf6da9c3ec57f06217e758783049f29dd12..0000000000000000000000000000000000000000
--- a/mask_rcnn_inception_v2_coco_2018_01_28/demo.cpp
+++ /dev/null
@@ -1,109 +0,0 @@
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-static std::string argVal(int argc, char** argv, const std::string& key, const std::string& def)
-{
- for (int i = 1; i + 1 < argc; ++i)
- if (key == argv[i]) return argv[i + 1];
- return def;
-}
-
-int main(int argc, char** argv)
-{
- std::string model = argVal(argc, argv, "--model", "mask_rcnn_inception_v2_coco_2018_01_28_2026jul.onnx");
- std::string image = argVal(argc, argv, "--image", "example_outputs/input_image.png");
- std::string output = argVal(argc, argv, "--output", "example_outputs/output_image.png");
- float conf = std::stof(argVal(argc, argv, "--conf", "0.3"));
-
- cv::Mat img = cv::imread(image);
- if (img.empty())
- {
- std::cerr << "could not read image: " << image << std::endl;
- return 1;
- }
-
- const int W = 800, H = 800;
- cv::Mat rgb;
- cv::cvtColor(img, rgb, cv::COLOR_BGR2RGB);
- cv::resize(rgb, rgb, cv::Size(W, H));
- if (!rgb.isContinuous()) rgb = rgb.clone();
-
- int blobShape[] = {1, H, W, 3};
- cv::Mat blob(4, blobShape, CV_8U, rgb.data);
- cv::dnn::Net net = cv::dnn::readNetFromONNX(model, cv::dnn::ENGINE_ORT);
- net.setInput(blob);
- std::vector out_strs = {"num_detections:0", "detection_boxes:0", "detection_scores:0", "detection_classes:0", "detection_masks:0"};
- std::vector outs;
- net.forward(outs, out_strs);
-
- float* boxes = nullptr;
- float* scores = nullptr;
- float* classes = nullptr;
- float* numd = nullptr;
- float* masks = nullptr;
- for (size_t i = 0; i < out_strs.size(); ++i)
- {
- float* p = (float*)outs[i].data;
- const std::string& n = out_strs[i];
- if (n.find("detection_boxes") != std::string::npos) boxes = p;
- else if (n.find("detection_scores") != std::string::npos) scores = p;
- else if (n.find("detection_classes") != std::string::npos) classes = p;
- else if (n.find("num_detections") != std::string::npos) numd = p;
- else if (n.find("detection_masks") != std::string::npos) masks = p;
- }
- int nd = (int)numd[0];
-
- int w = img.cols, h = img.rows;
- cv::Mat out = img.clone();
- std::vector kept;
- for (int i = 0; i < nd; ++i)
- if (scores[i] >= conf) kept.push_back(i);
-
- std::cout << "mask_rcnn_inception_v2_coco_2018_01_28 " << kept.size() << " detections" << std::endl;
- for (int i : kept)
- {
- int cls = (int)classes[i] - 1;
- float score = scores[i];
- float y1 = boxes[i * 4 + 0], x1 = boxes[i * 4 + 1];
- float y2 = boxes[i * 4 + 2], x2 = boxes[i * 4 + 3];
- int px1 = std::max(0, (int)(x1 * w)), py1 = std::max(0, (int)(y1 * h));
- int px2 = std::min(w, (int)(x2 * w)), py2 = std::min(h, (int)(y2 * h));
-
- unsigned s = (unsigned)i * 2654435761u + 1u;
- int col[3];
- for (int c = 0; c < 3; ++c) { s = s * 1664525u + 1013904223u; col[c] = 80 + (int)((s >> 8) % 176u); }
- cv::Scalar color(col[0], col[1], col[2]);
-
- if (px2 > px1 && py2 > py1)
- {
- cv::Mat m15(15, 15, CV_32F, masks + (size_t)i * 225);
- cv::Mat mr;
- cv::resize(m15, mr, cv::Size(px2 - px1, py2 - py1));
- cv::Mat roi = out(cv::Rect(px1, py1, px2 - px1, py2 - py1));
- for (int y = 0; y < roi.rows; ++y)
- {
- cv::Vec3b* rp = roi.ptr(y);
- const float* mp = mr.ptr(y);
- for (int x = 0; x < roi.cols; ++x)
- if (mp[x] > 0.5f)
- for (int c = 0; c < 3; ++c)
- rp[x][c] = (uchar)(0.5 * rp[x][c] + 0.5 * col[c]);
- }
- }
- cv::rectangle(out, cv::Point(px1, py1), cv::Point(px2, py2), color, 2);
- cv::putText(out, cv::format("%d:%.2f", cls, score), cv::Point(px1, py1 - 5),
- cv::FONT_HERSHEY_SIMPLEX, 0.5, color, 1);
- std::cout << cls << " " << cv::format("%.3f %.3f %.3f %.3f %.3f", score, x1, y1, x2, y2) << std::endl;
- }
-
- cv::imwrite(output, out);
- std::cout << "wrote " << output << std::endl;
- return 0;
-}
diff --git a/mask_rcnn_inception_v2_coco_2018_01_28/demo.py b/mask_rcnn_inception_v2_coco_2018_01_28/demo.py
deleted file mode 100644
index 2dd988a13e3fc374719a06e5204e2d066f8248ef..0000000000000000000000000000000000000000
--- a/mask_rcnn_inception_v2_coco_2018_01_28/demo.py
+++ /dev/null
@@ -1,59 +0,0 @@
-import argparse
-import glob
-import os
-
-import cv2 as cv
-import numpy as np
-
-here = os.path.dirname(os.path.abspath(__file__))
-
-
-def main():
- parser = argparse.ArgumentParser(description="Mask-RCNN Inception v2 COCO (OpenCV DNN) detection + mask demo")
- found = glob.glob(os.path.join(here, "*.onnx"))
- parser.add_argument("--model", default=found[0] if found else None)
- parser.add_argument("--image", default=os.path.join(here, "example_outputs", "input_image.png"))
- parser.add_argument("--output", default=os.path.join(here, "example_outputs", "output_image.png"))
- parser.add_argument("--conf", type=float, default=0.3)
- args = parser.parse_args()
-
- img = cv.imread(args.image)
- if img is None:
- raise SystemExit("could not read image: %s" % args.image)
-
- net = cv.dnn.readNetFromONNX(args.model, cv.dnn.ENGINE_ORT)
- rgb = cv.resize(cv.cvtColor(img, cv.COLOR_BGR2RGB), (800, 800))
- onames = ["num_detections:0", "detection_boxes:0", "detection_scores:0", "detection_classes:0", "detection_masks:0"]
- net.setInput(rgb[None].astype(np.uint8))
- res = net.forward(onames)
- boxes = res[[i for i, n in enumerate(onames) if "detection_boxes" in n][0]].reshape(-1, 4)
- scores = res[[i for i, n in enumerate(onames) if "detection_scores" in n][0]].reshape(-1)
- classes = res[[i for i, n in enumerate(onames) if "detection_classes" in n][0]].reshape(-1)
- nd = int(res[[i for i, n in enumerate(onames) if "num_detections" in n][0]].reshape(-1)[0])
- masks = res[[i for i, n in enumerate(onames) if "detection_masks" in n][0]].reshape(-1, 15, 15)
-
- h, w = img.shape[:2]
- out = img.copy()
- kept = [i for i in range(nd) if scores[i] >= args.conf]
- print("mask_rcnn_inception_v2_coco_2018_01_28", len(kept), "detections")
- for i in kept:
- cls = int(classes[i]) - 1
- score = float(scores[i])
- y1, x1, y2, x2 = boxes[i]
- px1, py1 = max(0, int(x1 * w)), max(0, int(y1 * h))
- px2, py2 = min(w, int(x2 * w)), min(h, int(y2 * h))
- color = tuple(int(c) for c in np.random.default_rng(i).integers(80, 256, 3))
- if px2 > px1 and py2 > py1:
- m = cv.resize(masks[i], (px2 - px1, py2 - py1)) > 0.5
- roi = out[py1:py2, px1:px2]
- roi[m] = (0.5 * roi[m] + 0.5 * np.array(color)).astype(np.uint8)
- cv.rectangle(out, (px1, py1), (px2, py2), color, 2)
- cv.putText(out, "%d:%.2f" % (cls, score), (px1, py1 - 5), cv.FONT_HERSHEY_SIMPLEX, 0.5, color, 1)
- print(cls, round(score, 3), round(float(x1), 3), round(float(y1), 3), round(float(x2), 3), round(float(y2), 3))
-
- cv.imwrite(args.output, out)
- print("wrote", args.output)
-
-
-if __name__ == "__main__":
- main()
diff --git a/mask_rcnn_inception_v2_coco_2018_01_28/example_outputs/input_image.png b/mask_rcnn_inception_v2_coco_2018_01_28/example_outputs/input_image.png
deleted file mode 100644
index d892556078d2c17296761359f03ac8dca9b1be26..0000000000000000000000000000000000000000
--- a/mask_rcnn_inception_v2_coco_2018_01_28/example_outputs/input_image.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:d711ef10627f93def79c0c6ec2d0fc3da06cbb7e426d81fd2782538c3c549f52
-size 508341
diff --git a/mask_rcnn_inception_v2_coco_2018_01_28/example_outputs/output_image.png b/mask_rcnn_inception_v2_coco_2018_01_28/example_outputs/output_image.png
deleted file mode 100644
index 939b36c1f684166d9f3e4a7fbe127fd376a75397..0000000000000000000000000000000000000000
--- a/mask_rcnn_inception_v2_coco_2018_01_28/example_outputs/output_image.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:3e1d9152370bbb8a15fcf7424f4a767edca0e9317d27f1f44346996eba6c887e
-size 454347
diff --git a/mask_rcnn_inception_v2_coco_2018_01_28/mask_rcnn_inception_v2_coco_2018_01_28_2026jul.onnx b/mask_rcnn_inception_v2_coco_2018_01_28/mask_rcnn_inception_v2_coco_2018_01_28_2026jul.onnx
deleted file mode 100644
index bfdf117cae2e198d4e034cd79e8c2b3b80b4ed3d..0000000000000000000000000000000000000000
--- a/mask_rcnn_inception_v2_coco_2018_01_28/mask_rcnn_inception_v2_coco_2018_01_28_2026jul.onnx
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:27cdd89df33ab94f61fd278350f66996efec3437937b5679a311ba55e386690f
-size 66728941
diff --git a/opencv_face_detector_uint8/LICENSE b/opencv_face_detector_uint8/LICENSE
deleted file mode 100644
index 1b021717fc0aba9870e2c60095334acb733ce922..0000000000000000000000000000000000000000
--- a/opencv_face_detector_uint8/LICENSE
+++ /dev/null
@@ -1,203 +0,0 @@
-Copyright (c) OpenCV team and the opencv_3rdparty contributors. All rights reserved.
-
- 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
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright (c) OpenCV team and the opencv_3rdparty contributors.
-
- 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.
\ No newline at end of file
diff --git a/opencv_face_detector_uint8/README.md b/opencv_face_detector_uint8/README.md
deleted file mode 100644
index 5668500ae82d86eac0211aa75de5a2deebb0bc35..0000000000000000000000000000000000000000
--- a/opencv_face_detector_uint8/README.md
+++ /dev/null
@@ -1,67 +0,0 @@
-# OpenCV SSD Face Detector (UINT8)
-
-Single-shot face detection with the OpenCV SSD ResNet-10 network. The model ships in the
-OpenCV project as a quantized frozen TensorFlow graph (`opencv_face_detector_uint8.pb`) and is
-converted here to ONNX for use with OpenCV's DNN module. Only the backbone is
-exported — PriorBox generation, the confidence softmax, variance decode, score threshold and NMS
-are run in host code (see `demo.py` / `demo.cpp`).
-
-## Model Details
-- **Architecture**: SSD with a ResNet-10 backbone (face detector)
-- **Input**: BGR image, 300×300, mean-subtracted by `[104, 177, 123]` (no scaling, no RGB swap),
- NHWC layout (`data:0`, shape `[1, 300, 300, 3]`)
-- **Output**: `mbox_loc` (`[1, 35568]`, box regressions) and `mbox_conf_flatten`
- (`[1, 17784]`, 2-class face/background logits); PriorBox decode + softmax + NMS are done in the demo
-- **Framework**: ONNX (converted from the TensorFlow frozen graph — uint8 weights with the
- `Dequantize` nodes folded to float `Const` — via tf2onnx, opset 18)
-- **Original weights**: https://github.com/opencv/opencv_3rdparty/raw/8033c2bc31b3256f0d461c919ecc01c2428ca03b/opencv_face_detector_uint8.pb
-
-The 6 SSD prior layers (min/max size, aspect ratios, step, feature-map size), the variances
-`[0.1, 0.1, 0.2, 0.2]`, the default confidence threshold `0.4` and the NMS IoU `0.3` are all
-defined in the demo scripts.
-
-## Usage
-
-### Python
-```bash
-python demo.py --model opencv_face_detector_uint8_2026jul.onnx --image example_outputs/input_image.png --output example_outputs/output_image.png --conf 0.4
-```
-
-Or import directly:
-```python
-import cv2
-
-net = cv2.dnn.readNet("opencv_face_detector_uint8_2026jul.onnx")
-# see demo.py for the full PriorBox decode + softmax + NMS pipeline
-```
-
-### C++
-The C++ demo runs inference with OpenCV's DNN module. Adjust the OpenCV paths to your setup:
-```bash
-OCV=/path/to/opencv # OpenCV source tree
-OCVBUILD=/path/to/opencv/build # OpenCV build directory (generated headers + libs)
-g++ -std=c++17 demo.cpp -o demo \
- -I$OCV/include \
- -I$OCV/modules/core/include \
- -I$OCV/modules/dnn/include \
- -I$OCV/modules/imgproc/include \
- -I$OCV/modules/imgcodecs/include \
- -I$OCVBUILD \
- -L$OCVBUILD/lib -Wl,-rpath,$OCVBUILD/lib -lopencv_dnn -lopencv_imgcodecs -lopencv_imgproc -lopencv_core
-./demo --model opencv_face_detector_uint8_2026jul.onnx --image example_outputs/input_image.png --output example_outputs/output_image.png
-```
-
-## Conversion
-The ONNX model was exported from the frozen TensorFlow graph with tf2onnx (opset 18) via
-[convert_to_onnx.py](./convert_to_onnx.py). The `.pb` stores its weights behind `Dequantize`
-nodes, so the script first folds every `Dequantize` node to a float `Const` before conversion.
-Inputs `data:0`, outputs `mbox_loc:0` and `mbox_conf_flatten:0`, input shape overridden to
-`[1, 300, 300, 3]`. Requires `tensorflow`, `tf2onnx`, and `onnx`.
-
-```bash
-python convert_to_onnx.py --pb ../pb/opencv_face_detector_uint8.pb
-```
-
-## License
-See [LICENSE](./LICENSE) — this is the OpenCV face detector distributed via `opencv_3rdparty`
-under the Apache License 2.0.
diff --git a/opencv_face_detector_uint8/convert_to_onnx.py b/opencv_face_detector_uint8/convert_to_onnx.py
deleted file mode 100644
index 05edd72d7bdae1c4c96d3e0604379a7d3d00fbd7..0000000000000000000000000000000000000000
--- a/opencv_face_detector_uint8/convert_to_onnx.py
+++ /dev/null
@@ -1,73 +0,0 @@
-import argparse
-import datetime
-
-import numpy as np
-import tensorflow as tf
-import tf2onnx
-import onnx
-from tensorflow.python.framework import graph_util, tensor_util
-
-
-def dequantize(graph_def, outputs):
- dmin = {n.name: n.input[1] for n in graph_def.node if n.op == "Dequantize"}
- folded = {}
- with tf.Graph().as_default() as g:
- tf.import_graph_def(graph_def, name="")
- deq = list(dmin)
- with tf.compat.v1.Session(graph=g) as sess:
- for name in deq:
- v = np.asarray(sess.run(g.get_tensor_by_name(name + ":0")), np.float32)
- if not np.isfinite(v).all():
- mn = np.float32(sess.run(g.get_tensor_by_name(dmin[name] + ":0")))
- v = np.full(v.shape, mn, np.float32)
- folded[name] = v
- new = tf.compat.v1.GraphDef()
- for n in graph_def.node:
- if n.op == "Dequantize":
- v = folded[n.name]
- c = new.node.add()
- c.op = "Const"
- c.name = n.name
- c.attr["dtype"].type = tf.float32.as_datatype_enum
- c.attr["value"].tensor.CopyFrom(tensor_util.make_tensor_proto(v, tf.float32, v.shape))
- else:
- new.node.add().CopyFrom(n)
- return graph_util.extract_sub_graph(new, [o.split(":")[0] for o in outputs])
-
-
-def load_graph_def(pb_path):
- with tf.io.gfile.GFile(pb_path, "rb") as f:
- graph_def = tf.compat.v1.GraphDef()
- graph_def.ParseFromString(f.read())
- return graph_def
-
-
-def main():
- parser = argparse.ArgumentParser(description="Export opencv_face_detector_uint8.pb (backbone) to ONNX")
- parser.add_argument("--pb", default="../pb/opencv_face_detector_uint8.pb")
- parser.add_argument("--opset", type=int, default=18)
- args = parser.parse_args()
-
- output_names = ["mbox_loc:0", "mbox_conf_flatten:0"]
-
- graph_def = load_graph_def(args.pb)
- graph_def = dequantize(graph_def, output_names)
-
- model_proto, _ = tf2onnx.convert.from_graph_def(
- graph_def,
- input_names=["data:0"],
- output_names=output_names,
- opset=args.opset,
- shape_override={"data:0": [1, 300, 300, 3]},
- )
- onnx.checker.check_model(model_proto)
-
- stamp = datetime.datetime.now().strftime("%Y%b").lower()
- onnx_path = "opencv_face_detector_uint8_%s.onnx" % stamp
- with open(onnx_path, "wb") as f:
- f.write(model_proto.SerializeToString())
- print("wrote", onnx_path)
-
-
-if __name__ == "__main__":
- main()
diff --git a/opencv_face_detector_uint8/demo.cpp b/opencv_face_detector_uint8/demo.cpp
deleted file mode 100644
index 3b5d20538e8830c82fefa6c069d7cad0fdf70d68..0000000000000000000000000000000000000000
--- a/opencv_face_detector_uint8/demo.cpp
+++ /dev/null
@@ -1,146 +0,0 @@
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-using namespace cv;
-
-static std::string argVal(int argc, char** argv, const std::string& key, const std::string& def)
-{
- for (int i = 1; i + 1 < argc; ++i)
- if (key == argv[i]) return argv[i + 1];
- return def;
-}
-
-struct Layer { float mn, mx; std::vector ars; int step, fm; };
-
-int main(int argc, char** argv)
-{
- std::string model = argVal(argc, argv, "--model", "opencv_face_detector_uint8_2026jul.onnx");
- std::string image = argVal(argc, argv, "--image", "example_outputs/input_image.png");
- std::string output = argVal(argc, argv, "--output", "example_outputs/output_image.png");
- float thr = std::stof(argVal(argc, argv, "--conf", "0.4"));
-
- const int sz = 300;
- Mat img = imread(image);
- if (img.empty())
- {
- std::cerr << "could not read image: " << image << std::endl;
- return 1;
- }
-
- Mat inp;
- resize(img, inp, Size(sz, sz));
- inp.convertTo(inp, CV_32F);
- subtract(inp, Scalar(104, 177, 123), inp);
- if (!inp.isContinuous()) inp = inp.clone();
-
- int blobShape[] = {1, sz, sz, 3};
- Mat blob(4, blobShape, CV_32F, inp.data);
- dnn::Net net = dnn::readNetFromONNX(model);
- net.setInput(blob);
- std::vector outs;
- net.forward(outs, net.getUnconnectedOutLayersNames());
-
- const float* loc = nullptr;
- const float* conf = nullptr;
- for (size_t i = 0; i < outs.size(); ++i)
- {
- const Mat& o = outs[i];
- size_t tot = o.total();
- const float* p = (const float*)o.data;
- if (tot == 35568) loc = p;
- else if (tot == 17784) conf = p;
- }
-
- std::vector layers = {
- {30, 60, {2}, 8, 38},
- {60, 111, {2, 3}, 16, 19},
- {111, 162, {2, 3}, 32, 10},
- {162, 213, {2, 3}, 64, 5},
- {213, 264, {2}, 100, 5},
- {264, 315, {2}, 300, 5},
- };
- std::vector priors;
- for (const Layer& L : layers)
- {
- std::vector ratios = {1.0f};
- for (int a : L.ars) { ratios.push_back((float)a); ratios.push_back(1.0f / a); }
- for (int y = 0; y < L.fm; ++y)
- for (int x = 0; x < L.fm; ++x)
- {
- float cx = (x + 0.5f) * L.step;
- float cy = (y + 0.5f) * L.step;
- std::vector boxes = {{L.mn, L.mn}, {std::sqrt(L.mn * L.mx), std::sqrt(L.mn * L.mx)}};
- for (size_t k = 1; k < ratios.size(); ++k)
- {
- float a = ratios[k];
- boxes.push_back({L.mn * std::sqrt(a), L.mn / std::sqrt(a)});
- }
- for (const Vec2f& b : boxes)
- priors.push_back({cx, cy, b[0], b[1]});
- }
- }
-
- const float var[4] = {0.1f, 0.1f, 0.2f, 0.2f};
- int n = (int)priors.size();
- std::vector boxes;
- std::vector scores;
- for (int i = 0; i < n; ++i)
- {
- float c0 = conf[i * 2], c1 = conf[i * 2 + 1];
- float m = std::max(c0, c1);
- float e0 = std::exp(c0 - m), e1 = std::exp(c1 - m);
- float s = e1 / (e0 + e1);
- if (s <= thr) continue;
- float pcx = priors[i][0] / sz, pcy = priors[i][1] / sz;
- float pw = priors[i][2] / sz, ph = priors[i][3] / sz;
- float cx = pcx + loc[i * 4] * var[0] * pw;
- float cy = pcy + loc[i * 4 + 1] * var[1] * ph;
- float bw = pw * std::exp(loc[i * 4 + 2] * var[2]);
- float bh = ph * std::exp(loc[i * 4 + 3] * var[3]);
- boxes.push_back(Rect2f(cx - bw / 2, cy - bh / 2, bw, bh));
- scores.push_back(s);
- }
-
- std::vector order(scores.size());
- for (size_t i = 0; i < order.size(); ++i) order[i] = (int)i;
- std::sort(order.begin(), order.end(), [&](int a, int b){ return scores[a] > scores[b]; });
- std::vector removed(order.size(), 0);
- std::vector pick;
- for (size_t oi = 0; oi < order.size(); ++oi)
- {
- if (removed[oi]) continue;
- int i = order[oi];
- pick.push_back(i);
- for (size_t oj = oi + 1; oj < order.size(); ++oj)
- {
- if (removed[oj]) continue;
- int j = order[oj];
- const Rect2f& a = boxes[i];
- const Rect2f& b = boxes[j];
- float xx1 = std::max(a.x, b.x), yy1 = std::max(a.y, b.y);
- float xx2 = std::min(a.x + a.width, b.x + b.width);
- float yy2 = std::min(a.y + a.height, b.y + b.height);
- float inter = std::max(0.f, xx2 - xx1) * std::max(0.f, yy2 - yy1);
- float iou = inter / (a.area() + b.area() - inter + 1e-9f);
- if (iou > 0.3f) removed[oj] = 1;
- }
- }
-
- int W = img.cols, H = img.rows;
- for (int i : pick)
- {
- const Rect2f& b = boxes[i];
- rectangle(img, Point(int(b.x * W), int(b.y * H)),
- Point(int((b.x + b.width) * W), int((b.y + b.height) * H)), Scalar(0, 255, 0), 2);
- }
- imwrite(output, img);
- std::cout << "opencv_face_detector_uint8 " << pick.size() << " faces" << std::endl;
- return 0;
-}
diff --git a/opencv_face_detector_uint8/demo.py b/opencv_face_detector_uint8/demo.py
deleted file mode 100644
index 4b1c44b9c037345ec78be800516ce70a6f2fab0b..0000000000000000000000000000000000000000
--- a/opencv_face_detector_uint8/demo.py
+++ /dev/null
@@ -1,109 +0,0 @@
-import argparse
-import glob
-import os
-
-import cv2 as cv
-import numpy as np
-
-here = os.path.dirname(os.path.abspath(__file__))
-
-sz = 300
-layers = [
- (30, 60, [2], 8, 38),
- (60, 111, [2, 3], 16, 19),
- (111, 162, [2, 3], 32, 10),
- (162, 213, [2, 3], 64, 5),
- (213, 264, [2], 100, 5),
- (264, 315, [2], 300, 5),
-]
-var = [0.1, 0.1, 0.2, 0.2]
-
-
-def build_priors():
- p = []
- for mn, mx, ars, step, fm in layers:
- ratios = [1.0]
- for a in ars:
- ratios += [a, 1.0 / a]
- for y in range(fm):
- for x in range(fm):
- cx = (x + 0.5) * step
- cy = (y + 0.5) * step
- boxes = [(mn, mn), ((mn * mx) ** 0.5, (mn * mx) ** 0.5)]
- for a in ratios[1:]:
- boxes.append((mn * a ** 0.5, mn / a ** 0.5))
- for bw, bh in boxes:
- p.append([cx, cy, bw, bh])
- return np.array(p, np.float32)
-
-
-def default_model():
- files = [f for f in glob.glob(os.path.join(here, "*.onnx")) if "known_good" not in os.path.basename(f)]
- return files[0] if files else os.path.join(here, "opencv_face_detector_uint8.onnx")
-
-
-def main():
- parser = argparse.ArgumentParser(description="OpenCV SSD face detector (ONNX) demo")
- parser.add_argument("--model", default=default_model())
- parser.add_argument("--image", default=os.path.join(here, "example_outputs", "input_image.png"))
- parser.add_argument("--output", default=os.path.join(here, "example_outputs", "output_image.png"))
- parser.add_argument("--conf", type=float, default=0.4)
- args = parser.parse_args()
-
- img = cv.imread(args.image)
- if img is None:
- raise SystemExit("could not read image: %s" % args.image)
-
- inp = cv.resize(img, (sz, sz)).astype(np.float32) - np.array([104.0, 177.0, 123.0], np.float32)
-
- net = cv.dnn.readNetFromONNX(args.model)
- onames = net.getUnconnectedOutLayersNames()
- net.setInput(inp[None])
- res = net.forward(onames)
- loc = res[[i for i, n in enumerate(onames) if "mbox_loc" in n][0]].reshape(-1, 4)
- conf = res[[i for i, n in enumerate(onames) if "mbox_conf" in n][0]].reshape(-1, 2)
-
- priors = build_priors()
- pcx = priors[:, 0] / sz
- pcy = priors[:, 1] / sz
- pw = priors[:, 2] / sz
- ph = priors[:, 3] / sz
-
- e = np.exp(conf - conf.max(1, keepdims=True))
- sm = e / e.sum(1, keepdims=True)
- scores = sm[:, 1]
-
- cx = pcx + loc[:, 0] * var[0] * pw
- cy = pcy + loc[:, 1] * var[1] * ph
- bw = pw * np.exp(loc[:, 2] * var[2])
- bh = ph * np.exp(loc[:, 3] * var[3])
- boxes = np.stack([cx - bw / 2, cy - bh / 2, cx + bw / 2, cy + bh / 2], 1)
-
- keep = scores > args.conf
- boxes = boxes[keep]
- scores = scores[keep]
- order = scores.argsort()[::-1]
- pick = []
- while order.size:
- i = order[0]
- pick.append(i)
- xx1 = np.maximum(boxes[i, 0], boxes[order[1:], 0])
- yy1 = np.maximum(boxes[i, 1], boxes[order[1:], 1])
- xx2 = np.minimum(boxes[i, 2], boxes[order[1:], 2])
- yy2 = np.minimum(boxes[i, 3], boxes[order[1:], 3])
- inter = np.maximum(0, xx2 - xx1) * np.maximum(0, yy2 - yy1)
- ai = (boxes[i, 2] - boxes[i, 0]) * (boxes[i, 3] - boxes[i, 1])
- aj = (boxes[order[1:], 2] - boxes[order[1:], 0]) * (boxes[order[1:], 3] - boxes[order[1:], 1])
- iou = inter / (ai + aj - inter + 1e-9)
- order = order[1:][iou <= 0.3]
-
- h, w = img.shape[:2]
- for i in pick:
- x1, y1, x2, y2 = boxes[i]
- cv.rectangle(img, (int(x1 * w), int(y1 * h)), (int(x2 * w), int(y2 * h)), (0, 255, 0), 2)
- cv.imwrite(args.output, img)
- print("opencv_face_detector_uint8", len(pick), "faces")
-
-
-if __name__ == "__main__":
- main()
diff --git a/opencv_face_detector_uint8/example_outputs/input_image.png b/opencv_face_detector_uint8/example_outputs/input_image.png
deleted file mode 100644
index b4a10d783f902fadc45dc36d27d643b8a10d16a1..0000000000000000000000000000000000000000
--- a/opencv_face_detector_uint8/example_outputs/input_image.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:c232b8830623d924c518183cd005f7ff7d7b735e19c1cd26a2a59613d452a3d4
-size 198308
diff --git a/opencv_face_detector_uint8/example_outputs/output_image.png b/opencv_face_detector_uint8/example_outputs/output_image.png
deleted file mode 100644
index 643238827b09ca7f4a270456bf9dd37407841501..0000000000000000000000000000000000000000
--- a/opencv_face_detector_uint8/example_outputs/output_image.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:15a6e1a27e04020e9cbce7a26e7c2d8752cc74157b179bfe3636825688c13d4e
-size 440053
diff --git a/opencv_face_detector_uint8/opencv_face_detector_uint8_2026jul.onnx b/opencv_face_detector_uint8/opencv_face_detector_uint8_2026jul.onnx
deleted file mode 100644
index 41a621f3887d48dc697004f78e890ec535e1be3b..0000000000000000000000000000000000000000
--- a/opencv_face_detector_uint8/opencv_face_detector_uint8_2026jul.onnx
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:f5b1efe9c4e792a010ac36248d92b64c3d94f9bdec764951d1e8684d919b1e40
-size 10671719
diff --git a/ssd_inception_v2_coco_2017_11_17/LICENSE b/ssd_inception_v2_coco_2017_11_17/LICENSE
deleted file mode 100644
index 12736ccd678d7be692590dcccf004a26233141df..0000000000000000000000000000000000000000
--- a/ssd_inception_v2_coco_2017_11_17/LICENSE
+++ /dev/null
@@ -1,212 +0,0 @@
-Copyright 2022 Google LLC. All rights reserved.
-
-All files in the following folders:
-/community
-/official
-/orbit
-/research
-/tensorflow_models
-
-Are licensed as follows:
-
- 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
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright 2016, The Authors.
-
- 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.
diff --git a/ssd_inception_v2_coco_2017_11_17/README.md b/ssd_inception_v2_coco_2017_11_17/README.md
deleted file mode 100644
index 0e43eccedb682379d87e60ca31281fdc32290363..0000000000000000000000000000000000000000
--- a/ssd_inception_v2_coco_2017_11_17/README.md
+++ /dev/null
@@ -1,48 +0,0 @@
-# SSD Inception v2 COCO
-
-Object detection with a Single Shot MultiBox Detector (SSD) built on an Inception v2 backbone,
-trained on the COCO dataset. The model was originally distributed as a frozen TensorFlow graph
-(`ssd_inception_v2_coco_2017_11_17.pb`) and converted to ONNX for use with OpenCV's DNN module.
-
-## Model Details
-- **Architecture**: SSD (Single Shot MultiBox Detector) with Inception v2 backbone
-- **Input**: RGB image, 300×300, raw uint8, NHWC layout (`image_tensor:0`, shape `[1, 300, 300, 3]`)
-- **Output**: `detection_boxes:0` (normalized `ymin, xmin, ymax, xmax`), `detection_scores:0`, `detection_classes:0` (COCO class ids), `num_detections:0`
-- **Framework**: ONNX (converted from the TensorFlow frozen graph via tf2onnx, opset 18)
-- **Original weights**: http://download.tensorflow.org/models/object_detection/ssd_inception_v2_coco_2017_11_17.tar.gz
-
-## Usage
-
-### Python
-```bash
-python demo.py --model ssd_inception_v2_coco_2017_11_17_2026jul.onnx --image example_outputs/input_image.png --output example_outputs/output_image.png --conf 0.3
-```
-
-### C++
-The C++ demo runs inference with OpenCV's DNN module. Adjust the OpenCV paths to your setup:
-```bash
-OCV=/path/to/opencv # OpenCV source tree
-OCVBUILD=/path/to/opencv/build # OpenCV build directory (generated headers + libs)
-g++ -std=c++17 demo.cpp -o demo \
- -I$OCV/include \
- -I$OCV/modules/core/include \
- -I$OCV/modules/dnn/include \
- -I$OCV/modules/imgproc/include \
- -I$OCV/modules/imgcodecs/include \
- -I$OCVBUILD \
- -L$OCVBUILD/lib -Wl,-rpath,$OCVBUILD/lib -lopencv_dnn -lopencv_imgcodecs -lopencv_imgproc -lopencv_core
-./demo --model ssd_inception_v2_coco_2017_11_17_2026jul.onnx --image example_outputs/input_image.png --output example_outputs/output_image.png
-```
-
-## Conversion
-The ONNX model was exported from the frozen TensorFlow graph with tf2onnx (opset 18)
-via [convert_to_onnx.py](./convert_to_onnx.py) — input `image_tensor:0`, outputs
-`detection_boxes:0`, `detection_scores:0`, `detection_classes:0`, `num_detections:0`.
-Requires `tensorflow`, `tf2onnx`, and `onnx`.
-
-```bash
-python convert_to_onnx.py --pb ../pb/ssd_inception_v2_coco_2017_11_17.pb
-```
-
-## License
-See [LICENSE](./LICENSE) — the model is released by the TensorFlow Authors under the Apache License 2.0.
diff --git a/ssd_inception_v2_coco_2017_11_17/convert_to_onnx.py b/ssd_inception_v2_coco_2017_11_17/convert_to_onnx.py
deleted file mode 100644
index b5ec338d32bf45c1f6b450ab4de7c16361843997..0000000000000000000000000000000000000000
--- a/ssd_inception_v2_coco_2017_11_17/convert_to_onnx.py
+++ /dev/null
@@ -1,40 +0,0 @@
-import argparse
-import datetime
-
-import onnx
-import tensorflow as tf
-import tf2onnx
-
-
-def load_graph_def(pb_path):
- with tf.io.gfile.GFile(pb_path, "rb") as f:
- graph_def = tf.compat.v1.GraphDef()
- graph_def.ParseFromString(f.read())
- return graph_def
-
-
-def main():
- parser = argparse.ArgumentParser(description="Export ssd_inception_v2_coco_2017_11_17.pb to ONNX")
- parser.add_argument("--pb", default="../pb/ssd_inception_v2_coco_2017_11_17.pb")
- parser.add_argument("--opset", type=int, default=18)
- args = parser.parse_args()
-
- graph_def = load_graph_def(args.pb)
-
- model_proto, _ = tf2onnx.convert.from_graph_def(
- graph_def,
- input_names=["image_tensor:0"],
- output_names=["detection_boxes:0", "detection_scores:0", "detection_classes:0", "num_detections:0"],
- opset=args.opset,
- )
- onnx.checker.check_model(model_proto)
-
- stamp = datetime.datetime.now().strftime("%Y%b").lower()
- onnx_path = "ssd_inception_v2_coco_2017_11_17_%s.onnx" % stamp
- with open(onnx_path, "wb") as f:
- f.write(model_proto.SerializeToString())
- print("wrote", onnx_path)
-
-
-if __name__ == "__main__":
- main()
diff --git a/ssd_inception_v2_coco_2017_11_17/demo.cpp b/ssd_inception_v2_coco_2017_11_17/demo.cpp
deleted file mode 100644
index 98bd1b422b005f9cc3eef3d9862b2fde46f3e412..0000000000000000000000000000000000000000
--- a/ssd_inception_v2_coco_2017_11_17/demo.cpp
+++ /dev/null
@@ -1,81 +0,0 @@
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-using namespace cv;
-
-static std::string argVal(int argc, char** argv, const std::string& key, const std::string& def)
-{
- for (int i = 1; i + 1 < argc; ++i)
- if (key == argv[i]) return argv[i + 1];
- return def;
-}
-
-int main(int argc, char** argv)
-{
- std::string model = argVal(argc, argv, "--model", "ssd_inception_v2_coco_2017_11_17_2026jul.onnx");
- std::string image = argVal(argc, argv, "--image", "example_outputs/input_image.png");
- std::string output = argVal(argc, argv, "--output", "example_outputs/output_image.png");
- float conf = std::stof(argVal(argc, argv, "--conf", "0.3"));
-
- Mat img = imread(image);
- if (img.empty())
- {
- std::cerr << "could not read image: " << image << std::endl;
- return 1;
- }
-
- Mat rgb;
- cvtColor(img, rgb, COLOR_BGR2RGB);
- resize(rgb, rgb, Size(300, 300));
- if (!rgb.isContinuous()) rgb = rgb.clone();
-
- int blobShape[] = {1, 300, 300, 3};
- Mat blob(4, blobShape, CV_8U, rgb.data);
- dnn::Net net = dnn::readNetFromONNX(model, dnn::ENGINE_ORT);
- net.setInput(blob);
- std::vector out_str = {"detection_boxes:0", "detection_scores:0", "detection_classes:0", "num_detections:0"};
- std::vector outs;
- net.forward(outs, out_str);
-
- const float *boxes = 0, *scores = 0, *classes = 0, *num = 0;
- for (size_t i = 0; i < out_str.size(); ++i)
- {
- const std::string& n = out_str[i];
- if (n.find("detection_boxes") != std::string::npos) boxes = (const float*)outs[i].data;
- else if (n.find("detection_scores") != std::string::npos) scores = (const float*)outs[i].data;
- else if (n.find("detection_classes") != std::string::npos) classes = (const float*)outs[i].data;
- else if (n.find("num_detections") != std::string::npos) num = (const float*)outs[i].data;
- }
- if (!boxes || !scores || !classes || !num)
- {
- std::cerr << "missing expected output tensors" << std::endl;
- return 1;
- }
-
- int nd = (int)num[0];
- int h = img.rows, w = img.cols;
- Mat out = img.clone();
- std::vector lines;
- for (int k = 0; k < nd; ++k)
- {
- if (scores[k] < conf) continue;
- float ymin = boxes[k * 4 + 0], xmin = boxes[k * 4 + 1];
- float ymax = boxes[k * 4 + 2], xmax = boxes[k * 4 + 3];
- int cls = (int)classes[k];
- rectangle(out, Point(int(xmin * w), int(ymin * h)), Point(int(xmax * w), int(ymax * h)), Scalar(0, 255, 0), 2);
- putText(out, format("%d:%.2f", cls, scores[k]), Point(int(xmin * w), int(ymin * h) - 5),
- FONT_HERSHEY_SIMPLEX, 0.5, Scalar(0, 255, 0), 1);
- lines.push_back(format("%d %.3f %.3f %.3f %.3f %.3f", cls, scores[k], xmin, ymin, xmax, ymax));
- }
-
- imwrite(output, out);
- std::cout << "ssd_inception_v2_coco_2017_11_17 " << lines.size() << " detections" << std::endl;
- for (const auto& l : lines) std::cout << l << std::endl;
- return 0;
-}
diff --git a/ssd_inception_v2_coco_2017_11_17/demo.py b/ssd_inception_v2_coco_2017_11_17/demo.py
deleted file mode 100644
index a8a42a785e5fd0c95e7c19dd726c1bf57432ec10..0000000000000000000000000000000000000000
--- a/ssd_inception_v2_coco_2017_11_17/demo.py
+++ /dev/null
@@ -1,52 +0,0 @@
-import argparse
-import glob
-import os
-
-import cv2 as cv
-import numpy as np
-
-here = os.path.dirname(os.path.abspath(__file__))
-
-
-def main():
- parser = argparse.ArgumentParser(description="SSD Inception v2 COCO (ONNX) object detection demo")
- parser.add_argument("--model", default=(glob.glob(os.path.join(here, "*.onnx")) or [""])[0])
- parser.add_argument("--image", default=os.path.join(here, "example_outputs", "input_image.png"))
- parser.add_argument("--output", default=os.path.join(here, "example_outputs", "output_image.png"))
- parser.add_argument("--conf", type=float, default=0.3)
- args = parser.parse_args()
-
- img = cv.imread(args.image)
- if img is None:
- raise SystemExit("could not read image: %s" % args.image)
-
- rgb = cv.resize(cv.cvtColor(img, cv.COLOR_BGR2RGB), (300, 300))
-
- net = cv.dnn.readNetFromONNX(args.model, cv.dnn.ENGINE_ORT)
- onames = ["detection_boxes:0", "detection_scores:0", "detection_classes:0", "num_detections:0"]
- net.setInput(rgb[None].astype(np.uint8))
- res = net.forward(onames)
- boxes = res[[i for i, n in enumerate(onames) if "detection_boxes" in n][0]].reshape(-1, 4)
- scores = res[[i for i, n in enumerate(onames) if "detection_scores" in n][0]].reshape(-1)
- classes = res[[i for i, n in enumerate(onames) if "detection_classes" in n][0]].reshape(-1)
- nd = int(res[[i for i, n in enumerate(onames) if "num_detections" in n][0]].reshape(-1)[0])
-
- h, w = img.shape[:2]
- out = img.copy()
- kept = []
- for k in range(nd):
- if scores[k] < args.conf:
- continue
- ymin, xmin, ymax, xmax = boxes[k]
- kept.append((int(classes[k]), float(scores[k]), float(xmin), float(ymin), float(xmax), float(ymax)))
- cv.rectangle(out, (int(xmin * w), int(ymin * h)), (int(xmax * w), int(ymax * h)), (0, 255, 0), 2)
- cv.putText(out, "%d:%.2f" % (int(classes[k]), scores[k]), (int(xmin * w), int(ymin * h) - 5), cv.FONT_HERSHEY_SIMPLEX, 0.5, (0, 255, 0), 1)
-
- cv.imwrite(args.output, out)
- print("ssd_inception_v2_coco_2017_11_17", len(kept), "detections")
- for c, s, xmin, ymin, xmax, ymax in kept:
- print(c, round(s, 3), round(xmin, 3), round(ymin, 3), round(xmax, 3), round(ymax, 3))
-
-
-if __name__ == "__main__":
- main()
diff --git a/ssd_inception_v2_coco_2017_11_17/example_outputs/input_image.png b/ssd_inception_v2_coco_2017_11_17/example_outputs/input_image.png
deleted file mode 100644
index d892556078d2c17296761359f03ac8dca9b1be26..0000000000000000000000000000000000000000
--- a/ssd_inception_v2_coco_2017_11_17/example_outputs/input_image.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:d711ef10627f93def79c0c6ec2d0fc3da06cbb7e426d81fd2782538c3c549f52
-size 508341
diff --git a/ssd_inception_v2_coco_2017_11_17/example_outputs/output_image.png b/ssd_inception_v2_coco_2017_11_17/example_outputs/output_image.png
deleted file mode 100644
index 707ecffb6fb96d56b33a52c11ac420dc840f3c96..0000000000000000000000000000000000000000
--- a/ssd_inception_v2_coco_2017_11_17/example_outputs/output_image.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:8051cbe576541917d5a68bbdb6d119c2cf26bdf84aab362b909d8d1a8f9ad6c5
-size 458314
diff --git a/ssd_inception_v2_coco_2017_11_17/ssd_inception_v2_coco_2017_11_17_2026jul.onnx b/ssd_inception_v2_coco_2017_11_17/ssd_inception_v2_coco_2017_11_17_2026jul.onnx
deleted file mode 100644
index f7084e0ab7ace44fd732f2205900d5f53fb26af5..0000000000000000000000000000000000000000
--- a/ssd_inception_v2_coco_2017_11_17/ssd_inception_v2_coco_2017_11_17_2026jul.onnx
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:5834f7214c7b9d80a9f708d23a3539d93e632fb346aeb5b1d013e63443354009
-size 102207336
diff --git a/ssd_mobilenet_v1_coco_2017_11_17/LICENSE b/ssd_mobilenet_v1_coco_2017_11_17/LICENSE
deleted file mode 100644
index d3da228420e973edaf4123d5eeb42210f4450b0c..0000000000000000000000000000000000000000
--- a/ssd_mobilenet_v1_coco_2017_11_17/LICENSE
+++ /dev/null
@@ -1,203 +0,0 @@
-Copyright 2015 The TensorFlow Authors. All rights reserved.
-
- 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
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright 2015, The TensorFlow Authors.
-
- 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.
diff --git a/ssd_mobilenet_v1_coco_2017_11_17/README.md b/ssd_mobilenet_v1_coco_2017_11_17/README.md
deleted file mode 100644
index 572c44a69aa0cf547a7dbc1c579613b05d92b649..0000000000000000000000000000000000000000
--- a/ssd_mobilenet_v1_coco_2017_11_17/README.md
+++ /dev/null
@@ -1,48 +0,0 @@
-# SSD MobileNet v1 COCO
-
-Object detection with a Single Shot MultiBox Detector (SSD) built on a MobileNet v1 backbone,
-trained on the COCO dataset. The model was originally distributed as a frozen TensorFlow graph
-(`ssd_mobilenet_v1_coco_2017_11_17.pb`) and converted to ONNX for use with OpenCV's DNN module.
-
-## Model Details
-- **Architecture**: SSD (Single Shot MultiBox Detector) with MobileNet v1 backbone
-- **Input**: RGB image, 300×300, raw uint8, NHWC layout (`image_tensor:0`, shape `[1, 300, 300, 3]`)
-- **Output**: `detection_boxes:0` (normalized `ymin, xmin, ymax, xmax`), `detection_scores:0`, `detection_classes:0` (COCO class ids), `num_detections:0`
-- **Framework**: ONNX (converted from the TensorFlow frozen graph via tf2onnx, opset 18)
-- **Original weights**: http://download.tensorflow.org/models/object_detection/ssd_mobilenet_v1_coco_2017_11_17.tar.gz
-
-## Usage
-
-### Python
-```bash
-python demo.py --model ssd_mobilenet_v1_coco_2017_11_17_2026jul.onnx --image example_outputs/input_image.png --output example_outputs/output_image.png --conf 0.3
-```
-
-### C++
-The C++ demo runs inference with OpenCV's DNN module. Adjust the OpenCV paths to your setup:
-```bash
-OCV=/path/to/opencv # OpenCV source tree
-OCVBUILD=/path/to/opencv/build # OpenCV build directory (generated headers + libs)
-g++ -std=c++17 demo.cpp -o demo \
- -I$OCV/include \
- -I$OCV/modules/core/include \
- -I$OCV/modules/dnn/include \
- -I$OCV/modules/imgproc/include \
- -I$OCV/modules/imgcodecs/include \
- -I$OCVBUILD \
- -L$OCVBUILD/lib -Wl,-rpath,$OCVBUILD/lib -lopencv_dnn -lopencv_imgcodecs -lopencv_imgproc -lopencv_core
-./demo --model ssd_mobilenet_v1_coco_2017_11_17_2026jul.onnx --image example_outputs/input_image.png --output example_outputs/output_image.png
-```
-
-## Conversion
-The ONNX model was exported from the frozen TensorFlow graph with tf2onnx (opset 18)
-via [convert_to_onnx.py](./convert_to_onnx.py) — input `image_tensor:0`, outputs
-`detection_boxes:0`, `detection_scores:0`, `detection_classes:0`, `num_detections:0`.
-Requires `tensorflow`, `tf2onnx`, and `onnx`.
-
-```bash
-python convert_to_onnx.py --pb ../pb/ssd_mobilenet_v1_coco_2017_11_17.pb
-```
-
-## License
-See [LICENSE](./LICENSE) — the model is released by the TensorFlow Authors under the Apache License 2.0.
diff --git a/ssd_mobilenet_v1_coco_2017_11_17/convert_to_onnx.py b/ssd_mobilenet_v1_coco_2017_11_17/convert_to_onnx.py
deleted file mode 100644
index 6765d74a97174f65c9701b5855499020e5761513..0000000000000000000000000000000000000000
--- a/ssd_mobilenet_v1_coco_2017_11_17/convert_to_onnx.py
+++ /dev/null
@@ -1,40 +0,0 @@
-import argparse
-import datetime
-
-import onnx
-import tensorflow as tf
-import tf2onnx
-
-
-def load_graph_def(pb_path):
- with tf.io.gfile.GFile(pb_path, "rb") as f:
- graph_def = tf.compat.v1.GraphDef()
- graph_def.ParseFromString(f.read())
- return graph_def
-
-
-def main():
- parser = argparse.ArgumentParser(description="Export ssd_mobilenet_v1_coco_2017_11_17.pb to ONNX")
- parser.add_argument("--pb", default="../pb/ssd_mobilenet_v1_coco_2017_11_17.pb")
- parser.add_argument("--opset", type=int, default=18)
- args = parser.parse_args()
-
- graph_def = load_graph_def(args.pb)
-
- model_proto, _ = tf2onnx.convert.from_graph_def(
- graph_def,
- input_names=["image_tensor:0"],
- output_names=["detection_boxes:0", "detection_scores:0", "detection_classes:0", "num_detections:0"],
- opset=args.opset,
- )
- onnx.checker.check_model(model_proto)
-
- stamp = datetime.datetime.now().strftime("%Y%b").lower()
- onnx_path = "ssd_mobilenet_v1_coco_2017_11_17_%s.onnx" % stamp
- with open(onnx_path, "wb") as f:
- f.write(model_proto.SerializeToString())
- print("wrote", onnx_path)
-
-
-if __name__ == "__main__":
- main()
diff --git a/ssd_mobilenet_v1_coco_2017_11_17/demo.cpp b/ssd_mobilenet_v1_coco_2017_11_17/demo.cpp
deleted file mode 100644
index 5fc21ac9ee788bf774b3a81f0321b1828954722e..0000000000000000000000000000000000000000
--- a/ssd_mobilenet_v1_coco_2017_11_17/demo.cpp
+++ /dev/null
@@ -1,81 +0,0 @@
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-using namespace cv;
-
-static std::string argVal(int argc, char** argv, const std::string& key, const std::string& def)
-{
- for (int i = 1; i + 1 < argc; ++i)
- if (key == argv[i]) return argv[i + 1];
- return def;
-}
-
-int main(int argc, char** argv)
-{
- std::string model = argVal(argc, argv, "--model", "ssd_mobilenet_v1_coco_2017_11_17_2026jul.onnx");
- std::string image = argVal(argc, argv, "--image", "example_outputs/input_image.png");
- std::string output = argVal(argc, argv, "--output", "example_outputs/output_image.png");
- float conf = std::stof(argVal(argc, argv, "--conf", "0.3"));
-
- Mat img = imread(image);
- if (img.empty())
- {
- std::cerr << "could not read image: " << image << std::endl;
- return 1;
- }
-
- Mat rgb;
- cvtColor(img, rgb, COLOR_BGR2RGB);
- resize(rgb, rgb, Size(300, 300));
- if (!rgb.isContinuous()) rgb = rgb.clone();
-
- int blobShape[] = {1, 300, 300, 3};
- Mat blob(4, blobShape, CV_8U, rgb.data);
- dnn::Net net = dnn::readNetFromONNX(model, dnn::ENGINE_ORT);
- net.setInput(blob);
- std::vector out_str = {"detection_boxes:0", "detection_scores:0", "detection_classes:0", "num_detections:0"};
- std::vector outs;
- net.forward(outs, out_str);
-
- const float *boxes = 0, *scores = 0, *classes = 0, *num = 0;
- for (size_t i = 0; i < out_str.size(); ++i)
- {
- const std::string& n = out_str[i];
- if (n.find("detection_boxes") != std::string::npos) boxes = (const float*)outs[i].data;
- else if (n.find("detection_scores") != std::string::npos) scores = (const float*)outs[i].data;
- else if (n.find("detection_classes") != std::string::npos) classes = (const float*)outs[i].data;
- else if (n.find("num_detections") != std::string::npos) num = (const float*)outs[i].data;
- }
- if (!boxes || !scores || !classes || !num)
- {
- std::cerr << "missing expected output tensors" << std::endl;
- return 1;
- }
-
- int nd = (int)num[0];
- int h = img.rows, w = img.cols;
- Mat out = img.clone();
- std::vector lines;
- for (int k = 0; k < nd; ++k)
- {
- if (scores[k] < conf) continue;
- float ymin = boxes[k * 4 + 0], xmin = boxes[k * 4 + 1];
- float ymax = boxes[k * 4 + 2], xmax = boxes[k * 4 + 3];
- int cls = (int)classes[k];
- rectangle(out, Point(int(xmin * w), int(ymin * h)), Point(int(xmax * w), int(ymax * h)), Scalar(0, 255, 0), 2);
- putText(out, format("%d:%.2f", cls, scores[k]), Point(int(xmin * w), int(ymin * h) - 5),
- FONT_HERSHEY_SIMPLEX, 0.5, Scalar(0, 255, 0), 1);
- lines.push_back(format("%d %.3f %.3f %.3f %.3f %.3f", cls, scores[k], xmin, ymin, xmax, ymax));
- }
-
- imwrite(output, out);
- std::cout << "ssd_mobilenet_v1_coco_2017_11_17 " << lines.size() << " detections" << std::endl;
- for (const auto& l : lines) std::cout << l << std::endl;
- return 0;
-}
diff --git a/ssd_mobilenet_v1_coco_2017_11_17/demo.py b/ssd_mobilenet_v1_coco_2017_11_17/demo.py
deleted file mode 100644
index 76404b2b85ffc10db7b74837b1284e69dddabead..0000000000000000000000000000000000000000
--- a/ssd_mobilenet_v1_coco_2017_11_17/demo.py
+++ /dev/null
@@ -1,52 +0,0 @@
-import argparse
-import glob
-import os
-
-import cv2 as cv
-import numpy as np
-
-here = os.path.dirname(os.path.abspath(__file__))
-
-
-def main():
- parser = argparse.ArgumentParser(description="SSD MobileNet v1 COCO (ONNX) object detection demo")
- parser.add_argument("--model", default=(glob.glob(os.path.join(here, "*.onnx")) or [""])[0])
- parser.add_argument("--image", default=os.path.join(here, "example_outputs", "input_image.png"))
- parser.add_argument("--output", default=os.path.join(here, "example_outputs", "output_image.png"))
- parser.add_argument("--conf", type=float, default=0.3)
- args = parser.parse_args()
-
- img = cv.imread(args.image)
- if img is None:
- raise SystemExit("could not read image: %s" % args.image)
-
- rgb = cv.resize(cv.cvtColor(img, cv.COLOR_BGR2RGB), (300, 300))
-
- net = cv.dnn.readNetFromONNX(args.model, cv.dnn.ENGINE_ORT)
- onames = ["detection_boxes:0", "detection_scores:0", "detection_classes:0", "num_detections:0"]
- net.setInput(rgb[None].astype(np.uint8))
- res = net.forward(onames)
- boxes = res[[i for i, n in enumerate(onames) if "detection_boxes" in n][0]].reshape(-1, 4)
- scores = res[[i for i, n in enumerate(onames) if "detection_scores" in n][0]].reshape(-1)
- classes = res[[i for i, n in enumerate(onames) if "detection_classes" in n][0]].reshape(-1)
- nd = int(res[[i for i, n in enumerate(onames) if "num_detections" in n][0]].reshape(-1)[0])
-
- h, w = img.shape[:2]
- out = img.copy()
- kept = []
- for k in range(nd):
- if scores[k] < args.conf:
- continue
- ymin, xmin, ymax, xmax = boxes[k]
- kept.append((int(classes[k]), float(scores[k]), float(xmin), float(ymin), float(xmax), float(ymax)))
- cv.rectangle(out, (int(xmin * w), int(ymin * h)), (int(xmax * w), int(ymax * h)), (0, 255, 0), 2)
- cv.putText(out, "%d:%.2f" % (int(classes[k]), scores[k]), (int(xmin * w), int(ymin * h) - 5), cv.FONT_HERSHEY_SIMPLEX, 0.5, (0, 255, 0), 1)
-
- cv.imwrite(args.output, out)
- print("ssd_mobilenet_v1_coco_2017_11_17", len(kept), "detections")
- for c, s, xmin, ymin, xmax, ymax in kept:
- print(c, round(s, 3), round(xmin, 3), round(ymin, 3), round(xmax, 3), round(ymax, 3))
-
-
-if __name__ == "__main__":
- main()
diff --git a/ssd_mobilenet_v1_coco_2017_11_17/example_outputs/input_image.png b/ssd_mobilenet_v1_coco_2017_11_17/example_outputs/input_image.png
deleted file mode 100644
index 326ece9829794ab70eaf0b1e3feac0a762099689..0000000000000000000000000000000000000000
--- a/ssd_mobilenet_v1_coco_2017_11_17/example_outputs/input_image.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:61db162464c0770138c5136af0e999ce3b6556244cec257945427396480d9caf
-size 414310
diff --git a/ssd_mobilenet_v1_coco_2017_11_17/example_outputs/output_image.png b/ssd_mobilenet_v1_coco_2017_11_17/example_outputs/output_image.png
deleted file mode 100644
index f98c3ce4d3b5da2169e3ef420404ec36df82be7a..0000000000000000000000000000000000000000
--- a/ssd_mobilenet_v1_coco_2017_11_17/example_outputs/output_image.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:953b498fb864bd5a1bf7d9abc47dfb86f20aac0954d45b8b77ae5acf379fe23a
-size 328560
diff --git a/ssd_mobilenet_v1_coco_2017_11_17/ssd_mobilenet_v1_coco_2017_11_17_2026jul.onnx b/ssd_mobilenet_v1_coco_2017_11_17/ssd_mobilenet_v1_coco_2017_11_17_2026jul.onnx
deleted file mode 100644
index 35eefb06908cf91c302a78f5f14a13c502766929..0000000000000000000000000000000000000000
--- a/ssd_mobilenet_v1_coco_2017_11_17/ssd_mobilenet_v1_coco_2017_11_17_2026jul.onnx
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:7423295086c7ceaca3ccc0059c16989456a08c3e4b8c05e2cc415240f9148e65
-size 29289721
diff --git a/ssd_mobilenet_v1_ppn_coco/LICENSE b/ssd_mobilenet_v1_ppn_coco/LICENSE
deleted file mode 100644
index 4421e8e7b19941bd420a2723bb31d0abc15cd3d7..0000000000000000000000000000000000000000
--- a/ssd_mobilenet_v1_ppn_coco/LICENSE
+++ /dev/null
@@ -1,203 +0,0 @@
-Copyright 2015 The TensorFlow Authors. All rights reserved.
-
- 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
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright 2015, The TensorFlow Authors.
-
- 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.
\ No newline at end of file
diff --git a/ssd_mobilenet_v1_ppn_coco/README.md b/ssd_mobilenet_v1_ppn_coco/README.md
deleted file mode 100644
index a424ddd84ac5f2bc59784abbe81d5f18fe3c48ce..0000000000000000000000000000000000000000
--- a/ssd_mobilenet_v1_ppn_coco/README.md
+++ /dev/null
@@ -1,49 +0,0 @@
-# SSD MobileNet v1 PPN COCO
-
-Object detection with a Single Shot MultiBox Detector (SSD) built on a MobileNet v1 backbone with
-a shared box predictor (Pooling Pyramid Network, PPN), trained on the COCO dataset. The model was
-originally distributed as a frozen TensorFlow graph (`ssd_mobilenet_v1_ppn_coco.pb`) and converted
-to ONNX for use with OpenCV's DNN module.
-
-## Model Details
-- **Architecture**: SSD (Single Shot MultiBox Detector) with MobileNet v1 backbone and shared box predictor (Pooling Pyramid Network, PPN)
-- **Input**: RGB image, 300×300, raw uint8, NHWC layout (`image_tensor:0`, shape `[1, 300, 300, 3]`)
-- **Output**: `detection_boxes:0` (normalized `ymin, xmin, ymax, xmax`), `detection_scores:0`, `detection_classes:0` (COCO class ids), `num_detections:0`
-- **Framework**: ONNX (converted from the TensorFlow frozen graph via tf2onnx, opset 18)
-- **Original weights**: http://download.tensorflow.org/models/object_detection/ssd_mobilenet_v1_ppn_shared_box_predictor_300x300_coco14_sync_2018_07_03.tar.gz
-
-## Usage
-
-### Python
-```bash
-python demo.py --model ssd_mobilenet_v1_ppn_coco_2026jul.onnx --image example_outputs/input_image.png --output example_outputs/output_image.png --conf 0.3
-```
-
-### C++
-The C++ demo runs inference with OpenCV's DNN module. Adjust the OpenCV paths to your setup:
-```bash
-OCV=/path/to/opencv # OpenCV source tree
-OCVBUILD=/path/to/opencv/build # OpenCV build directory (generated headers + libs)
-g++ -std=c++17 demo.cpp -o demo \
- -I$OCV/include \
- -I$OCV/modules/core/include \
- -I$OCV/modules/dnn/include \
- -I$OCV/modules/imgproc/include \
- -I$OCV/modules/imgcodecs/include \
- -I$OCVBUILD \
- -L$OCVBUILD/lib -Wl,-rpath,$OCVBUILD/lib -lopencv_dnn -lopencv_imgcodecs -lopencv_imgproc -lopencv_core
-./demo --model ssd_mobilenet_v1_ppn_coco_2026jul.onnx --image example_outputs/input_image.png --output example_outputs/output_image.png
-```
-
-## Conversion
-The ONNX model was exported from the frozen TensorFlow graph with tf2onnx (opset 18)
-via [convert_to_onnx.py](./convert_to_onnx.py) — input `image_tensor:0`, outputs
-`detection_boxes:0`, `detection_scores:0`, `detection_classes:0`, `num_detections:0`.
-Requires `tensorflow`, `tf2onnx`, and `onnx`.
-
-```bash
-python convert_to_onnx.py --pb ../pb/ssd_mobilenet_v1_ppn_coco.pb
-```
-
-## License
-See [LICENSE](./LICENSE) — the model is released by the TensorFlow Authors under the Apache License 2.0.
diff --git a/ssd_mobilenet_v1_ppn_coco/convert_to_onnx.py b/ssd_mobilenet_v1_ppn_coco/convert_to_onnx.py
deleted file mode 100644
index db8fd7d76150e97606f9e0427f268dbb2657d93a..0000000000000000000000000000000000000000
--- a/ssd_mobilenet_v1_ppn_coco/convert_to_onnx.py
+++ /dev/null
@@ -1,40 +0,0 @@
-import argparse
-import datetime
-
-import onnx
-import tensorflow as tf
-import tf2onnx
-
-
-def load_graph_def(pb_path):
- with tf.io.gfile.GFile(pb_path, "rb") as f:
- graph_def = tf.compat.v1.GraphDef()
- graph_def.ParseFromString(f.read())
- return graph_def
-
-
-def main():
- parser = argparse.ArgumentParser(description="Export ssd_mobilenet_v1_ppn_coco.pb to ONNX")
- parser.add_argument("--pb", default="../pb/ssd_mobilenet_v1_ppn_coco.pb")
- parser.add_argument("--opset", type=int, default=18)
- args = parser.parse_args()
-
- graph_def = load_graph_def(args.pb)
-
- model_proto, _ = tf2onnx.convert.from_graph_def(
- graph_def,
- input_names=["image_tensor:0"],
- output_names=["detection_boxes:0", "detection_scores:0", "detection_classes:0", "num_detections:0"],
- opset=args.opset,
- )
- onnx.checker.check_model(model_proto)
-
- stamp = datetime.datetime.now().strftime("%Y%b").lower()
- onnx_path = "ssd_mobilenet_v1_ppn_coco_%s.onnx" % stamp
- with open(onnx_path, "wb") as f:
- f.write(model_proto.SerializeToString())
- print("wrote", onnx_path)
-
-
-if __name__ == "__main__":
- main()
diff --git a/ssd_mobilenet_v1_ppn_coco/demo.cpp b/ssd_mobilenet_v1_ppn_coco/demo.cpp
deleted file mode 100644
index cd19390c22bdaf741aeaa6fb3726d6f80cc4ee43..0000000000000000000000000000000000000000
--- a/ssd_mobilenet_v1_ppn_coco/demo.cpp
+++ /dev/null
@@ -1,81 +0,0 @@
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-using namespace cv;
-
-static std::string argVal(int argc, char** argv, const std::string& key, const std::string& def)
-{
- for (int i = 1; i + 1 < argc; ++i)
- if (key == argv[i]) return argv[i + 1];
- return def;
-}
-
-int main(int argc, char** argv)
-{
- std::string model = argVal(argc, argv, "--model", "ssd_mobilenet_v1_ppn_coco_2026jul.onnx");
- std::string image = argVal(argc, argv, "--image", "example_outputs/input_image.png");
- std::string output = argVal(argc, argv, "--output", "example_outputs/output_image.png");
- float conf = std::stof(argVal(argc, argv, "--conf", "0.3"));
-
- Mat img = imread(image);
- if (img.empty())
- {
- std::cerr << "could not read image: " << image << std::endl;
- return 1;
- }
-
- Mat rgb;
- cvtColor(img, rgb, COLOR_BGR2RGB);
- resize(rgb, rgb, Size(300, 300));
- if (!rgb.isContinuous()) rgb = rgb.clone();
-
- int blobShape[] = {1, 300, 300, 3};
- Mat blob(4, blobShape, CV_8U, rgb.data);
- dnn::Net net = dnn::readNetFromONNX(model, dnn::ENGINE_ORT);
- net.setInput(blob);
- std::vector out_str = {"detection_boxes:0", "detection_scores:0", "detection_classes:0", "num_detections:0"};
- std::vector outs;
- net.forward(outs, out_str);
-
- const float *boxes = 0, *scores = 0, *classes = 0, *num = 0;
- for (size_t i = 0; i < out_str.size(); ++i)
- {
- const std::string& n = out_str[i];
- if (n.find("detection_boxes") != std::string::npos) boxes = (const float*)outs[i].data;
- else if (n.find("detection_scores") != std::string::npos) scores = (const float*)outs[i].data;
- else if (n.find("detection_classes") != std::string::npos) classes = (const float*)outs[i].data;
- else if (n.find("num_detections") != std::string::npos) num = (const float*)outs[i].data;
- }
- if (!boxes || !scores || !classes || !num)
- {
- std::cerr << "missing expected output tensors" << std::endl;
- return 1;
- }
-
- int nd = (int)num[0];
- int h = img.rows, w = img.cols;
- Mat out = img.clone();
- std::vector lines;
- for (int k = 0; k < nd; ++k)
- {
- if (scores[k] < conf) continue;
- float ymin = boxes[k * 4 + 0], xmin = boxes[k * 4 + 1];
- float ymax = boxes[k * 4 + 2], xmax = boxes[k * 4 + 3];
- int cls = (int)classes[k];
- rectangle(out, Point(int(xmin * w), int(ymin * h)), Point(int(xmax * w), int(ymax * h)), Scalar(0, 255, 0), 2);
- putText(out, format("%d:%.2f", cls, scores[k]), Point(int(xmin * w), int(ymin * h) - 5),
- FONT_HERSHEY_SIMPLEX, 0.5, Scalar(0, 255, 0), 1);
- lines.push_back(format("%d %.3f %.3f %.3f %.3f %.3f", cls, scores[k], xmin, ymin, xmax, ymax));
- }
-
- imwrite(output, out);
- std::cout << "ssd_mobilenet_v1_ppn_coco " << lines.size() << " detections" << std::endl;
- for (const auto& l : lines) std::cout << l << std::endl;
- return 0;
-}
diff --git a/ssd_mobilenet_v1_ppn_coco/demo.py b/ssd_mobilenet_v1_ppn_coco/demo.py
deleted file mode 100644
index 9ba70bac6336c34dc9da0416ef8d7c01b7bcacfd..0000000000000000000000000000000000000000
--- a/ssd_mobilenet_v1_ppn_coco/demo.py
+++ /dev/null
@@ -1,52 +0,0 @@
-import argparse
-import glob
-import os
-
-import cv2 as cv
-import numpy as np
-
-here = os.path.dirname(os.path.abspath(__file__))
-
-
-def main():
- parser = argparse.ArgumentParser(description="SSD MobileNet v1 PPN COCO (ONNX) object detection demo")
- parser.add_argument("--model", default=(glob.glob(os.path.join(here, "*.onnx")) or [""])[0])
- parser.add_argument("--image", default=os.path.join(here, "example_outputs", "input_image.png"))
- parser.add_argument("--output", default=os.path.join(here, "example_outputs", "output_image.png"))
- parser.add_argument("--conf", type=float, default=0.3)
- args = parser.parse_args()
-
- img = cv.imread(args.image)
- if img is None:
- raise SystemExit("could not read image: %s" % args.image)
-
- rgb = cv.resize(cv.cvtColor(img, cv.COLOR_BGR2RGB), (300, 300))
-
- net = cv.dnn.readNetFromONNX(args.model, cv.dnn.ENGINE_ORT)
- onames = ["detection_boxes:0", "detection_scores:0", "detection_classes:0", "num_detections:0"]
- net.setInput(rgb[None].astype(np.uint8))
- res = net.forward(onames)
- boxes = res[[i for i, n in enumerate(onames) if "detection_boxes" in n][0]].reshape(-1, 4)
- scores = res[[i for i, n in enumerate(onames) if "detection_scores" in n][0]].reshape(-1)
- classes = res[[i for i, n in enumerate(onames) if "detection_classes" in n][0]].reshape(-1)
- nd = int(res[[i for i, n in enumerate(onames) if "num_detections" in n][0]].reshape(-1)[0])
-
- h, w = img.shape[:2]
- out = img.copy()
- kept = []
- for k in range(nd):
- if scores[k] < args.conf:
- continue
- ymin, xmin, ymax, xmax = boxes[k]
- kept.append((int(classes[k]), float(scores[k]), float(xmin), float(ymin), float(xmax), float(ymax)))
- cv.rectangle(out, (int(xmin * w), int(ymin * h)), (int(xmax * w), int(ymax * h)), (0, 255, 0), 2)
- cv.putText(out, "%d:%.2f" % (int(classes[k]), scores[k]), (int(xmin * w), int(ymin * h) - 5), cv.FONT_HERSHEY_SIMPLEX, 0.5, (0, 255, 0), 1)
-
- cv.imwrite(args.output, out)
- print("ssd_mobilenet_v1_ppn_coco", len(kept), "detections")
- for c, s, xmin, ymin, xmax, ymax in kept:
- print(c, round(s, 3), round(xmin, 3), round(ymin, 3), round(xmax, 3), round(ymax, 3))
-
-
-if __name__ == "__main__":
- main()
diff --git a/ssd_mobilenet_v1_ppn_coco/example_outputs/input_image.png b/ssd_mobilenet_v1_ppn_coco/example_outputs/input_image.png
deleted file mode 100644
index 326ece9829794ab70eaf0b1e3feac0a762099689..0000000000000000000000000000000000000000
--- a/ssd_mobilenet_v1_ppn_coco/example_outputs/input_image.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:61db162464c0770138c5136af0e999ce3b6556244cec257945427396480d9caf
-size 414310
diff --git a/ssd_mobilenet_v1_ppn_coco/example_outputs/output_image.png b/ssd_mobilenet_v1_ppn_coco/example_outputs/output_image.png
deleted file mode 100644
index ba2c544e3fe221f6edea733740d5345834472211..0000000000000000000000000000000000000000
--- a/ssd_mobilenet_v1_ppn_coco/example_outputs/output_image.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:6b8c5b52639d95705ca0203fe15fc8a9257d5c88f632737a93edb55ce63ef3ad
-size 324473
diff --git a/ssd_mobilenet_v1_ppn_coco/ssd_mobilenet_v1_ppn_coco_2026jul.onnx b/ssd_mobilenet_v1_ppn_coco/ssd_mobilenet_v1_ppn_coco_2026jul.onnx
deleted file mode 100644
index 901aa6759ef40db253b5c0d818c90e41d51c64d2..0000000000000000000000000000000000000000
--- a/ssd_mobilenet_v1_ppn_coco/ssd_mobilenet_v1_ppn_coco_2026jul.onnx
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:f1b6be9dc0aca33aa1f78d34f2b32fe23097325f1482a837cfc4fc8aa62425ca
-size 16189990
diff --git a/ssd_mobilenet_v2_coco_2018_03_29/LICENSE b/ssd_mobilenet_v2_coco_2018_03_29/LICENSE
deleted file mode 100644
index 12736ccd678d7be692590dcccf004a26233141df..0000000000000000000000000000000000000000
--- a/ssd_mobilenet_v2_coco_2018_03_29/LICENSE
+++ /dev/null
@@ -1,212 +0,0 @@
-Copyright 2022 Google LLC. All rights reserved.
-
-All files in the following folders:
-/community
-/official
-/orbit
-/research
-/tensorflow_models
-
-Are licensed as follows:
-
- 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
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright 2016, The Authors.
-
- 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.
diff --git a/ssd_mobilenet_v2_coco_2018_03_29/README.md b/ssd_mobilenet_v2_coco_2018_03_29/README.md
deleted file mode 100644
index 5ca8176a2647c8a5737af83ee007770689eef627..0000000000000000000000000000000000000000
--- a/ssd_mobilenet_v2_coco_2018_03_29/README.md
+++ /dev/null
@@ -1,48 +0,0 @@
-# SSD MobileNet v2 COCO
-
-Object detection with a Single Shot MultiBox Detector (SSD) built on a MobileNet v2 backbone,
-trained on the COCO dataset. The model was originally distributed as a frozen TensorFlow graph
-(`ssd_mobilenet_v2_coco_2018_03_29.pb`) and converted to ONNX for use with OpenCV's DNN module.
-
-## Model Details
-- **Architecture**: SSD (Single Shot MultiBox Detector) with MobileNet v2 backbone
-- **Input**: RGB image, 300×300, raw uint8, NHWC layout (`image_tensor:0`, shape `[1, 300, 300, 3]`)
-- **Output**: `detection_boxes:0` (normalized `ymin, xmin, ymax, xmax`), `detection_scores:0`, `detection_classes:0` (COCO class ids), `num_detections:0`
-- **Framework**: ONNX (converted from the TensorFlow frozen graph via tf2onnx, opset 18)
-- **Original weights**: http://download.tensorflow.org/models/object_detection/ssd_mobilenet_v2_coco_2018_03_29.tar.gz
-
-## Usage
-
-### Python
-```bash
-python demo.py --model ssd_mobilenet_v2_coco_2018_03_29_2026jul.onnx --image example_outputs/input_image.png --output example_outputs/output_image.png --conf 0.3
-```
-
-### C++
-The C++ demo runs inference with OpenCV's DNN module. Adjust the OpenCV paths to your setup:
-```bash
-OCV=/path/to/opencv # OpenCV source tree
-OCVBUILD=/path/to/opencv/build # OpenCV build directory (generated headers + libs)
-g++ -std=c++17 demo.cpp -o demo \
- -I$OCV/include \
- -I$OCV/modules/core/include \
- -I$OCV/modules/dnn/include \
- -I$OCV/modules/imgproc/include \
- -I$OCV/modules/imgcodecs/include \
- -I$OCVBUILD \
- -L$OCVBUILD/lib -Wl,-rpath,$OCVBUILD/lib -lopencv_dnn -lopencv_imgcodecs -lopencv_imgproc -lopencv_core
-./demo --model ssd_mobilenet_v2_coco_2018_03_29_2026jul.onnx --image example_outputs/input_image.png --output example_outputs/output_image.png
-```
-
-## Conversion
-The ONNX model was exported from the frozen TensorFlow graph with tf2onnx (opset 18)
-via [convert_to_onnx.py](./convert_to_onnx.py) — input `image_tensor:0`, outputs
-`detection_boxes:0`, `detection_scores:0`, `detection_classes:0`, `num_detections:0`.
-Requires `tensorflow`, `tf2onnx`, and `onnx`.
-
-```bash
-python convert_to_onnx.py --pb ../pb/ssd_mobilenet_v2_coco_2018_03_29.pb
-```
-
-## License
-See [LICENSE](./LICENSE) — the model is released by the TensorFlow Authors under the Apache License 2.0.
diff --git a/ssd_mobilenet_v2_coco_2018_03_29/convert_to_onnx.py b/ssd_mobilenet_v2_coco_2018_03_29/convert_to_onnx.py
deleted file mode 100644
index 80b9b8bb5223fc54de124a02b7c4d852b566ba14..0000000000000000000000000000000000000000
--- a/ssd_mobilenet_v2_coco_2018_03_29/convert_to_onnx.py
+++ /dev/null
@@ -1,40 +0,0 @@
-import argparse
-import datetime
-
-import onnx
-import tensorflow as tf
-import tf2onnx
-
-
-def load_graph_def(pb_path):
- with tf.io.gfile.GFile(pb_path, "rb") as f:
- graph_def = tf.compat.v1.GraphDef()
- graph_def.ParseFromString(f.read())
- return graph_def
-
-
-def main():
- parser = argparse.ArgumentParser(description="Export ssd_mobilenet_v2_coco_2018_03_29.pb to ONNX")
- parser.add_argument("--pb", default="../pb/ssd_mobilenet_v2_coco_2018_03_29.pb")
- parser.add_argument("--opset", type=int, default=18)
- args = parser.parse_args()
-
- graph_def = load_graph_def(args.pb)
-
- model_proto, _ = tf2onnx.convert.from_graph_def(
- graph_def,
- input_names=["image_tensor:0"],
- output_names=["detection_boxes:0", "detection_scores:0", "detection_classes:0", "num_detections:0"],
- opset=args.opset,
- )
- onnx.checker.check_model(model_proto)
-
- stamp = datetime.datetime.now().strftime("%Y%b").lower()
- onnx_path = "ssd_mobilenet_v2_coco_2018_03_29_%s.onnx" % stamp
- with open(onnx_path, "wb") as f:
- f.write(model_proto.SerializeToString())
- print("wrote", onnx_path)
-
-
-if __name__ == "__main__":
- main()
diff --git a/ssd_mobilenet_v2_coco_2018_03_29/demo.cpp b/ssd_mobilenet_v2_coco_2018_03_29/demo.cpp
deleted file mode 100644
index 3fcfa482c48b0fafbeab20e33b7fd43894d14530..0000000000000000000000000000000000000000
--- a/ssd_mobilenet_v2_coco_2018_03_29/demo.cpp
+++ /dev/null
@@ -1,81 +0,0 @@
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-using namespace cv;
-
-static std::string argVal(int argc, char** argv, const std::string& key, const std::string& def)
-{
- for (int i = 1; i + 1 < argc; ++i)
- if (key == argv[i]) return argv[i + 1];
- return def;
-}
-
-int main(int argc, char** argv)
-{
- std::string model = argVal(argc, argv, "--model", "ssd_mobilenet_v2_coco_2018_03_29_2026jul.onnx");
- std::string image = argVal(argc, argv, "--image", "example_outputs/input_image.png");
- std::string output = argVal(argc, argv, "--output", "example_outputs/output_image.png");
- float conf = std::stof(argVal(argc, argv, "--conf", "0.3"));
-
- Mat img = imread(image);
- if (img.empty())
- {
- std::cerr << "could not read image: " << image << std::endl;
- return 1;
- }
-
- Mat rgb;
- cvtColor(img, rgb, COLOR_BGR2RGB);
- resize(rgb, rgb, Size(300, 300));
- if (!rgb.isContinuous()) rgb = rgb.clone();
-
- int blobShape[] = {1, 300, 300, 3};
- Mat blob(4, blobShape, CV_8U, rgb.data);
- dnn::Net net = dnn::readNetFromONNX(model, dnn::ENGINE_ORT);
- net.setInput(blob);
- std::vector out_str = {"detection_boxes:0", "detection_scores:0", "detection_classes:0", "num_detections:0"};
- std::vector outs;
- net.forward(outs, out_str);
-
- const float *boxes = 0, *scores = 0, *classes = 0, *num = 0;
- for (size_t i = 0; i < out_str.size(); ++i)
- {
- const std::string& n = out_str[i];
- if (n.find("detection_boxes") != std::string::npos) boxes = (const float*)outs[i].data;
- else if (n.find("detection_scores") != std::string::npos) scores = (const float*)outs[i].data;
- else if (n.find("detection_classes") != std::string::npos) classes = (const float*)outs[i].data;
- else if (n.find("num_detections") != std::string::npos) num = (const float*)outs[i].data;
- }
- if (!boxes || !scores || !classes || !num)
- {
- std::cerr << "missing expected output tensors" << std::endl;
- return 1;
- }
-
- int nd = (int)num[0];
- int h = img.rows, w = img.cols;
- Mat out = img.clone();
- std::vector lines;
- for (int k = 0; k < nd; ++k)
- {
- if (scores[k] < conf) continue;
- float ymin = boxes[k * 4 + 0], xmin = boxes[k * 4 + 1];
- float ymax = boxes[k * 4 + 2], xmax = boxes[k * 4 + 3];
- int cls = (int)classes[k];
- rectangle(out, Point(int(xmin * w), int(ymin * h)), Point(int(xmax * w), int(ymax * h)), Scalar(0, 255, 0), 2);
- putText(out, format("%d:%.2f", cls, scores[k]), Point(int(xmin * w), int(ymin * h) - 5),
- FONT_HERSHEY_SIMPLEX, 0.5, Scalar(0, 255, 0), 1);
- lines.push_back(format("%d %.3f %.3f %.3f %.3f %.3f", cls, scores[k], xmin, ymin, xmax, ymax));
- }
-
- imwrite(output, out);
- std::cout << "ssd_mobilenet_v2_coco_2018_03_29 " << lines.size() << " detections" << std::endl;
- for (const auto& l : lines) std::cout << l << std::endl;
- return 0;
-}
diff --git a/ssd_mobilenet_v2_coco_2018_03_29/demo.py b/ssd_mobilenet_v2_coco_2018_03_29/demo.py
deleted file mode 100644
index 973e1e38c5b722bc30b52815d252bfd28a97dd9a..0000000000000000000000000000000000000000
--- a/ssd_mobilenet_v2_coco_2018_03_29/demo.py
+++ /dev/null
@@ -1,52 +0,0 @@
-import argparse
-import glob
-import os
-
-import cv2 as cv
-import numpy as np
-
-here = os.path.dirname(os.path.abspath(__file__))
-
-
-def main():
- parser = argparse.ArgumentParser(description="SSD MobileNet v2 COCO (ONNX) object detection demo")
- parser.add_argument("--model", default=(glob.glob(os.path.join(here, "*.onnx")) or [""])[0])
- parser.add_argument("--image", default=os.path.join(here, "example_outputs", "input_image.png"))
- parser.add_argument("--output", default=os.path.join(here, "example_outputs", "output_image.png"))
- parser.add_argument("--conf", type=float, default=0.3)
- args = parser.parse_args()
-
- img = cv.imread(args.image)
- if img is None:
- raise SystemExit("could not read image: %s" % args.image)
-
- rgb = cv.resize(cv.cvtColor(img, cv.COLOR_BGR2RGB), (300, 300))
-
- net = cv.dnn.readNetFromONNX(args.model, cv.dnn.ENGINE_ORT)
- onames = ["detection_boxes:0", "detection_scores:0", "detection_classes:0", "num_detections:0"]
- net.setInput(rgb[None].astype(np.uint8))
- res = net.forward(onames)
- boxes = res[[i for i, n in enumerate(onames) if "detection_boxes" in n][0]].reshape(-1, 4)
- scores = res[[i for i, n in enumerate(onames) if "detection_scores" in n][0]].reshape(-1)
- classes = res[[i for i, n in enumerate(onames) if "detection_classes" in n][0]].reshape(-1)
- nd = int(res[[i for i, n in enumerate(onames) if "num_detections" in n][0]].reshape(-1)[0])
-
- h, w = img.shape[:2]
- out = img.copy()
- kept = []
- for k in range(nd):
- if scores[k] < args.conf:
- continue
- ymin, xmin, ymax, xmax = boxes[k]
- kept.append((int(classes[k]), float(scores[k]), float(xmin), float(ymin), float(xmax), float(ymax)))
- cv.rectangle(out, (int(xmin * w), int(ymin * h)), (int(xmax * w), int(ymax * h)), (0, 255, 0), 2)
- cv.putText(out, "%d:%.2f" % (int(classes[k]), scores[k]), (int(xmin * w), int(ymin * h) - 5), cv.FONT_HERSHEY_SIMPLEX, 0.5, (0, 255, 0), 1)
-
- cv.imwrite(args.output, out)
- print("ssd_mobilenet_v2_coco_2018_03_29", len(kept), "detections")
- for c, s, xmin, ymin, xmax, ymax in kept:
- print(c, round(s, 3), round(xmin, 3), round(ymin, 3), round(xmax, 3), round(ymax, 3))
-
-
-if __name__ == "__main__":
- main()
diff --git a/ssd_mobilenet_v2_coco_2018_03_29/example_outputs/input_image.png b/ssd_mobilenet_v2_coco_2018_03_29/example_outputs/input_image.png
deleted file mode 100644
index d892556078d2c17296761359f03ac8dca9b1be26..0000000000000000000000000000000000000000
--- a/ssd_mobilenet_v2_coco_2018_03_29/example_outputs/input_image.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:d711ef10627f93def79c0c6ec2d0fc3da06cbb7e426d81fd2782538c3c549f52
-size 508341
diff --git a/ssd_mobilenet_v2_coco_2018_03_29/example_outputs/output_image.png b/ssd_mobilenet_v2_coco_2018_03_29/example_outputs/output_image.png
deleted file mode 100644
index 47f0db9fe8b165d205bb4f534b419496d2e78bbd..0000000000000000000000000000000000000000
--- a/ssd_mobilenet_v2_coco_2018_03_29/example_outputs/output_image.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:85d11aee65d0e2c475c379eed94a08fd0b510c310c72b95e251fdd8ff16fe18f
-size 458003
diff --git a/ssd_mobilenet_v2_coco_2018_03_29/ssd_mobilenet_v2_coco_2018_03_29_2026jul.onnx b/ssd_mobilenet_v2_coco_2018_03_29/ssd_mobilenet_v2_coco_2018_03_29_2026jul.onnx
deleted file mode 100644
index 406163b37261dd00e8f6481ae326d4fdb18f9808..0000000000000000000000000000000000000000
--- a/ssd_mobilenet_v2_coco_2018_03_29/ssd_mobilenet_v2_coco_2018_03_29_2026jul.onnx
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:7ba2fdaa87b8cbbb52c16b5c6e31a7452c00e8ad68aec580bfb7b07f5b212619
-size 69584537
diff --git a/tensorflow_inception_graph/LICENSE b/tensorflow_inception_graph/LICENSE
deleted file mode 100644
index 4421e8e7b19941bd420a2723bb31d0abc15cd3d7..0000000000000000000000000000000000000000
--- a/tensorflow_inception_graph/LICENSE
+++ /dev/null
@@ -1,203 +0,0 @@
-Copyright 2015 The TensorFlow Authors. All rights reserved.
-
- 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
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright 2015, The TensorFlow Authors.
-
- 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.
\ No newline at end of file
diff --git a/tensorflow_inception_graph/README.md b/tensorflow_inception_graph/README.md
deleted file mode 100644
index 8f31e195e2e7b52c775980e2905c0b0278e4652e..0000000000000000000000000000000000000000
--- a/tensorflow_inception_graph/README.md
+++ /dev/null
@@ -1,56 +0,0 @@
-# TensorFlow Inception
-
-Image classification with the Inception v1 (GoogLeNet) network trained on ImageNet.
-The model was originally distributed as a frozen TensorFlow graph
-(`tensorflow_inception_graph.pb`) and converted to ONNX for use with OpenCV's DNN module.
-
-## Model Details
-- **Architecture**: Inception v1 / GoogLeNet
-- **Input**: RGB image, 224×224, raw 0–255 float, NHWC layout (`input:0`, shape `[1, 224, 224, 3]`)
-- **Output**: ImageNet class scores, softmax over 1008 classes (`softmax2:0`)
-- **Framework**: ONNX (converted from the TensorFlow frozen graph via tf2onnx, opset 18)
-- **Original weights**: https://github.com/petewarden/tf_ios_makefile_example/raw/master/data/tensorflow_inception_graph.pb
-
-## Usage
-
-### Python
-```bash
-python demo.py --model tensorflow_inception_graph_2026jul.onnx --image example_outputs/input_image.png --output example_outputs/output_image.png
-```
-
-Or import directly:
-```python
-import cv2
-
-net = cv2.dnn.readNet("tensorflow_inception_graph_2026jul.onnx")
-# see demo.py for the full inference pipeline
-```
-
-### C++
-The C++ demo runs inference with OpenCV's DNN module (default engine — no ONNX Runtime
-needed). Adjust the OpenCV paths to your setup:
-```bash
-OCV=/path/to/opencv # OpenCV source tree
-OCVBUILD=/path/to/opencv/build # OpenCV build directory (generated headers + libs)
-g++ -std=c++17 demo.cpp -o demo \
- -I$OCV/include \
- -I$OCV/modules/core/include \
- -I$OCV/modules/dnn/include \
- -I$OCV/modules/imgproc/include \
- -I$OCV/modules/imgcodecs/include \
- -I$OCVBUILD \
- -L$OCVBUILD/lib -Wl,-rpath,$OCVBUILD/lib -lopencv_dnn -lopencv_imgcodecs -lopencv_imgproc -lopencv_core
-./demo --model tensorflow_inception_graph_2026jul.onnx --image example_outputs/input_image.png
-```
-
-## Conversion
-The ONNX model was exported from the frozen TensorFlow graph with tf2onnx (opset 18)
-via [convert_to_onnx.py](./convert_to_onnx.py) — inputs `input:0`, outputs `softmax2:0`,
-input shape overridden to `[1, 224, 224, 3]`. Requires `tensorflow`, `tf2onnx`, and `onnx`.
-
-```bash
-python convert_to_onnx.py --pb ../pb/tensorflow_inception_graph.pb
-```
-
-## License
-See [LICENSE](./LICENSE) — the model is released by the TensorFlow Authors under the Apache License 2.0.
diff --git a/tensorflow_inception_graph/convert_to_onnx.py b/tensorflow_inception_graph/convert_to_onnx.py
deleted file mode 100644
index abb5ff4d8670994d7254629564e4647b625c32a3..0000000000000000000000000000000000000000
--- a/tensorflow_inception_graph/convert_to_onnx.py
+++ /dev/null
@@ -1,42 +0,0 @@
-import argparse
-import datetime
-
-import onnx
-import tensorflow as tf
-import tf2onnx
-
-
-def load_graph_def(pb_path):
- with tf.io.gfile.GFile(pb_path, "rb") as f:
- graph_def = tf.compat.v1.GraphDef()
- graph_def.ParseFromString(f.read())
- return graph_def
-
-
-def main():
- parser = argparse.ArgumentParser(description="Export tensorflow_inception_graph.pb to ONNX")
- parser.add_argument("--pb", default="../pb/tensorflow_inception_graph.pb")
- parser.add_argument("--opset", type=int, default=18)
- args = parser.parse_args()
-
- graph_def = load_graph_def(args.pb)
-
- model_proto, _ = tf2onnx.convert.from_graph_def(
- graph_def,
- input_names=["input:0"],
- output_names=["softmax2:0"],
- inputs_as_nchw=["input:0"],
- opset=args.opset,
- shape_override={"input:0": [1, 224, 224, 3]},
- )
- onnx.checker.check_model(model_proto)
-
- stamp = datetime.datetime.now().strftime("%Y%b").lower()
- onnx_path = "tensorflow_inception_graph_%s.onnx" % stamp
- with open(onnx_path, "wb") as f:
- f.write(model_proto.SerializeToString())
- print("wrote", onnx_path)
-
-
-if __name__ == "__main__":
- main()
diff --git a/tensorflow_inception_graph/demo.cpp b/tensorflow_inception_graph/demo.cpp
deleted file mode 100644
index a4567a6060f9c446fd9849d13c8dc0355ca6856f..0000000000000000000000000000000000000000
--- a/tensorflow_inception_graph/demo.cpp
+++ /dev/null
@@ -1,65 +0,0 @@
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-static std::string argVal(int argc, char** argv, const std::string& key, const std::string& def)
-{
- for (int i = 1; i + 1 < argc; ++i)
- if (key == argv[i]) return argv[i + 1];
- return def;
-}
-
-int main(int argc, char** argv)
-{
- std::string model = argVal(argc, argv, "--model", "tensorflow_inception_graph_2026jul.onnx");
- std::string image = argVal(argc, argv, "--image", "example_outputs/input_image.png");
- std::string output = argVal(argc, argv, "--output", "example_outputs/output_image.png");
- std::string labels = argVal(argc, argv, "--labels", "");
-
- cv::Mat img = cv::imread(image);
- if (img.empty())
- {
- std::cerr << "could not read image: " << image << std::endl;
- return 1;
- }
-
- cv::Mat rgb;
- cv::cvtColor(img, rgb, cv::COLOR_BGR2RGB);
- cv::resize(rgb, rgb, cv::Size(224, 224));
- rgb.convertTo(rgb, CV_32F);
- if (!rgb.isContinuous()) rgb = rgb.clone();
-
- int blobShape[] = {1, 224, 224, 3};
- cv::Mat blob(4, blobShape, CV_32F, rgb.data);
- cv::dnn::Net net = cv::dnn::readNetFromONNX(model);
- net.setInput(blob);
- cv::Mat scoresMat = net.forward();
- float* scores = (float*)scoresMat.data;
- int n = (int)scoresMat.total();
- int top = (int)(std::max_element(scores, scores + n) - scores);
- float conf = scores[top];
-
- std::string label = std::to_string(top);
- if (!labels.empty())
- {
- std::ifstream f(labels);
- std::vector names;
- std::string line;
- while (std::getline(f, line)) names.push_back(line);
- if (top < (int)names.size()) label = names[top];
- }
- std::cout << "class " << top << " " << label << " confidence " << conf << std::endl;
-
- cv::Mat out = img.clone();
- cv::putText(out, cv::format("%s (%.2f)", label.c_str(), conf), cv::Point(10, 30),
- cv::FONT_HERSHEY_SIMPLEX, 1.0, cv::Scalar(0, 255, 0), 2);
- cv::imwrite(output, out);
- std::cout << "wrote " << output << std::endl;
- return 0;
-}
diff --git a/tensorflow_inception_graph/demo.py b/tensorflow_inception_graph/demo.py
deleted file mode 100644
index 66afbfcdf6a8965d8fafa791cecad644d0672aa0..0000000000000000000000000000000000000000
--- a/tensorflow_inception_graph/demo.py
+++ /dev/null
@@ -1,45 +0,0 @@
-import argparse
-import os
-
-import cv2 as cv
-import numpy as np
-
-here = os.path.dirname(os.path.abspath(__file__))
-
-
-def main():
- parser = argparse.ArgumentParser(description="TensorFlow Inception (ONNX) image classification demo")
- parser.add_argument("--model", default=os.path.join(here, "tensorflow_inception_graph_2026jul.onnx"))
- parser.add_argument("--image", default=os.path.join(here, "example_outputs", "input_image.png"))
- parser.add_argument("--output", default=os.path.join(here, "example_outputs", "output_image.png"))
- parser.add_argument("--labels", help="optional ImageNet label file, one class name per line")
- args = parser.parse_args()
-
- img = cv.imread(args.image)
- if img is None:
- raise SystemExit("could not read image: %s" % args.image)
-
- rgb = cv.resize(cv.cvtColor(img, cv.COLOR_BGR2RGB), (224, 224)).astype(np.float32)
-
- net = cv.dnn.readNetFromONNX(args.model)
- net.setInput(rgb[None])
- scores = net.forward().ravel()
-
- top = int(np.argmax(scores))
- conf = float(scores[top])
- label = str(top)
- if args.labels:
- names = open(args.labels).read().splitlines()
- if top < len(names):
- label = names[top]
-
- print("class", top, label, "confidence", round(conf, 4))
-
- out = img.copy()
- cv.putText(out, "%s (%.2f)" % (label, conf), (10, 30), cv.FONT_HERSHEY_SIMPLEX, 1.0, (0, 255, 0), 2)
- cv.imwrite(args.output, out)
- print("wrote", args.output)
-
-
-if __name__ == "__main__":
- main()
diff --git a/tensorflow_inception_graph/example_outputs/input_image.png b/tensorflow_inception_graph/example_outputs/input_image.png
deleted file mode 100644
index 801b36179c90aa4c5c2328b16e8dc64b765693ff..0000000000000000000000000000000000000000
--- a/tensorflow_inception_graph/example_outputs/input_image.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:f9f5173e165918db972a36b61f73d9548f43a9859ebbcc4b5603c887f5bb6e44
-size 94297
diff --git a/tensorflow_inception_graph/example_outputs/output_image.png b/tensorflow_inception_graph/example_outputs/output_image.png
deleted file mode 100644
index b80e705f4c240de016dfb5c4c02fe8cd9148679c..0000000000000000000000000000000000000000
--- a/tensorflow_inception_graph/example_outputs/output_image.png
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:22a641062907e4da94ca04449ee6a36e0dc8ea5e70afed32b117e17bc5323a10
-size 110697
diff --git a/tensorflow_inception_graph/tensorflow_inception_graph_2026jul.onnx b/tensorflow_inception_graph/tensorflow_inception_graph_2026jul.onnx
deleted file mode 100644
index 7e10b10e91facaf6cc81def0c69fcf6e25a8cf73..0000000000000000000000000000000000000000
--- a/tensorflow_inception_graph/tensorflow_inception_graph_2026jul.onnx
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:829db6e4282ef0758fec4601e655505662083a45a252e2b36ab34194afcf078f
-size 28289737
diff --git a/yolo26n-seg/LICENSE b/yolo26n-seg/LICENSE
deleted file mode 100644
index be3f7b28e564e7dd05eaf59d64adba1a4065ac0e..0000000000000000000000000000000000000000
--- a/yolo26n-seg/LICENSE
+++ /dev/null
@@ -1,661 +0,0 @@
- GNU AFFERO GENERAL PUBLIC LICENSE
- Version 3, 19 November 2007
-
- Copyright (C) 2007 Free Software Foundation, Inc.
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
- Preamble
-
- The GNU Affero General Public License is a free, copyleft license for
-software and other kinds of works, specifically designed to ensure
-cooperation with the community in the case of network server software.
-
- The licenses for most software and other practical works are designed
-to take away your freedom to share and change the works. By contrast,
-our General Public Licenses are intended to guarantee your freedom to
-share and change all versions of a program--to make sure it remains free
-software for all its users.
-
- When we speak of free software, we are referring to freedom, not
-price. Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-them if you wish), that you receive source code or can get it if you
-want it, that you can change the software or use pieces of it in new
-free programs, and that you know you can do these things.
-
- Developers that use our General Public Licenses protect your rights
-with two steps: (1) assert copyright on the software, and (2) offer
-you this License which gives you legal permission to copy, distribute
-and/or modify the software.
-
- A secondary benefit of defending all users' freedom is that
-improvements made in alternate versions of the program, if they
-receive widespread use, become available for other developers to
-incorporate. Many developers of free software are heartened and
-encouraged by the resulting cooperation. However, in the case of
-software used on network servers, this result may fail to come about.
-The GNU General Public License permits making a modified version and
-letting the public access it on a server without ever releasing its
-source code to the public.
-
- The GNU Affero General Public License is designed specifically to
-ensure that, in such cases, the modified source code becomes available
-to the community. It requires the operator of a network server to
-provide the source code of the modified version running there to the
-users of that server. Therefore, public use of a modified version, on
-a publicly accessible server, gives the public access to the source
-code of the modified version.
-
- An older license, called the Affero General Public License and
-published by Affero, was designed to accomplish similar goals. This is
-a different license, not a version of the Affero GPL, but Affero has
-released a new version of the Affero GPL which permits relicensing under
-this license.
-
- The precise terms and conditions for copying, distribution and
-modification follow.
-
- TERMS AND CONDITIONS
-
- 0. Definitions.
-
- "This License" refers to version 3 of the GNU Affero General Public License.
-
- "Copyright" also means copyright-like laws that apply to other kinds of
-works, such as semiconductor masks.
-
- "The Program" refers to any copyrightable work licensed under this
-License. Each licensee is addressed as "you". "Licensees" and
-"recipients" may be individuals or organizations.
-
- To "modify" a work means to copy from or adapt all or part of the work
-in a fashion requiring copyright permission, other than the making of an
-exact copy. The resulting work is called a "modified version" of the
-earlier work or a work "based on" the earlier work.
-
- A "covered work" means either the unmodified Program or a work based
-on the Program.
-
- To "propagate" a work means to do anything with it that, without
-permission, would make you directly or secondarily liable for
-infringement under applicable copyright law, except executing it on a
-computer or modifying a private copy. Propagation includes copying,
-distribution (with or without modification), making available to the
-public, and in some countries other activities as well.
-
- To "convey" a work means any kind of propagation that enables other
-parties to make or receive copies. Mere interaction with a user through
-a computer network, with no transfer of a copy, is not conveying.
-
- An interactive user interface displays "Appropriate Legal Notices"
-to the extent that it includes a convenient and prominently visible
-feature that (1) displays an appropriate copyright notice, and (2)
-tells the user that there is no warranty for the work (except to the
-extent that warranties are provided), that licensees may convey the
-work under this License, and how to view a copy of this License. If
-the interface presents a list of user commands or options, such as a
-menu, a prominent item in the list meets this criterion.
-
- 1. Source Code.
-
- The "source code" for a work means the preferred form of the work
-for making modifications to it. "Object code" means any non-source
-form of a work.
-
- A "Standard Interface" means an interface that either is an official
-standard defined by a recognized standards body, or, in the case of
-interfaces specified for a particular programming language, one that
-is widely used among developers working in that language.
-
- The "System Libraries" of an executable work include anything, other
-than the work as a whole, that (a) is included in the normal form of
-packaging a Major Component, but which is not part of that Major
-Component, and (b) serves only to enable use of the work with that
-Major Component, or to implement a Standard Interface for which an
-implementation is available to the public in source code form. A
-"Major Component", in this context, means a major essential component
-(kernel, window system, and so on) of the specific operating system
-(if any) on which the executable work runs, or a compiler used to
-produce the work, or an object code interpreter used to run it.
-
- The "Corresponding Source" for a work in object code form means all
-the source code needed to generate, install, and (for an executable
-work) run the object code and to modify the work, including scripts to
-control those activities. However, it does not include the work's
-System Libraries, or general-purpose tools or generally available free
-programs which are used unmodified in performing those activities but
-which are not part of the work. For example, Corresponding Source
-includes interface definition files associated with source files for
-the work, and the source code for shared libraries and dynamically
-linked subprograms that the work is specifically designed to require,
-such as by intimate data communication or control flow between those
-subprograms and other parts of the work.
-
- The Corresponding Source need not include anything that users
-can regenerate automatically from other parts of the Corresponding
-Source.
-
- The Corresponding Source for a work in source code form is that
-same work.
-
- 2. Basic Permissions.
-
- All rights granted under this License are granted for the term of
-copyright on the Program, and are irrevocable provided the stated
-conditions are met. This License explicitly affirms your unlimited
-permission to run the unmodified Program. The output from running a
-covered work is covered by this License only if the output, given its
-content, constitutes a covered work. This License acknowledges your
-rights of fair use or other equivalent, as provided by copyright law.
-
- You may make, run and propagate covered works that you do not
-convey, without conditions so long as your license otherwise remains
-in force. You may convey covered works to others for the sole purpose
-of having them make modifications exclusively for you, or provide you
-with facilities for running those works, provided that you comply with
-the terms of this License in conveying all material for which you do
-not control copyright. Those thus making or running the covered works
-for you must do so exclusively on your behalf, under your direction
-and control, on terms that prohibit them from making any copies of
-your copyrighted material outside their relationship with you.
-
- Conveying under any other circumstances is permitted solely under
-the conditions stated below. Sublicensing is not allowed; section 10
-makes it unnecessary.
-
- 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
-
- No covered work shall be deemed part of an effective technological
-measure under any applicable law fulfilling obligations under article
-11 of the WIPO copyright treaty adopted on 20 December 1996, or
-similar laws prohibiting or restricting circumvention of such
-measures.
-
- When you convey a covered work, you waive any legal power to forbid
-circumvention of technological measures to the extent such circumvention
-is effected by exercising rights under this License with respect to
-the covered work, and you disclaim any intention to limit operation or
-modification of the work as a means of enforcing, against the work's
-users, your or third parties' legal rights to forbid circumvention of
-technological measures.
-
- 4. Conveying Verbatim Copies.
-
- You may convey verbatim copies of the Program's source code as you
-receive it, in any medium, provided that you conspicuously and
-appropriately publish on each copy an appropriate copyright notice;
-keep intact all notices stating that this License and any
-non-permissive terms added in accord with section 7 apply to the code;
-keep intact all notices of the absence of any warranty; and give all
-recipients a copy of this License along with the Program.
-
- You may charge any price or no price for each copy that you convey,
-and you may offer support or warranty protection for a fee.
-
- 5. Conveying Modified Source Versions.
-
- You may convey a work based on the Program, or the modifications to
-produce it from the Program, in the form of source code under the
-terms of section 4, provided that you also meet all of these conditions:
-
- a) The work must carry prominent notices stating that you modified
- it, and giving a relevant date.
-
- b) The work must carry prominent notices stating that it is
- released under this License and any conditions added under section
- 7. This requirement modifies the requirement in section 4 to
- "keep intact all notices".
-
- c) You must license the entire work, as a whole, under this
- License to anyone who comes into possession of a copy. This
- License will therefore apply, along with any applicable section 7
- additional terms, to the whole of the work, and all its parts,
- regardless of how they are packaged. This License gives no
- permission to license the work in any other way, but it does not
- invalidate such permission if you have separately received it.
-
- d) If the work has interactive user interfaces, each must display
- Appropriate Legal Notices; however, if the Program has interactive
- interfaces that do not display Appropriate Legal Notices, your
- work need not make them do so.
-
- A compilation of a covered work with other separate and independent
-works, which are not by their nature extensions of the covered work,
-and which are not combined with it such as to form a larger program,
-in or on a volume of a storage or distribution medium, is called an
-"aggregate" if the compilation and its resulting copyright are not
-used to limit the access or legal rights of the compilation's users
-beyond what the individual works permit. Inclusion of a covered work
-in an aggregate does not cause this License to apply to the other
-parts of the aggregate.
-
- 6. Conveying Non-Source Forms.
-
- You may convey a covered work in object code form under the terms
-of sections 4 and 5, provided that you also convey the
-machine-readable Corresponding Source under the terms of this License,
-in one of these ways:
-
- a) Convey the object code in, or embodied in, a physical product
- (including a physical distribution medium), accompanied by the
- Corresponding Source fixed on a durable physical medium
- customarily used for software interchange.
-
- b) Convey the object code in, or embodied in, a physical product
- (including a physical distribution medium), accompanied by a
- written offer, valid for at least three years and valid for as
- long as you offer spare parts or customer support for that product
- model, to give anyone who possesses the object code either (1) a
- copy of the Corresponding Source for all the software in the
- product that is covered by this License, on a durable physical
- medium customarily used for software interchange, for a price no
- more than your reasonable cost of physically performing this
- conveying of source, or (2) access to copy the
- Corresponding Source from a network server at no charge.
-
- c) Convey individual copies of the object code with a copy of the
- written offer to provide the Corresponding Source. This
- alternative is allowed only occasionally and noncommercially, and
- only if you received the object code with such an offer, in accord
- with subsection 6b.
-
- d) Convey the object code by offering access from a designated
- place (gratis or for a charge), and offer equivalent access to the
- Corresponding Source in the same way through the same place at no
- further charge. You need not require recipients to copy the
- Corresponding Source along with the object code. If the place to
- copy the object code is a network server, the Corresponding Source
- may be on a different server (operated by you or a third party)
- that supports equivalent copying facilities, provided you maintain
- clear directions next to the object code saying where to find the
- Corresponding Source. Regardless of what server hosts the
- Corresponding Source, you remain obligated to ensure that it is
- available for as long as needed to satisfy these requirements.
-
- e) Convey the object code using peer-to-peer transmission, provided
- you inform other peers where the object code and Corresponding
- Source of the work are being offered to the general public at no
- charge under subsection 6d.
-
- A separable portion of the object code, whose source code is excluded
-from the Corresponding Source as a System Library, need not be
-included in conveying the object code work.
-
- A "User Product" is either (1) a "consumer product", which means any
-tangible personal property which is normally used for personal, family,
-or household purposes, or (2) anything designed or sold for incorporation
-into a dwelling. In determining whether a product is a consumer product,
-doubtful cases shall be resolved in favor of coverage. For a particular
-product received by a particular user, "normally used" refers to a
-typical or common use of that class of product, regardless of the status
-of the particular user or of the way in which the particular user
-actually uses, or expects or is expected to use, the product. A product
-is a consumer product regardless of whether the product has substantial
-commercial, industrial or non-consumer uses, unless such uses represent
-the only significant mode of use of the product.
-
- "Installation Information" for a User Product means any methods,
-procedures, authorization keys, or other information required to install
-and execute modified versions of a covered work in that User Product from
-a modified version of its Corresponding Source. The information must
-suffice to ensure that the continued functioning of the modified object
-code is in no case prevented or interfered with solely because
-modification has been made.
-
- If you convey an object code work under this section in, or with, or
-specifically for use in, a User Product, and the conveying occurs as
-part of a transaction in which the right of possession and use of the
-User Product is transferred to the recipient in perpetuity or for a
-fixed term (regardless of how the transaction is characterized), the
-Corresponding Source conveyed under this section must be accompanied
-by the Installation Information. But this requirement does not apply
-if neither you nor any third party retains the ability to install
-modified object code on the User Product (for example, the work has
-been installed in ROM).
-
- The requirement to provide Installation Information does not include a
-requirement to continue to provide support service, warranty, or updates
-for a work that has been modified or installed by the recipient, or for
-the User Product in which it has been modified or installed. Access to a
-network may be denied when the modification itself materially and
-adversely affects the operation of the network or violates the rules and
-protocols for communication across the network.
-
- Corresponding Source conveyed, and Installation Information provided,
-in accord with this section must be in a format that is publicly
-documented (and with an implementation available to the public in
-source code form), and must require no special password or key for
-unpacking, reading or copying.
-
- 7. Additional Terms.
-
- "Additional permissions" are terms that supplement the terms of this
-License by making exceptions from one or more of its conditions.
-Additional permissions that are applicable to the entire Program shall
-be treated as though they were included in this License, to the extent
-that they are valid under applicable law. If additional permissions
-apply only to part of the Program, that part may be used separately
-under those permissions, but the entire Program remains governed by
-this License without regard to the additional permissions.
-
- When you convey a copy of a covered work, you may at your option
-remove any additional permissions from that copy, or from any part of
-it. (Additional permissions may be written to require their own
-removal in certain cases when you modify the work.) You may place
-additional permissions on material, added by you to a covered work,
-for which you have or can give appropriate copyright permission.
-
- Notwithstanding any other provision of this License, for material you
-add to a covered work, you may (if authorized by the copyright holders of
-that material) supplement the terms of this License with terms:
-
- a) Disclaiming warranty or limiting liability differently from the
- terms of sections 15 and 16 of this License; or
-
- b) Requiring preservation of specified reasonable legal notices or
- author attributions in that material or in the Appropriate Legal
- Notices displayed by works containing it; or
-
- c) Prohibiting misrepresentation of the origin of that material, or
- requiring that modified versions of such material be marked in
- reasonable ways as different from the original version; or
-
- d) Limiting the use for publicity purposes of names of licensors or
- authors of the material; or
-
- e) Declining to grant rights under trademark law for use of some
- trade names, trademarks, or service marks; or
-
- f) Requiring indemnification of licensors and authors of that
- material by anyone who conveys the material (or modified versions of
- it) with contractual assumptions of liability to the recipient, for
- any liability that these contractual assumptions directly impose on
- those licensors and authors.
-
- All other non-permissive additional terms are considered "further
-restrictions" within the meaning of section 10. If the Program as you
-received it, or any part of it, contains a notice stating that it is
-governed by this License along with a term that is a further
-restriction, you may remove that term. If a license document contains
-a further restriction but permits relicensing or conveying under this
-License, you may add to a covered work material governed by the terms
-of that license document, provided that the further restriction does
-not survive such relicensing or conveying.
-
- If you add terms to a covered work in accord with this section, you
-must place, in the relevant source files, a statement of the
-additional terms that apply to those files, or a notice indicating
-where to find the applicable terms.
-
- Additional terms, permissive or non-permissive, may be stated in the
-form of a separately written license, or stated as exceptions;
-the above requirements apply either way.
-
- 8. Termination.
-
- You may not propagate or modify a covered work except as expressly
-provided under this License. Any attempt otherwise to propagate or
-modify it is void, and will automatically terminate your rights under
-this License (including any patent licenses granted under the third
-paragraph of section 11).
-
- However, if you cease all violation of this License, then your
-license from a particular copyright holder is reinstated (a)
-provisionally, unless and until the copyright holder explicitly and
-finally terminates your license, and (b) permanently, if the copyright
-holder fails to notify you of the violation by some reasonable means
-prior to 60 days after the cessation.
-
- Moreover, your license from a particular copyright holder is
-reinstated permanently if the copyright holder notifies you of the
-violation by some reasonable means, this is the first time you have
-received notice of violation of this License (for any work) from that
-copyright holder, and you cure the violation prior to 30 days after
-your receipt of the notice.
-
- Termination of your rights under this section does not terminate the
-licenses of parties who have received copies or rights from you under
-this License. If your rights have been terminated and not permanently
-reinstated, you do not qualify to receive new licenses for the same
-material under section 10.
-
- 9. Acceptance Not Required for Having Copies.
-
- You are not required to accept this License in order to receive or
-run a copy of the Program. Ancillary propagation of a covered work
-occurring solely as a consequence of using peer-to-peer transmission
-to receive a copy likewise does not require acceptance. However,
-nothing other than this License grants you permission to propagate or
-modify any covered work. These actions infringe copyright if you do
-not accept this License. Therefore, by modifying or propagating a
-covered work, you indicate your acceptance of this License to do so.
-
- 10. Automatic Licensing of Downstream Recipients.
-
- Each time you convey a covered work, the recipient automatically
-receives a license from the original licensors, to run, modify and
-propagate that work, subject to this License. You are not responsible
-for enforcing compliance by third parties with this License.
-
- An "entity transaction" is a transaction transferring control of an
-organization, or substantially all assets of one, or subdividing an
-organization, or merging organizations. If propagation of a covered
-work results from an entity transaction, each party to that
-transaction who receives a copy of the work also receives whatever
-licenses to the work the party's predecessor in interest had or could
-give under the previous paragraph, plus a right to possession of the
-Corresponding Source of the work from the predecessor in interest, if
-the predecessor has it or can get it with reasonable efforts.
-
- You may not impose any further restrictions on the exercise of the
-rights granted or affirmed under this License. For example, you may
-not impose a license fee, royalty, or other charge for exercise of
-rights granted under this License, and you may not initiate litigation
-(including a cross-claim or counterclaim in a lawsuit) alleging that
-any patent claim is infringed by making, using, selling, offering for
-sale, or importing the Program or any portion of it.
-
- 11. Patents.
-
- A "contributor" is a copyright holder who authorizes use under this
-License of the Program or a work on which the Program is based. The
-work thus licensed is called the contributor's "contributor version".
-
- A contributor's "essential patent claims" are all patent claims
-owned or controlled by the contributor, whether already acquired or
-hereafter acquired, that would be infringed by some manner, permitted
-by this License, of making, using, or selling its contributor version,
-but do not include claims that would be infringed only as a
-consequence of further modification of the contributor version. For
-purposes of this definition, "control" includes the right to grant
-patent sublicenses in a manner consistent with the requirements of
-this License.
-
- Each contributor grants you a non-exclusive, worldwide, royalty-free
-patent license under the contributor's essential patent claims, to
-make, use, sell, offer for sale, import and otherwise run, modify and
-propagate the contents of its contributor version.
-
- In the following three paragraphs, a "patent license" is any express
-agreement or commitment, however denominated, not to enforce a patent
-(such as an express permission to practice a patent or covenant not to
-sue for patent infringement). To "grant" such a patent license to a
-party means to make such an agreement or commitment not to enforce a
-patent against the party.
-
- If you convey a covered work, knowingly relying on a patent license,
-and the Corresponding Source of the work is not available for anyone
-to copy, free of charge and under the terms of this License, through a
-publicly available network server or other readily accessible means,
-then you must either (1) cause the Corresponding Source to be so
-available, or (2) arrange to deprive yourself of the benefit of the
-patent license for this particular work, or (3) arrange, in a manner
-consistent with the requirements of this License, to extend the patent
-license to downstream recipients. "Knowingly relying" means you have
-actual knowledge that, but for the patent license, your conveying the
-covered work in a country, or your recipient's use of the covered work
-in a country, would infringe one or more identifiable patents in that
-country that you have reason to believe are valid.
-
- If, pursuant to or in connection with a single transaction or
-arrangement, you convey, or propagate by procuring conveyance of, a
-covered work, and grant a patent license to some of the parties
-receiving the covered work authorizing them to use, propagate, modify
-or convey a specific copy of the covered work, then the patent license
-you grant is automatically extended to all recipients of the covered
-work and works based on it.
-
- A patent license is "discriminatory" if it does not include within
-the scope of its coverage, prohibits the exercise of, or is
-conditioned on the non-exercise of one or more of the rights that are
-specifically granted under this License. You may not convey a covered
-work if you are a party to an arrangement with a third party that is
-in the business of distributing software, under which you make payment
-to the third party based on the extent of your activity of conveying
-the work, and under which the third party grants, to any of the
-parties who would receive the covered work from you, a discriminatory
-patent license (a) in connection with copies of the covered work
-conveyed by you (or copies made from those copies), or (b) primarily
-for and in connection with specific products or compilations that
-contain the covered work, unless you entered into that arrangement,
-or that patent license was granted, prior to 28 March 2007.
-
- Nothing in this License shall be construed as excluding or limiting
-any implied license or other defenses to infringement that may
-otherwise be available to you under applicable patent law.
-
- 12. No Surrender of Others' Freedom.
-
- If conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot convey a
-covered work so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you may
-not convey it at all. For example, if you agree to terms that obligate you
-to collect a royalty for further conveying from those to whom you convey
-the Program, the only way you could satisfy both those terms and this
-License would be to refrain entirely from conveying the Program.
-
- 13. Remote Network Interaction; Use with the GNU General Public License.
-
- Notwithstanding any other provision of this License, if you modify the
-Program, your modified version must prominently offer all users
-interacting with it remotely through a computer network (if your version
-supports such interaction) an opportunity to receive the Corresponding
-Source of your version by providing access to the Corresponding Source
-from a network server at no charge, through some standard or customary
-means of facilitating copying of software. This Corresponding Source
-shall include the Corresponding Source for any work covered by version 3
-of the GNU General Public License that is incorporated pursuant to the
-following paragraph.
-
- Notwithstanding any other provision of this License, you have
-permission to link or combine any covered work with a work licensed
-under version 3 of the GNU General Public License into a single
-combined work, and to convey the resulting work. The terms of this
-License will continue to apply to the part which is the covered work,
-but the work with which it is combined will remain governed by version
-3 of the GNU General Public License.
-
- 14. Revised Versions of this License.
-
- The Free Software Foundation may publish revised and/or new versions of
-the GNU Affero General Public License from time to time. Such new versions
-will be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
- Each version is given a distinguishing version number. If the
-Program specifies that a certain numbered version of the GNU Affero General
-Public License "or any later version" applies to it, you have the
-option of following the terms and conditions either of that numbered
-version or of any later version published by the Free Software
-Foundation. If the Program does not specify a version number of the
-GNU Affero General Public License, you may choose any version ever published
-by the Free Software Foundation.
-
- If the Program specifies that a proxy can decide which future
-versions of the GNU Affero General Public License can be used, that proxy's
-public statement of acceptance of a version permanently authorizes you
-to choose that version for the Program.
-
- Later license versions may give you additional or different
-permissions. However, no additional obligations are imposed on any
-author or copyright holder as a result of your choosing to follow a
-later version.
-
- 15. Disclaimer of Warranty.
-
- THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
-APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
-HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
-OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
-THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
-IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
-ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
- 16. Limitation of Liability.
-
- IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
-THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
-GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
-USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
-DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
-PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
-EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGES.
-
- 17. Interpretation of Sections 15 and 16.
-
- If the disclaimer of warranty and limitation of liability provided
-above cannot be given local legal effect according to their terms,
-reviewing courts shall apply local law that most closely approximates
-an absolute waiver of all civil liability in connection with the
-Program, unless a warranty or assumption of liability accompanies a
-copy of the Program in return for a fee.
-
- END OF TERMS AND CONDITIONS
-
- How to Apply These Terms to Your New Programs
-
- If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
- To do so, attach the following notices to the program. It is safest
-to attach them to the start of each source file to most effectively
-state the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
-
- Copyright (C)
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU Affero General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU Affero General Public License for more details.
-
- You should have received a copy of the GNU Affero General Public License
- along with this program. If not, see .
-
-Also add information on how to contact you by electronic and paper mail.
-
- If your software can interact with users remotely through a computer
-network, you should also make sure that it provides a way for users to
-get its source. For example, if your program is a web application, its
-interface could display a "Source" link that leads users to an archive
-of the code. There are many ways you could offer source, and different
-solutions will be better for different programs; see section 13 for the
-specific requirements.
-
- You should also get your employer (if you work as a programmer) or school,
-if any, to sign a "copyright disclaimer" for the program, if necessary.
-For more information on this, and how to apply and follow the GNU AGPL, see
-.
diff --git a/yolo26n-seg/README.md b/yolo26n-seg/README.md
deleted file mode 100644
index d2b08c0271555b9563b4f7577ac9de579eb7de37..0000000000000000000000000000000000000000
--- a/yolo26n-seg/README.md
+++ /dev/null
@@ -1,63 +0,0 @@
-# YOLO26n-seg TFLite Conversion
-
-YOLO26n-seg is the nano **instance-segmentation** model from [Ultralytics](https://github.com/ultralytics/ultralytics). It has an **NMS-free** head plus mask prototypes, so it produces two outputs:
-
-- `det` `[1, 300, 6+32]` — `[x1, y1, x2, y2, conf, class_id, 32 mask coeffs]` per detection
-- `proto` `[1, 32, mh, mw]` — mask prototypes
-
-Box coordinates are in **letterboxed-input pixel space** (`0…640`). The demo maps them back to the original image and reconstructs per-instance masks.
-
-## Prerequisites
-
-### Python environment
-
-The `.pt` → TFLite conversion uses Ultralytics. Python **3.10** was used.
-
-```bash
-conda create -n python=3.10 -y
-conda activate
-pip install "ultralytics==8.4.90" "torch==2.12.1" "torchvision==0.27.1" \
- "tensorflow==2.21.0" "ai-edge-litert==2.1.5"
-```
-
-These are the exact versions used to produce the provided `yolo26n-seg.tflite` (Python `3.10.20`). `tensorflow` is required for the TFLite export, and `torchvision` must match `torch` (0.27.1 ↔ 2.12.1).
-
----
-
-## Conversion of YOLO26n-seg to TFLite
-
-The `yolo26n-seg.pt` checkpoint is downloaded automatically by Ultralytics on first use.
-
-```bash
-# CLI
-yolo export model=yolo26n-seg.pt format=tflite imgsz=640
-```
-
-or equivalently with the Python API:
-
-```python
-from ultralytics import YOLO
-YOLO("yolo26n-seg.pt").export(format="tflite", imgsz=640)
-```
-
-Ultralytics writes the export artifacts to `yolo26n-seg_saved_model/`; the float32 model is `yolo26n-seg_saved_model/yolo26n-seg_float32.tflite`. Copy/rename it to `yolo26n-seg.tflite` (the name the demo expects).
-
----
-
-## Usage
-
-A demo script is provided to run inference using OpenCV DNN:
-
-```bash
-python demo.py --model yolo26n-seg.tflite --image example_outputs/input.jpg --output example_outputs/yolo26n-seg_output.jpg
-```
-
-`demo.py` uses only OpenCV's dnn module (`cv2.dnn.readNet`). It letterboxes the input to 640x640 (matching `ultralytics.data.augment.LetterBox`), runs the network, decodes the NMS-free `[1, 300, 6+32]` head, and reconstructs instance masks from the `[1, 32, mh, mw]` prototypes — mirroring `ultralytics ops.process_mask` (logits = coeffs @ proto, crop in proto space, bilinear-upsample to the letterboxed input, threshold at 0, then map back to the original image). It prints the detected COCO classes / confidences / bounding boxes and saves an annotated image with boxes and colored instance masks.
-
-On the provided `example_outputs/input.jpg` it detects and masks the `person` and the `sports ball`.
-
----
-
-## License
-
-YOLO26n-seg weights and the Ultralytics exporter are released under **AGPL-3.0** — see the [Ultralytics LICENSE](https://github.com/ultralytics/ultralytics/blob/main/LICENSE). Any redistribution of the converted `yolo26n-seg.tflite` is subject to those terms.
diff --git a/yolo26n-seg/demo.py b/yolo26n-seg/demo.py
deleted file mode 100644
index ab1c8796e8a68359a8223d5549f368a1b1367a92..0000000000000000000000000000000000000000
--- a/yolo26n-seg/demo.py
+++ /dev/null
@@ -1,164 +0,0 @@
-"""
-Demo script for YOLO26n-seg (instance segmentation) TFLite model using OpenCV DNN.
-
-Output format (NMS-free seg head):
- - det [1, 300, 6+32] -> [x1, y1, x2, y2, conf, class_id, 32 mask coeffs]
- - proto [1, 32, mh, mw] -> mask prototypes
-
-Mask pipeline mirrors ultralytics ops.process_mask: logits = coeffs @ proto, crop in
-proto space, bilinear-upsample to the letterboxed input, threshold at 0 (== sigmoid>0.5),
-then map back to the original image.
-
-Default input size: 640x640 (letterboxed, matching ultralytics.data.augment.LetterBox).
-
-Usage:
- python demo.py --model yolo26n-seg.tflite --image example_outputs/input.jpg --output example_outputs/yolo26n-seg_output.jpg
-"""
-
-import argparse
-import cv2
-import numpy as np
-
-
-COCO = [
- "person", "bicycle", "car", "motorbike", "aeroplane", "bus", "train", "truck", "boat", "traffic light",
- "fire hydrant", "stop sign", "parking meter", "bench", "bird", "cat", "dog", "horse", "sheep", "cow",
- "elephant", "bear", "zebra", "giraffe", "backpack", "umbrella", "handbag", "tie", "suitcase", "frisbee",
- "skis", "snowboard", "sports ball", "kite", "baseball bat", "baseball glove", "skateboard", "surfboard", "tennis racket", "bottle",
- "wine glass", "cup", "fork", "knife", "spoon", "bowl", "banana", "apple", "sandwich", "orange",
- "broccoli", "carrot", "hot dog", "pizza", "donut", "cake", "chair", "sofa", "pottedplant", "bed",
- "diningtable", "toilet", "tvmonitor", "laptop", "mouse", "remote", "keyboard", "cell phone", "microwave", "oven",
- "toaster", "sink", "refrigerator", "book", "clock", "vase", "scissors", "teddy bear", "hair drier", "toothbrush",
-]
-
-PAD_COLOR = (114, 114, 114)
-
-
-# Vivid, high-contrast BGR palette; one distinct color per detected instance.
-PALETTE = [
- (56, 56, 255), (31, 112, 255), (29, 178, 255), (49, 210, 207), (10, 249, 72),
- (23, 204, 146), (134, 219, 61), (255, 194, 0), (255, 115, 100), (236, 24, 0),
- (255, 56, 132), (255, 56, 203), (199, 55, 255), (147, 69, 52), (52, 147, 26),
-]
-
-
-def color_for(i):
- return PALETTE[i % len(PALETTE)]
-
-
-def letterbox(img, new_h, new_w):
- """Aspect-preserving resize + centered pad (Ultralytics LetterBox defaults, pad=114)."""
- h0, w0 = img.shape[:2]
- ratio = min(new_h / h0, new_w / w0)
- unpad_w, unpad_h = round(w0 * ratio), round(h0 * ratio)
- dw, dh = (new_w - unpad_w) / 2.0, (new_h - unpad_h) / 2.0
- top, bottom = round(dh - 0.1), round(dh + 0.1)
- left, right = round(dw - 0.1), round(dw + 0.1)
- if (unpad_w, unpad_h) != (w0, h0):
- img = cv2.resize(img, (unpad_w, unpad_h), interpolation=cv2.INTER_LINEAR)
- padded = cv2.copyMakeBorder(img, top, bottom, left, right, cv2.BORDER_CONSTANT, value=PAD_COLOR)
- return padded, ratio, left, top
-
-
-def unletterbox(x, y, ratio, pad_x, pad_y):
- return (x - pad_x) / ratio, (y - pad_y) / ratio
-
-
-def decode_seg_head(det, ratio, pad_x, pad_y, conf_thresh):
- """det: (1, 300, 6+nc) -> boxes (orig px), scores, class ids, letterbox-space xyxy, coeffs."""
- rows = det.reshape(det.shape[1], -1)
- keep = rows[:, 4] >= conf_thresh
- rows = rows[keep]
-
- boxes, scores, class_ids, boxes_lb = [], [], [], []
- for r in rows:
- x1, y1 = unletterbox(r[0], r[1], ratio, pad_x, pad_y)
- x2, y2 = unletterbox(r[2], r[3], ratio, pad_x, pad_y)
- boxes.append([x1, y1, x2 - x1, y2 - y1])
- scores.append(float(r[4]))
- class_ids.append(int(r[5]))
- boxes_lb.append([r[0], r[1], r[2], r[3]])
- coeffs = rows[:, 6:].astype(np.float32) if len(rows) else np.zeros((0, 0), np.float32)
- return boxes, scores, class_ids, boxes_lb, coeffs
-
-
-def process_masks(proto, coeffs, boxes_lb, net_w, net_h, pad_x, pad_y, ratio, orig_h, orig_w):
- """Mirrors ultralytics ops.process_mask + crop_mask."""
- _, C, mh, mw = proto.shape
- proto2d = proto.reshape(C, mh * mw)
- logits = coeffs @ proto2d # N x (mh*mw)
- wr, hr = mw / net_w, mh / net_h
- content_w, content_h = round(orig_w * ratio), round(orig_h * ratio)
-
- masks = []
- for i in range(logits.shape[0]):
- m = logits[i].reshape(mh, mw).copy()
- bx1, by1 = boxes_lb[i][0] * wr, boxes_lb[i][1] * hr
- bx2, by2 = boxes_lb[i][2] * wr, boxes_lb[i][3] * hr
- cols = np.arange(mw)[None, :]
- rows_ = np.arange(mh)[:, None]
- crop = (cols >= bx1) & (cols < bx2) & (rows_ >= by1) & (rows_ < by2)
- m[~crop] = 0.0
- up = cv2.resize(m, (net_w, net_h), interpolation=cv2.INTER_LINEAR)
- binm = (up > 0.0).astype(np.uint8) * 255
- content = binm[pad_y:pad_y + content_h, pad_x:pad_x + content_w]
- full = cv2.resize(content, (orig_w, orig_h), interpolation=cv2.INTER_NEAREST)
- masks.append(full)
- return masks
-
-
-def main():
- parser = argparse.ArgumentParser(description="YOLO segmentation TFLite demo (OpenCV DNN)")
- parser.add_argument("--model", required=True, help="Path to TFLite seg model")
- parser.add_argument("--image", default="example_outputs/input.jpg", help="Path to input image")
- parser.add_argument("--output", default="output.jpg", help="Path for annotated output")
- parser.add_argument("--input-size", type=int, default=640, help="Model input size (W=H)")
- parser.add_argument("--conf", type=float, default=0.55, help="Confidence threshold")
- args = parser.parse_args()
-
- img = cv2.imread(args.image)
- if img is None:
- raise FileNotFoundError(f"Cannot read image: {args.image}")
- orig_h, orig_w = img.shape[:2]
-
- net = cv2.dnn.readNet(args.model)
-
- imgsz = args.input_size
- padded, ratio, pad_x, pad_y = letterbox(img, imgsz, imgsz)
- blob = cv2.dnn.blobFromImage(padded, 1.0 / 255.0, (imgsz, imgsz), swapRB=True, crop=False)
- net.setInput(blob)
- outs = net.forward(net.getUnconnectedOutLayersNames())
- print("outputs:", [o.shape for o in outs])
-
- det = next((o for o in outs if o.ndim == 3 and o.shape[1] == 300), None)
- proto = next((o for o in outs if o.ndim == 4), None)
- if det is None or proto is None or det.shape[2] <= 6:
- raise RuntimeError("not a seg model (need a (1,300,>6) head and a (1,C,mh,mw) proto)")
-
- boxes, scores, class_ids, boxes_lb, coeffs = decode_seg_head(det, ratio, pad_x, pad_y, args.conf)
- masks = process_masks(proto, coeffs, boxes_lb, imgsz, imgsz, pad_x, pad_y, ratio, orig_h, orig_w)
-
- out = img.copy()
- for k, mask in enumerate(masks):
- color = np.array(color_for(k), np.uint8)
- blended = cv2.addWeighted(out, 0.5, np.full_like(out, color), 0.5, 0)
- out[mask > 0] = blended[mask > 0]
- for k, (x, y, w, h) in enumerate(boxes):
- color = color_for(k)
- p1, p2 = (int(x), int(y)), (int(x + w), int(y + h))
- cls = COCO[class_ids[k]] if 0 <= class_ids[k] < 80 else str(class_ids[k])
- label = f"{cls} {scores[k]:.2f}"
- cv2.rectangle(out, p1, p2, color, 2)
- (tw, th), _ = cv2.getTextSize(label, cv2.FONT_HERSHEY_SIMPLEX, 0.6, 2)
- ly = max(th + 6, p1[1])
- cv2.rectangle(out, (p1[0], ly - th - 6), (p1[0] + tw + 4, ly), color, -1)
- cv2.putText(out, label, (p1[0] + 2, ly - 4), cv2.FONT_HERSHEY_SIMPLEX, 0.6, (255, 255, 255), 2)
- print(f" {label} box=[{p1[0]},{p1[1]},{p2[0]},{p2[1]}]")
-
- print(f"{len(boxes)} detections above conf {args.conf}")
- cv2.imwrite(args.output, out)
- print(f"Saved annotated image: {args.output}")
-
-
-if __name__ == "__main__":
- main()
diff --git a/yolo26n-seg/example_outputs/input.jpg b/yolo26n-seg/example_outputs/input.jpg
deleted file mode 100644
index 1da6602e566a9578678a4680f8fb96ac50c94156..0000000000000000000000000000000000000000
--- a/yolo26n-seg/example_outputs/input.jpg
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:e4635210731f240623faf5493358992dff17bb0c7227d9024c6aa0771d82316b
-size 69528
diff --git a/yolo26n-seg/example_outputs/yolo26n-seg_output.jpg b/yolo26n-seg/example_outputs/yolo26n-seg_output.jpg
deleted file mode 100644
index aa061ea929e16fd8e6b4fd4b7209a24688df1a6f..0000000000000000000000000000000000000000
--- a/yolo26n-seg/example_outputs/yolo26n-seg_output.jpg
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:435beebda7bb5f0ac92ab912f580bfc5db56a689df95eca6c0e3814b17f4a58f
-size 74532
diff --git a/yolo26n-seg/yolo26n-seg.tflite b/yolo26n-seg/yolo26n-seg.tflite
deleted file mode 100644
index 9aa84c8d83755f1ec927287700ded2e24ad2930c..0000000000000000000000000000000000000000
--- a/yolo26n-seg/yolo26n-seg.tflite
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:8d0fa77e6e5a3fe933df15ffbe770a69d69095f20c4d6f47441323201ce2871b
-size 11687857
diff --git a/yolo26n/LICENSE b/yolo26n/LICENSE
deleted file mode 100644
index be3f7b28e564e7dd05eaf59d64adba1a4065ac0e..0000000000000000000000000000000000000000
--- a/yolo26n/LICENSE
+++ /dev/null
@@ -1,661 +0,0 @@
- GNU AFFERO GENERAL PUBLIC LICENSE
- Version 3, 19 November 2007
-
- Copyright (C) 2007 Free Software Foundation, Inc.
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
- Preamble
-
- The GNU Affero General Public License is a free, copyleft license for
-software and other kinds of works, specifically designed to ensure
-cooperation with the community in the case of network server software.
-
- The licenses for most software and other practical works are designed
-to take away your freedom to share and change the works. By contrast,
-our General Public Licenses are intended to guarantee your freedom to
-share and change all versions of a program--to make sure it remains free
-software for all its users.
-
- When we speak of free software, we are referring to freedom, not
-price. Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-them if you wish), that you receive source code or can get it if you
-want it, that you can change the software or use pieces of it in new
-free programs, and that you know you can do these things.
-
- Developers that use our General Public Licenses protect your rights
-with two steps: (1) assert copyright on the software, and (2) offer
-you this License which gives you legal permission to copy, distribute
-and/or modify the software.
-
- A secondary benefit of defending all users' freedom is that
-improvements made in alternate versions of the program, if they
-receive widespread use, become available for other developers to
-incorporate. Many developers of free software are heartened and
-encouraged by the resulting cooperation. However, in the case of
-software used on network servers, this result may fail to come about.
-The GNU General Public License permits making a modified version and
-letting the public access it on a server without ever releasing its
-source code to the public.
-
- The GNU Affero General Public License is designed specifically to
-ensure that, in such cases, the modified source code becomes available
-to the community. It requires the operator of a network server to
-provide the source code of the modified version running there to the
-users of that server. Therefore, public use of a modified version, on
-a publicly accessible server, gives the public access to the source
-code of the modified version.
-
- An older license, called the Affero General Public License and
-published by Affero, was designed to accomplish similar goals. This is
-a different license, not a version of the Affero GPL, but Affero has
-released a new version of the Affero GPL which permits relicensing under
-this license.
-
- The precise terms and conditions for copying, distribution and
-modification follow.
-
- TERMS AND CONDITIONS
-
- 0. Definitions.
-
- "This License" refers to version 3 of the GNU Affero General Public License.
-
- "Copyright" also means copyright-like laws that apply to other kinds of
-works, such as semiconductor masks.
-
- "The Program" refers to any copyrightable work licensed under this
-License. Each licensee is addressed as "you". "Licensees" and
-"recipients" may be individuals or organizations.
-
- To "modify" a work means to copy from or adapt all or part of the work
-in a fashion requiring copyright permission, other than the making of an
-exact copy. The resulting work is called a "modified version" of the
-earlier work or a work "based on" the earlier work.
-
- A "covered work" means either the unmodified Program or a work based
-on the Program.
-
- To "propagate" a work means to do anything with it that, without
-permission, would make you directly or secondarily liable for
-infringement under applicable copyright law, except executing it on a
-computer or modifying a private copy. Propagation includes copying,
-distribution (with or without modification), making available to the
-public, and in some countries other activities as well.
-
- To "convey" a work means any kind of propagation that enables other
-parties to make or receive copies. Mere interaction with a user through
-a computer network, with no transfer of a copy, is not conveying.
-
- An interactive user interface displays "Appropriate Legal Notices"
-to the extent that it includes a convenient and prominently visible
-feature that (1) displays an appropriate copyright notice, and (2)
-tells the user that there is no warranty for the work (except to the
-extent that warranties are provided), that licensees may convey the
-work under this License, and how to view a copy of this License. If
-the interface presents a list of user commands or options, such as a
-menu, a prominent item in the list meets this criterion.
-
- 1. Source Code.
-
- The "source code" for a work means the preferred form of the work
-for making modifications to it. "Object code" means any non-source
-form of a work.
-
- A "Standard Interface" means an interface that either is an official
-standard defined by a recognized standards body, or, in the case of
-interfaces specified for a particular programming language, one that
-is widely used among developers working in that language.
-
- The "System Libraries" of an executable work include anything, other
-than the work as a whole, that (a) is included in the normal form of
-packaging a Major Component, but which is not part of that Major
-Component, and (b) serves only to enable use of the work with that
-Major Component, or to implement a Standard Interface for which an
-implementation is available to the public in source code form. A
-"Major Component", in this context, means a major essential component
-(kernel, window system, and so on) of the specific operating system
-(if any) on which the executable work runs, or a compiler used to
-produce the work, or an object code interpreter used to run it.
-
- The "Corresponding Source" for a work in object code form means all
-the source code needed to generate, install, and (for an executable
-work) run the object code and to modify the work, including scripts to
-control those activities. However, it does not include the work's
-System Libraries, or general-purpose tools or generally available free
-programs which are used unmodified in performing those activities but
-which are not part of the work. For example, Corresponding Source
-includes interface definition files associated with source files for
-the work, and the source code for shared libraries and dynamically
-linked subprograms that the work is specifically designed to require,
-such as by intimate data communication or control flow between those
-subprograms and other parts of the work.
-
- The Corresponding Source need not include anything that users
-can regenerate automatically from other parts of the Corresponding
-Source.
-
- The Corresponding Source for a work in source code form is that
-same work.
-
- 2. Basic Permissions.
-
- All rights granted under this License are granted for the term of
-copyright on the Program, and are irrevocable provided the stated
-conditions are met. This License explicitly affirms your unlimited
-permission to run the unmodified Program. The output from running a
-covered work is covered by this License only if the output, given its
-content, constitutes a covered work. This License acknowledges your
-rights of fair use or other equivalent, as provided by copyright law.
-
- You may make, run and propagate covered works that you do not
-convey, without conditions so long as your license otherwise remains
-in force. You may convey covered works to others for the sole purpose
-of having them make modifications exclusively for you, or provide you
-with facilities for running those works, provided that you comply with
-the terms of this License in conveying all material for which you do
-not control copyright. Those thus making or running the covered works
-for you must do so exclusively on your behalf, under your direction
-and control, on terms that prohibit them from making any copies of
-your copyrighted material outside their relationship with you.
-
- Conveying under any other circumstances is permitted solely under
-the conditions stated below. Sublicensing is not allowed; section 10
-makes it unnecessary.
-
- 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
-
- No covered work shall be deemed part of an effective technological
-measure under any applicable law fulfilling obligations under article
-11 of the WIPO copyright treaty adopted on 20 December 1996, or
-similar laws prohibiting or restricting circumvention of such
-measures.
-
- When you convey a covered work, you waive any legal power to forbid
-circumvention of technological measures to the extent such circumvention
-is effected by exercising rights under this License with respect to
-the covered work, and you disclaim any intention to limit operation or
-modification of the work as a means of enforcing, against the work's
-users, your or third parties' legal rights to forbid circumvention of
-technological measures.
-
- 4. Conveying Verbatim Copies.
-
- You may convey verbatim copies of the Program's source code as you
-receive it, in any medium, provided that you conspicuously and
-appropriately publish on each copy an appropriate copyright notice;
-keep intact all notices stating that this License and any
-non-permissive terms added in accord with section 7 apply to the code;
-keep intact all notices of the absence of any warranty; and give all
-recipients a copy of this License along with the Program.
-
- You may charge any price or no price for each copy that you convey,
-and you may offer support or warranty protection for a fee.
-
- 5. Conveying Modified Source Versions.
-
- You may convey a work based on the Program, or the modifications to
-produce it from the Program, in the form of source code under the
-terms of section 4, provided that you also meet all of these conditions:
-
- a) The work must carry prominent notices stating that you modified
- it, and giving a relevant date.
-
- b) The work must carry prominent notices stating that it is
- released under this License and any conditions added under section
- 7. This requirement modifies the requirement in section 4 to
- "keep intact all notices".
-
- c) You must license the entire work, as a whole, under this
- License to anyone who comes into possession of a copy. This
- License will therefore apply, along with any applicable section 7
- additional terms, to the whole of the work, and all its parts,
- regardless of how they are packaged. This License gives no
- permission to license the work in any other way, but it does not
- invalidate such permission if you have separately received it.
-
- d) If the work has interactive user interfaces, each must display
- Appropriate Legal Notices; however, if the Program has interactive
- interfaces that do not display Appropriate Legal Notices, your
- work need not make them do so.
-
- A compilation of a covered work with other separate and independent
-works, which are not by their nature extensions of the covered work,
-and which are not combined with it such as to form a larger program,
-in or on a volume of a storage or distribution medium, is called an
-"aggregate" if the compilation and its resulting copyright are not
-used to limit the access or legal rights of the compilation's users
-beyond what the individual works permit. Inclusion of a covered work
-in an aggregate does not cause this License to apply to the other
-parts of the aggregate.
-
- 6. Conveying Non-Source Forms.
-
- You may convey a covered work in object code form under the terms
-of sections 4 and 5, provided that you also convey the
-machine-readable Corresponding Source under the terms of this License,
-in one of these ways:
-
- a) Convey the object code in, or embodied in, a physical product
- (including a physical distribution medium), accompanied by the
- Corresponding Source fixed on a durable physical medium
- customarily used for software interchange.
-
- b) Convey the object code in, or embodied in, a physical product
- (including a physical distribution medium), accompanied by a
- written offer, valid for at least three years and valid for as
- long as you offer spare parts or customer support for that product
- model, to give anyone who possesses the object code either (1) a
- copy of the Corresponding Source for all the software in the
- product that is covered by this License, on a durable physical
- medium customarily used for software interchange, for a price no
- more than your reasonable cost of physically performing this
- conveying of source, or (2) access to copy the
- Corresponding Source from a network server at no charge.
-
- c) Convey individual copies of the object code with a copy of the
- written offer to provide the Corresponding Source. This
- alternative is allowed only occasionally and noncommercially, and
- only if you received the object code with such an offer, in accord
- with subsection 6b.
-
- d) Convey the object code by offering access from a designated
- place (gratis or for a charge), and offer equivalent access to the
- Corresponding Source in the same way through the same place at no
- further charge. You need not require recipients to copy the
- Corresponding Source along with the object code. If the place to
- copy the object code is a network server, the Corresponding Source
- may be on a different server (operated by you or a third party)
- that supports equivalent copying facilities, provided you maintain
- clear directions next to the object code saying where to find the
- Corresponding Source. Regardless of what server hosts the
- Corresponding Source, you remain obligated to ensure that it is
- available for as long as needed to satisfy these requirements.
-
- e) Convey the object code using peer-to-peer transmission, provided
- you inform other peers where the object code and Corresponding
- Source of the work are being offered to the general public at no
- charge under subsection 6d.
-
- A separable portion of the object code, whose source code is excluded
-from the Corresponding Source as a System Library, need not be
-included in conveying the object code work.
-
- A "User Product" is either (1) a "consumer product", which means any
-tangible personal property which is normally used for personal, family,
-or household purposes, or (2) anything designed or sold for incorporation
-into a dwelling. In determining whether a product is a consumer product,
-doubtful cases shall be resolved in favor of coverage. For a particular
-product received by a particular user, "normally used" refers to a
-typical or common use of that class of product, regardless of the status
-of the particular user or of the way in which the particular user
-actually uses, or expects or is expected to use, the product. A product
-is a consumer product regardless of whether the product has substantial
-commercial, industrial or non-consumer uses, unless such uses represent
-the only significant mode of use of the product.
-
- "Installation Information" for a User Product means any methods,
-procedures, authorization keys, or other information required to install
-and execute modified versions of a covered work in that User Product from
-a modified version of its Corresponding Source. The information must
-suffice to ensure that the continued functioning of the modified object
-code is in no case prevented or interfered with solely because
-modification has been made.
-
- If you convey an object code work under this section in, or with, or
-specifically for use in, a User Product, and the conveying occurs as
-part of a transaction in which the right of possession and use of the
-User Product is transferred to the recipient in perpetuity or for a
-fixed term (regardless of how the transaction is characterized), the
-Corresponding Source conveyed under this section must be accompanied
-by the Installation Information. But this requirement does not apply
-if neither you nor any third party retains the ability to install
-modified object code on the User Product (for example, the work has
-been installed in ROM).
-
- The requirement to provide Installation Information does not include a
-requirement to continue to provide support service, warranty, or updates
-for a work that has been modified or installed by the recipient, or for
-the User Product in which it has been modified or installed. Access to a
-network may be denied when the modification itself materially and
-adversely affects the operation of the network or violates the rules and
-protocols for communication across the network.
-
- Corresponding Source conveyed, and Installation Information provided,
-in accord with this section must be in a format that is publicly
-documented (and with an implementation available to the public in
-source code form), and must require no special password or key for
-unpacking, reading or copying.
-
- 7. Additional Terms.
-
- "Additional permissions" are terms that supplement the terms of this
-License by making exceptions from one or more of its conditions.
-Additional permissions that are applicable to the entire Program shall
-be treated as though they were included in this License, to the extent
-that they are valid under applicable law. If additional permissions
-apply only to part of the Program, that part may be used separately
-under those permissions, but the entire Program remains governed by
-this License without regard to the additional permissions.
-
- When you convey a copy of a covered work, you may at your option
-remove any additional permissions from that copy, or from any part of
-it. (Additional permissions may be written to require their own
-removal in certain cases when you modify the work.) You may place
-additional permissions on material, added by you to a covered work,
-for which you have or can give appropriate copyright permission.
-
- Notwithstanding any other provision of this License, for material you
-add to a covered work, you may (if authorized by the copyright holders of
-that material) supplement the terms of this License with terms:
-
- a) Disclaiming warranty or limiting liability differently from the
- terms of sections 15 and 16 of this License; or
-
- b) Requiring preservation of specified reasonable legal notices or
- author attributions in that material or in the Appropriate Legal
- Notices displayed by works containing it; or
-
- c) Prohibiting misrepresentation of the origin of that material, or
- requiring that modified versions of such material be marked in
- reasonable ways as different from the original version; or
-
- d) Limiting the use for publicity purposes of names of licensors or
- authors of the material; or
-
- e) Declining to grant rights under trademark law for use of some
- trade names, trademarks, or service marks; or
-
- f) Requiring indemnification of licensors and authors of that
- material by anyone who conveys the material (or modified versions of
- it) with contractual assumptions of liability to the recipient, for
- any liability that these contractual assumptions directly impose on
- those licensors and authors.
-
- All other non-permissive additional terms are considered "further
-restrictions" within the meaning of section 10. If the Program as you
-received it, or any part of it, contains a notice stating that it is
-governed by this License along with a term that is a further
-restriction, you may remove that term. If a license document contains
-a further restriction but permits relicensing or conveying under this
-License, you may add to a covered work material governed by the terms
-of that license document, provided that the further restriction does
-not survive such relicensing or conveying.
-
- If you add terms to a covered work in accord with this section, you
-must place, in the relevant source files, a statement of the
-additional terms that apply to those files, or a notice indicating
-where to find the applicable terms.
-
- Additional terms, permissive or non-permissive, may be stated in the
-form of a separately written license, or stated as exceptions;
-the above requirements apply either way.
-
- 8. Termination.
-
- You may not propagate or modify a covered work except as expressly
-provided under this License. Any attempt otherwise to propagate or
-modify it is void, and will automatically terminate your rights under
-this License (including any patent licenses granted under the third
-paragraph of section 11).
-
- However, if you cease all violation of this License, then your
-license from a particular copyright holder is reinstated (a)
-provisionally, unless and until the copyright holder explicitly and
-finally terminates your license, and (b) permanently, if the copyright
-holder fails to notify you of the violation by some reasonable means
-prior to 60 days after the cessation.
-
- Moreover, your license from a particular copyright holder is
-reinstated permanently if the copyright holder notifies you of the
-violation by some reasonable means, this is the first time you have
-received notice of violation of this License (for any work) from that
-copyright holder, and you cure the violation prior to 30 days after
-your receipt of the notice.
-
- Termination of your rights under this section does not terminate the
-licenses of parties who have received copies or rights from you under
-this License. If your rights have been terminated and not permanently
-reinstated, you do not qualify to receive new licenses for the same
-material under section 10.
-
- 9. Acceptance Not Required for Having Copies.
-
- You are not required to accept this License in order to receive or
-run a copy of the Program. Ancillary propagation of a covered work
-occurring solely as a consequence of using peer-to-peer transmission
-to receive a copy likewise does not require acceptance. However,
-nothing other than this License grants you permission to propagate or
-modify any covered work. These actions infringe copyright if you do
-not accept this License. Therefore, by modifying or propagating a
-covered work, you indicate your acceptance of this License to do so.
-
- 10. Automatic Licensing of Downstream Recipients.
-
- Each time you convey a covered work, the recipient automatically
-receives a license from the original licensors, to run, modify and
-propagate that work, subject to this License. You are not responsible
-for enforcing compliance by third parties with this License.
-
- An "entity transaction" is a transaction transferring control of an
-organization, or substantially all assets of one, or subdividing an
-organization, or merging organizations. If propagation of a covered
-work results from an entity transaction, each party to that
-transaction who receives a copy of the work also receives whatever
-licenses to the work the party's predecessor in interest had or could
-give under the previous paragraph, plus a right to possession of the
-Corresponding Source of the work from the predecessor in interest, if
-the predecessor has it or can get it with reasonable efforts.
-
- You may not impose any further restrictions on the exercise of the
-rights granted or affirmed under this License. For example, you may
-not impose a license fee, royalty, or other charge for exercise of
-rights granted under this License, and you may not initiate litigation
-(including a cross-claim or counterclaim in a lawsuit) alleging that
-any patent claim is infringed by making, using, selling, offering for
-sale, or importing the Program or any portion of it.
-
- 11. Patents.
-
- A "contributor" is a copyright holder who authorizes use under this
-License of the Program or a work on which the Program is based. The
-work thus licensed is called the contributor's "contributor version".
-
- A contributor's "essential patent claims" are all patent claims
-owned or controlled by the contributor, whether already acquired or
-hereafter acquired, that would be infringed by some manner, permitted
-by this License, of making, using, or selling its contributor version,
-but do not include claims that would be infringed only as a
-consequence of further modification of the contributor version. For
-purposes of this definition, "control" includes the right to grant
-patent sublicenses in a manner consistent with the requirements of
-this License.
-
- Each contributor grants you a non-exclusive, worldwide, royalty-free
-patent license under the contributor's essential patent claims, to
-make, use, sell, offer for sale, import and otherwise run, modify and
-propagate the contents of its contributor version.
-
- In the following three paragraphs, a "patent license" is any express
-agreement or commitment, however denominated, not to enforce a patent
-(such as an express permission to practice a patent or covenant not to
-sue for patent infringement). To "grant" such a patent license to a
-party means to make such an agreement or commitment not to enforce a
-patent against the party.
-
- If you convey a covered work, knowingly relying on a patent license,
-and the Corresponding Source of the work is not available for anyone
-to copy, free of charge and under the terms of this License, through a
-publicly available network server or other readily accessible means,
-then you must either (1) cause the Corresponding Source to be so
-available, or (2) arrange to deprive yourself of the benefit of the
-patent license for this particular work, or (3) arrange, in a manner
-consistent with the requirements of this License, to extend the patent
-license to downstream recipients. "Knowingly relying" means you have
-actual knowledge that, but for the patent license, your conveying the
-covered work in a country, or your recipient's use of the covered work
-in a country, would infringe one or more identifiable patents in that
-country that you have reason to believe are valid.
-
- If, pursuant to or in connection with a single transaction or
-arrangement, you convey, or propagate by procuring conveyance of, a
-covered work, and grant a patent license to some of the parties
-receiving the covered work authorizing them to use, propagate, modify
-or convey a specific copy of the covered work, then the patent license
-you grant is automatically extended to all recipients of the covered
-work and works based on it.
-
- A patent license is "discriminatory" if it does not include within
-the scope of its coverage, prohibits the exercise of, or is
-conditioned on the non-exercise of one or more of the rights that are
-specifically granted under this License. You may not convey a covered
-work if you are a party to an arrangement with a third party that is
-in the business of distributing software, under which you make payment
-to the third party based on the extent of your activity of conveying
-the work, and under which the third party grants, to any of the
-parties who would receive the covered work from you, a discriminatory
-patent license (a) in connection with copies of the covered work
-conveyed by you (or copies made from those copies), or (b) primarily
-for and in connection with specific products or compilations that
-contain the covered work, unless you entered into that arrangement,
-or that patent license was granted, prior to 28 March 2007.
-
- Nothing in this License shall be construed as excluding or limiting
-any implied license or other defenses to infringement that may
-otherwise be available to you under applicable patent law.
-
- 12. No Surrender of Others' Freedom.
-
- If conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot convey a
-covered work so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you may
-not convey it at all. For example, if you agree to terms that obligate you
-to collect a royalty for further conveying from those to whom you convey
-the Program, the only way you could satisfy both those terms and this
-License would be to refrain entirely from conveying the Program.
-
- 13. Remote Network Interaction; Use with the GNU General Public License.
-
- Notwithstanding any other provision of this License, if you modify the
-Program, your modified version must prominently offer all users
-interacting with it remotely through a computer network (if your version
-supports such interaction) an opportunity to receive the Corresponding
-Source of your version by providing access to the Corresponding Source
-from a network server at no charge, through some standard or customary
-means of facilitating copying of software. This Corresponding Source
-shall include the Corresponding Source for any work covered by version 3
-of the GNU General Public License that is incorporated pursuant to the
-following paragraph.
-
- Notwithstanding any other provision of this License, you have
-permission to link or combine any covered work with a work licensed
-under version 3 of the GNU General Public License into a single
-combined work, and to convey the resulting work. The terms of this
-License will continue to apply to the part which is the covered work,
-but the work with which it is combined will remain governed by version
-3 of the GNU General Public License.
-
- 14. Revised Versions of this License.
-
- The Free Software Foundation may publish revised and/or new versions of
-the GNU Affero General Public License from time to time. Such new versions
-will be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
- Each version is given a distinguishing version number. If the
-Program specifies that a certain numbered version of the GNU Affero General
-Public License "or any later version" applies to it, you have the
-option of following the terms and conditions either of that numbered
-version or of any later version published by the Free Software
-Foundation. If the Program does not specify a version number of the
-GNU Affero General Public License, you may choose any version ever published
-by the Free Software Foundation.
-
- If the Program specifies that a proxy can decide which future
-versions of the GNU Affero General Public License can be used, that proxy's
-public statement of acceptance of a version permanently authorizes you
-to choose that version for the Program.
-
- Later license versions may give you additional or different
-permissions. However, no additional obligations are imposed on any
-author or copyright holder as a result of your choosing to follow a
-later version.
-
- 15. Disclaimer of Warranty.
-
- THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
-APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
-HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
-OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
-THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
-IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
-ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
- 16. Limitation of Liability.
-
- IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
-THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
-GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
-USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
-DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
-PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
-EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGES.
-
- 17. Interpretation of Sections 15 and 16.
-
- If the disclaimer of warranty and limitation of liability provided
-above cannot be given local legal effect according to their terms,
-reviewing courts shall apply local law that most closely approximates
-an absolute waiver of all civil liability in connection with the
-Program, unless a warranty or assumption of liability accompanies a
-copy of the Program in return for a fee.
-
- END OF TERMS AND CONDITIONS
-
- How to Apply These Terms to Your New Programs
-
- If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
- To do so, attach the following notices to the program. It is safest
-to attach them to the start of each source file to most effectively
-state the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
-
- Copyright (C)
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU Affero General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU Affero General Public License for more details.
-
- You should have received a copy of the GNU Affero General Public License
- along with this program. If not, see .
-
-Also add information on how to contact you by electronic and paper mail.
-
- If your software can interact with users remotely through a computer
-network, you should also make sure that it provides a way for users to
-get its source. For example, if your program is a web application, its
-interface could display a "Source" link that leads users to an archive
-of the code. There are many ways you could offer source, and different
-solutions will be better for different programs; see section 13 for the
-specific requirements.
-
- You should also get your employer (if you work as a programmer) or school,
-if any, to sign a "copyright disclaimer" for the program, if necessary.
-For more information on this, and how to apply and follow the GNU AGPL, see
-.
diff --git a/yolo26n/README.md b/yolo26n/README.md
deleted file mode 100644
index 29baff36215afe82b6ac2154efb7439ce3251665..0000000000000000000000000000000000000000
--- a/yolo26n/README.md
+++ /dev/null
@@ -1,60 +0,0 @@
-# YOLO26n TFLite Conversion
-
-YOLO26n is the nano detection model from [Ultralytics](https://github.com/ultralytics/ultralytics). It has an **NMS-free** ("end-to-end") head, so its output is a single `[1, 300, 6]` tensor of already-decoded detections — `[x1, y1, x2, y2, conf, class_id]` per row — and no post-NMS step is needed.
-
-The box coordinates are in **letterboxed-input pixel space** (`0…640`), which the demo maps back to the original image.
-
-## Prerequisites
-
-### Python environment
-
-The `.pt` → TFLite conversion uses Ultralytics. Python **3.10** was used.
-
-```bash
-conda create -n python=3.10 -y
-conda activate
-pip install "ultralytics==8.4.90" "torch==2.12.1" "torchvision==0.27.1" \
- "tensorflow==2.21.0" "ai-edge-litert==2.1.5"
-```
-
-These are the exact versions used to produce the provided `yolo26n.tflite` (Python `3.10.20`). `tensorflow` is required for the TFLite export, and `torchvision` must match `torch` (0.27.1 ↔ 2.12.1).
-
----
-
-## Conversion of YOLO26n to TFLite
-
-The `yolo26n.pt` checkpoint is downloaded automatically by Ultralytics on first use.
-
-```bash
-# CLI
-yolo export model=yolo26n.pt format=tflite imgsz=640
-```
-
-or equivalently with the Python API:
-
-```python
-from ultralytics import YOLO
-YOLO("yolo26n.pt").export(format="tflite", imgsz=640)
-```
-
-Ultralytics writes the export artifacts to `yolo26n_saved_model/`; the float32 model is `yolo26n_saved_model/yolo26n_float32.tflite`. Copy/rename it to `yolo26n.tflite` (the name the demo expects).
-
----
-
-## Usage
-
-A demo script is provided to run inference using OpenCV DNN:
-
-```bash
-python demo.py --model yolo26n.tflite --image example_outputs/input.jpg --output example_outputs/yolo26n_output.jpg
-```
-
-`demo.py` uses only OpenCV's dnn module (`cv2.dnn.readNet`). It letterboxes the input to 640x640 (aspect-preserving resize + centered 114-pad, matching `ultralytics.data.augment.LetterBox`), runs the network, decodes the NMS-free `[1, 300, 6]` head (each row is a final detection; boxes mapped back through the inverse letterbox — no post-NMS needed), prints the detected COCO classes / confidences / bounding boxes, and saves an annotated output image. It also handles the classic (v5/v8-style) `[1, 4+nc, num_anchors]` head, so the same script works for other exported YOLO `.tflite` models.
-
-On the provided `example_outputs/input.jpg` it detects `bicycle`, `dog` and `truck`.
-
----
-
-## License
-
-YOLO26n weights and the Ultralytics exporter are released under **AGPL-3.0** — see the [Ultralytics LICENSE](https://github.com/ultralytics/ultralytics/blob/main/LICENSE). Any redistribution of the converted `yolo26n.tflite` is subject to those terms.
diff --git a/yolo26n/demo.py b/yolo26n/demo.py
deleted file mode 100644
index a0bcd0bdd8e97e55f16b863f44e807a85064a701..0000000000000000000000000000000000000000
--- a/yolo26n/demo.py
+++ /dev/null
@@ -1,142 +0,0 @@
-"""
-Demo script for YOLO26n TFLite model using OpenCV DNN.
-
-Output format:
- - single tensor [1, 300, 6] -> [x1, y1, x2, y2, conf, class_id] per detection
- (NMS-free head, already decoded, no post-NMS needed)
-
-Default input size: 640x640 (letterboxed, matching ultralytics.data.augment.LetterBox).
-
-Also handles the classic (v5/v8) [1, 4+nc, num_anchors] head, so the same script works
-for other exported YOLO .tflite models.
-
-Usage:
- python demo.py --model yolo26n.tflite --image example_outputs/input.jpg --output example_outputs/yolo26n_output.jpg
-"""
-
-import argparse
-import cv2
-import numpy as np
-
-
-COCO = [
- "person", "bicycle", "car", "motorbike", "aeroplane", "bus", "train", "truck", "boat", "traffic light",
- "fire hydrant", "stop sign", "parking meter", "bench", "bird", "cat", "dog", "horse", "sheep", "cow",
- "elephant", "bear", "zebra", "giraffe", "backpack", "umbrella", "handbag", "tie", "suitcase", "frisbee",
- "skis", "snowboard", "sports ball", "kite", "baseball bat", "baseball glove", "skateboard", "surfboard", "tennis racket", "bottle",
- "wine glass", "cup", "fork", "knife", "spoon", "bowl", "banana", "apple", "sandwich", "orange",
- "broccoli", "carrot", "hot dog", "pizza", "donut", "cake", "chair", "sofa", "pottedplant", "bed",
- "diningtable", "toilet", "tvmonitor", "laptop", "mouse", "remote", "keyboard", "cell phone", "microwave", "oven",
- "toaster", "sink", "refrigerator", "book", "clock", "vase", "scissors", "teddy bear", "hair drier", "toothbrush",
-]
-
-PAD_COLOR = (114, 114, 114)
-
-
-def letterbox(img, new_h, new_w):
- """Aspect-preserving resize + centered pad (Ultralytics LetterBox defaults, pad=114)."""
- h0, w0 = img.shape[:2]
- ratio = min(new_h / h0, new_w / w0)
- unpad_w, unpad_h = round(w0 * ratio), round(h0 * ratio)
- dw, dh = (new_w - unpad_w) / 2.0, (new_h - unpad_h) / 2.0
- top, bottom = round(dh - 0.1), round(dh + 0.1)
- left, right = round(dw - 0.1), round(dw + 0.1)
- if (unpad_w, unpad_h) != (w0, h0):
- img = cv2.resize(img, (unpad_w, unpad_h), interpolation=cv2.INTER_LINEAR)
- padded = cv2.copyMakeBorder(img, top, bottom, left, right, cv2.BORDER_CONSTANT, value=PAD_COLOR)
- return padded, ratio, left, top
-
-
-def unletterbox(x, y, ratio, pad_x, pad_y):
- return (x - pad_x) / ratio, (y - pad_y) / ratio
-
-
-def is_nms_free_head(shape):
- # v10/26-style heads emit a fixed 300 already-decoded detections with a small row width.
- return len(shape) == 3 and shape[1] == 300 and shape[2] < shape[1]
-
-
-def decode_classic_head(out, net_w, net_h, ratio, pad_x, pad_y, conf_thresh):
- # out: (1, 4+nc, num_anchors) -> (num_anchors, 4+nc)
- pred = out.reshape(out.shape[1], -1).T
- cls_scores = pred[:, 4:]
- class_ids = np.argmax(cls_scores, axis=1)
- confs = cls_scores[np.arange(cls_scores.shape[0]), class_ids]
- keep = confs >= conf_thresh
- pred, class_ids, confs = pred[keep], class_ids[keep], confs[keep]
-
- boxes = []
- for row in pred:
- # normalized [0,1] of the letterboxed input -> original-image pixels
- cx, cy, bw, bh = row[0] * net_w, row[1] * net_h, row[2] * net_w, row[3] * net_h
- x1, y1 = unletterbox(cx - bw / 2.0, cy - bh / 2.0, ratio, pad_x, pad_y)
- x2, y2 = unletterbox(cx + bw / 2.0, cy + bh / 2.0, ratio, pad_x, pad_y)
- boxes.append([x1, y1, x2 - x1, y2 - y1])
- return boxes, confs.tolist(), class_ids.tolist()
-
-
-def decode_nms_free_head(out, ratio, pad_x, pad_y, conf_thresh):
- # out: (1, 300, 6+) -- [x1, y1, x2, y2, conf, class_id, ...]; coords in letterboxed pixels
- dets = out.reshape(out.shape[1], -1)
- boxes, scores, class_ids = [], [], []
- for row in dets:
- if row[4] < conf_thresh:
- continue
- x1, y1 = unletterbox(row[0], row[1], ratio, pad_x, pad_y)
- x2, y2 = unletterbox(row[2], row[3], ratio, pad_x, pad_y)
- boxes.append([x1, y1, x2 - x1, y2 - y1])
- scores.append(float(row[4]))
- class_ids.append(int(row[5]))
- return boxes, scores, class_ids
-
-
-def main():
- parser = argparse.ArgumentParser(description="YOLO TFLite demo (OpenCV DNN)")
- parser.add_argument("--model", required=True, help="Path to TFLite model")
- parser.add_argument("--image", default="example_outputs/input.jpg", help="Path to input image")
- parser.add_argument("--output", default="output.jpg", help="Path for annotated output")
- parser.add_argument("--input-size", type=int, default=640, help="Model input size (W=H)")
- parser.add_argument("--conf", type=float, default=0.5, help="Confidence threshold")
- parser.add_argument("--nms", type=float, default=0.45, help="NMS IoU threshold")
- args = parser.parse_args()
-
- img = cv2.imread(args.image)
- if img is None:
- raise FileNotFoundError(f"Cannot read image: {args.image}")
-
- net = cv2.dnn.readNet(args.model)
-
- imgsz = args.input_size
- padded, ratio, pad_x, pad_y = letterbox(img, imgsz, imgsz)
- blob = cv2.dnn.blobFromImage(padded, 1.0 / 255.0, (imgsz, imgsz), swapRB=True, crop=False)
- net.setInput(blob)
- outs = net.forward(net.getUnconnectedOutLayersNames())
- print("outputs:", [o.shape for o in outs])
-
- # Pick the detection head: the output with the largest last dimension.
- det = max(outs, key=lambda o: o.shape[-1] if o.ndim == 3 else -1)
-
- if is_nms_free_head(det.shape):
- boxes, scores, class_ids = decode_nms_free_head(det, ratio, pad_x, pad_y, args.conf)
- keep = list(range(len(boxes)))
- else:
- boxes, scores, class_ids = decode_classic_head(det, imgsz, imgsz, ratio, pad_x, pad_y, args.conf)
- keep = cv2.dnn.NMSBoxesBatched(boxes, scores, class_ids, args.conf, args.nms)
- keep = np.array(keep).flatten().tolist()
-
- out = img.copy()
- for idx in keep:
- x, y, w, h = (int(v) for v in boxes[idx])
- cls = COCO[class_ids[idx]] if 0 <= class_ids[idx] < 80 else str(class_ids[idx])
- label = f"{cls} {scores[idx]:.2f}"
- cv2.rectangle(out, (x, y), (x + w, y + h), (0, 255, 0), 2)
- cv2.putText(out, label, (x, max(15, y - 5)), cv2.FONT_HERSHEY_SIMPLEX, 0.6, (0, 255, 0), 2)
- print(f" {label} box=[{x},{y},{w},{h}]")
-
- print(f"{len(keep)} detections above conf {args.conf}")
- cv2.imwrite(args.output, out)
- print(f"Saved annotated image: {args.output}")
-
-
-if __name__ == "__main__":
- main()
diff --git a/yolo26n/example_outputs/input.jpg b/yolo26n/example_outputs/input.jpg
deleted file mode 100644
index 4b37071c4b38a5112c700e7a3d46ebb351d9b494..0000000000000000000000000000000000000000
--- a/yolo26n/example_outputs/input.jpg
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:5a9522051c3cec2bbd2f6323fccba32e8fbf3ddcc2b3e2fd46b04c720bc6f866
-size 163759
diff --git a/yolo26n/example_outputs/yolo26n_output.jpg b/yolo26n/example_outputs/yolo26n_output.jpg
deleted file mode 100644
index 8ffe5adc90735b38fd191feb1b154c3659c51321..0000000000000000000000000000000000000000
--- a/yolo26n/example_outputs/yolo26n_output.jpg
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:2720421ea86760b276ffc9e9c22ef86fae303855a8cf4744e1b9373a805691ec
-size 183300
diff --git a/yolo26n/yolo26n.tflite b/yolo26n/yolo26n.tflite
deleted file mode 100644
index f8e08dc30253b85040dc0bb07a5c8280ae7e4d2e..0000000000000000000000000000000000000000
--- a/yolo26n/yolo26n.tflite
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:73cfa2b590580be36c3d0b4f606fca9459dc1399e626e9104d9e45ab601d91ff
-size 10274278
diff --git a/yolov3/LICENSE b/yolov3/LICENSE
deleted file mode 100644
index d645695673349e3947e8e5ae42332d0ac3164cd7..0000000000000000000000000000000000000000
--- a/yolov3/LICENSE
+++ /dev/null
@@ -1,202 +0,0 @@
-
- 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
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- 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.
diff --git a/yolov3/README.md b/yolov3/README.md
deleted file mode 100644
index c32e4c9938b876c2f5da5ca7605e267f131f31c9..0000000000000000000000000000000000000000
--- a/yolov3/README.md
+++ /dev/null
@@ -1,79 +0,0 @@
-# YOLOv3 ONNX Conversion
-
-## Prerequisites
-
-### 1. Model files (cfg + weights)
-
-The Darknet `.cfg` file is already provided in [opencv_extra/testdata/dnn](https://github.com/opencv/opencv_extra/tree/master/testdata/dnn) (`yolov3.cfg`).
-
-Download the `.weights` file using the OpenCV test data download script:
-
-```bash
-git clone https://github.com/opencv/opencv_extra.git
-cd opencv_extra/testdata/dnn
-python download_models.py YOLOv3
-```
-
-### 2. Python environment for `pytorch-YOLOv4`
-
-The conversion uses [`pytorch-YOLOv4`](https://github.com/Tianxiaomo/pytorch-YOLOv4). Create a Python environment with the required dependencies:
-
-Supported Python versions: **3.8 – 3.10**.
-
-```bash
-conda create -n python=<3.8-3.10> -y
-conda activate
-pip install "torch<2.4" "torchvision<0.19" "numpy<2" onnx onnxruntime "onnxscript==0.1.0"
-```
-
----
-
-## Conversion of YOLOv3 to ONNX
-
-### Why it requires a patch
-
-The original YOLOv3 `.cfg` does not contain the `scale_x_y` field (introduced in YOLOv4). The `pytorch-YOLOv4` converter requires this field unconditionally, causing a `KeyError` when converting YOLOv3. The fix is to default `scale_x_y` to `1.0` when the field is absent.
-
-### The Fix (modified script provided)
-
-A patched version of **`darknet2pytorch.py`** is provided in this repository. It adds a default value for `scale_x_y` when the field is absent:
-
-```python
-# changed line in tool/darknet2pytorch.py
-yolo_layer.scale_x_y = float(block.get('scale_x_y', 1.0))
-```
-
-### Conversion Steps
-
-```bash
-git clone https://github.com/Tianxiaomo/pytorch-YOLOv4.git
-cd pytorch-YOLOv4
-
-# [!] Replace tool/darknet2pytorch.py with the patched version from this repository
-# before running the conversion.
-
-# Convert YOLOv3 (dynamic batch, batch_size=0)
-python -c "from tool.darknet2onnx import transform_to_onnx; transform_to_onnx('yolov3.cfg', 'yolov3.weights', 0)"
-```
-
-The output file will be named `yolov4_-1_3_416_416_dynamic.onnx` (the script uses `yolov4` as the default prefix regardless of input model).
-
----
-
-## Usage
-
-A demo script is provided to run inference using OpenCV DNN:
-
-```bash
-python demo.py --model yolov3.onnx \
- --image example_outputs/input.jpg \
- --output example_outputs/yolov3_output.jpg
-```
-
-The demo prints the detected COCO classes, confidence scores, and bounding boxes, and saves an annotated output image.
-
----
-
-## License
-
-See [LICENSE](./LICENSE) — This conversion tool is based on [pytorch-YOLOv4](https://github.com/Tianxiaomo/pytorch-YOLOv4) (Apache-2.0). Original YOLOv3 model weights and configuration are released by Joseph Redmon ([pjreddie/darknet](https://github.com/pjreddie/darknet)).
diff --git a/yolov3/darknet2pytorch.py b/yolov3/darknet2pytorch.py
deleted file mode 100644
index 3f636718225b9ae946e366da419440cbf40017a5..0000000000000000000000000000000000000000
--- a/yolov3/darknet2pytorch.py
+++ /dev/null
@@ -1,536 +0,0 @@
-import torch.nn as nn
-import torch.nn.functional as F
-import numpy as np
-from tool.region_loss import RegionLoss
-from tool.yolo_layer import YoloLayer
-from tool.config import *
-from tool.torch_utils import *
-
-
-class Mish(torch.nn.Module):
- def __init__(self):
- super().__init__()
-
- def forward(self, x):
- x = x * (torch.tanh(torch.nn.functional.softplus(x)))
- return x
-
-
-class MaxPoolDark(nn.Module):
- def __init__(self, size=2, stride=1):
- super(MaxPoolDark, self).__init__()
- self.size = size
- self.stride = stride
-
- def forward(self, x):
- '''
- darknet output_size = (input_size + p - k) / s +1
- p : padding = k - 1
- k : size
- s : stride
- torch output_size = (input_size + 2*p -k) / s +1
- p : padding = k//2
- '''
- p = self.size // 2
- if ((x.shape[2] - 1) // self.stride) != ((x.shape[2] + 2 * p - self.size) // self.stride):
- padding1 = (self.size - 1) // 2
- padding2 = padding1 + 1
- else:
- padding1 = (self.size - 1) // 2
- padding2 = padding1
- if ((x.shape[3] - 1) // self.stride) != ((x.shape[3] + 2 * p - self.size) // self.stride):
- padding3 = (self.size - 1) // 2
- padding4 = padding3 + 1
- else:
- padding3 = (self.size - 1) // 2
- padding4 = padding3
- x = F.max_pool2d(F.pad(x, (padding3, padding4, padding1, padding2), mode='replicate'),
- self.size, stride=self.stride)
- return x
-
-
-class Upsample_expand(nn.Module):
- def __init__(self, stride=2):
- super(Upsample_expand, self).__init__()
- self.stride = stride
-
- def forward(self, x):
- assert (x.data.dim() == 4)
-
- x = x.view(x.size(0), x.size(1), x.size(2), 1, x.size(3), 1).\
- expand(x.size(0), x.size(1), x.size(2), self.stride, x.size(3), self.stride).contiguous().\
- view(x.size(0), x.size(1), x.size(2) * self.stride, x.size(3) * self.stride)
-
- return x
-
-
-class Upsample_interpolate(nn.Module):
- def __init__(self, stride):
- super(Upsample_interpolate, self).__init__()
- self.stride = stride
-
- def forward(self, x):
- assert (x.data.dim() == 4)
-
- out = F.interpolate(x, size=(x.size(2) * self.stride, x.size(3) * self.stride), mode='nearest')
- return out
-
-
-class Reorg(nn.Module):
- def __init__(self, stride=2):
- super(Reorg, self).__init__()
- self.stride = stride
-
- def forward(self, x):
- stride = self.stride
- assert (x.data.dim() == 4)
- B = x.data.size(0)
- C = x.data.size(1)
- H = x.data.size(2)
- W = x.data.size(3)
- assert (H % stride == 0)
- assert (W % stride == 0)
- ws = stride
- hs = stride
- x = x.view(B, C, H / hs, hs, W / ws, ws).transpose(3, 4).contiguous()
- x = x.view(B, C, H / hs * W / ws, hs * ws).transpose(2, 3).contiguous()
- x = x.view(B, C, hs * ws, H / hs, W / ws).transpose(1, 2).contiguous()
- x = x.view(B, hs * ws * C, H / hs, W / ws)
- return x
-
-
-class GlobalAvgPool2d(nn.Module):
- def __init__(self):
- super(GlobalAvgPool2d, self).__init__()
-
- def forward(self, x):
- N = x.data.size(0)
- C = x.data.size(1)
- H = x.data.size(2)
- W = x.data.size(3)
- x = F.avg_pool2d(x, (H, W))
- x = x.view(N, C)
- return x
-
-
-# for route, shortcut and sam
-class EmptyModule(nn.Module):
- def __init__(self):
- super(EmptyModule, self).__init__()
-
- def forward(self, x):
- return x
-
-
-# support route shortcut and reorg
-class Darknet(nn.Module):
- def __init__(self, cfgfile, inference=False):
- super(Darknet, self).__init__()
- self.inference = inference
- self.training = not self.inference
-
- self.blocks = parse_cfg(cfgfile)
- self.width = int(self.blocks[0]['width'])
- self.height = int(self.blocks[0]['height'])
-
- self.models = self.create_network(self.blocks) # merge conv, bn,leaky
- self.loss = self.models[len(self.models) - 1]
-
- if self.blocks[(len(self.blocks) - 1)]['type'] == 'region':
- self.anchors = self.loss.anchors
- self.num_anchors = self.loss.num_anchors
- self.anchor_step = self.loss.anchor_step
- self.num_classes = self.loss.num_classes
-
- self.header = torch.IntTensor([0, 0, 0, 0])
- self.seen = 0
-
- def forward(self, x):
- ind = -2
- self.loss = None
- outputs = dict()
- out_boxes = []
- for block in self.blocks:
- ind = ind + 1
- # if ind > 0:
- # return x
-
- if block['type'] == 'net':
- continue
- elif block['type'] in ['convolutional', 'maxpool', 'reorg', 'upsample', 'avgpool', 'softmax', 'connected']:
- x = self.models[ind](x)
- outputs[ind] = x
- elif block['type'] == 'route':
- layers = block['layers'].split(',')
- layers = [int(i) if int(i) > 0 else int(i) + ind for i in layers]
- if len(layers) == 1:
- if 'groups' not in block.keys() or int(block['groups']) == 1:
- x = outputs[layers[0]]
- outputs[ind] = x
- else:
- groups = int(block['groups'])
- group_id = int(block['group_id'])
- _, b, _, _ = outputs[layers[0]].shape
- x = outputs[layers[0]][:, b // groups * group_id:b // groups * (group_id + 1)]
- outputs[ind] = x
- elif len(layers) == 2:
- x1 = outputs[layers[0]]
- x2 = outputs[layers[1]]
- x = torch.cat((x1, x2), 1)
- outputs[ind] = x
- elif len(layers) == 4:
- x1 = outputs[layers[0]]
- x2 = outputs[layers[1]]
- x3 = outputs[layers[2]]
- x4 = outputs[layers[3]]
- x = torch.cat((x1, x2, x3, x4), 1)
- outputs[ind] = x
- else:
- print("rounte number > 2 ,is {}".format(len(layers)))
-
- elif block['type'] == 'shortcut':
- from_layer = int(block['from'])
- activation = block['activation']
- from_layer = from_layer if from_layer > 0 else from_layer + ind
- x1 = outputs[from_layer]
- x2 = outputs[ind - 1]
- x = x1 + x2
- if activation == 'leaky':
- x = F.leaky_relu(x, 0.1, inplace=True)
- elif activation == 'relu':
- x = F.relu(x, inplace=True)
- outputs[ind] = x
- elif block['type'] == 'sam':
- from_layer = int(block['from'])
- from_layer = from_layer if from_layer > 0 else from_layer + ind
- x1 = outputs[from_layer]
- x2 = outputs[ind - 1]
- x = x1 * x2
- outputs[ind] = x
- elif block['type'] == 'region':
- continue
- if self.loss:
- self.loss = self.loss + self.models[ind](x)
- else:
- self.loss = self.models[ind](x)
- outputs[ind] = None
- elif block['type'] == 'yolo':
- # if self.training:
- # pass
- # else:
- # boxes = self.models[ind](x)
- # out_boxes.append(boxes)
- boxes = self.models[ind](x)
- out_boxes.append(boxes)
- elif block['type'] == 'cost':
- continue
- else:
- print('unknown type %s' % (block['type']))
-
- if self.training:
- return out_boxes
- else:
- return get_region_boxes(out_boxes)
-
- def print_network(self):
- print_cfg(self.blocks)
-
- def create_network(self, blocks):
- models = nn.ModuleList()
-
- prev_filters = 3
- out_filters = []
- prev_stride = 1
- out_strides = []
- conv_id = 0
- for block in blocks:
- if block['type'] == 'net':
- prev_filters = int(block['channels'])
- continue
- elif block['type'] == 'convolutional':
- conv_id = conv_id + 1
- batch_normalize = int(block['batch_normalize'])
- filters = int(block['filters'])
- kernel_size = int(block['size'])
- stride = int(block['stride'])
- is_pad = int(block['pad'])
- pad = (kernel_size - 1) // 2 if is_pad else 0
- activation = block['activation']
- model = nn.Sequential()
- if batch_normalize:
- model.add_module('conv{0}'.format(conv_id),
- nn.Conv2d(prev_filters, filters, kernel_size, stride, pad, bias=False))
- model.add_module('bn{0}'.format(conv_id), nn.BatchNorm2d(filters))
- # model.add_module('bn{0}'.format(conv_id), BN2d(filters))
- else:
- model.add_module('conv{0}'.format(conv_id),
- nn.Conv2d(prev_filters, filters, kernel_size, stride, pad))
- if activation == 'leaky':
- model.add_module('leaky{0}'.format(conv_id), nn.LeakyReLU(0.1, inplace=True))
- elif activation == 'relu':
- model.add_module('relu{0}'.format(conv_id), nn.ReLU(inplace=True))
- elif activation == 'mish':
- model.add_module('mish{0}'.format(conv_id), Mish())
- elif activation == 'linear':
- model.add_module('linear{0}'.format(conv_id), nn.Identity())
- elif activation == 'logistic':
- model.add_module('sigmoid{0}'.format(conv_id), nn.Sigmoid())
- else:
- print("No convolutional activation named {}".format(activation))
-
- prev_filters = filters
- out_filters.append(prev_filters)
- prev_stride = stride * prev_stride
- out_strides.append(prev_stride)
- models.append(model)
- elif block['type'] == 'maxpool':
- pool_size = int(block['size'])
- stride = int(block['stride'])
- if stride == 1 and pool_size % 2:
- # You can use Maxpooldark instead, here is convenient to convert onnx.
- # Example: [maxpool] size=3 stride=1
- model = nn.MaxPool2d(kernel_size=pool_size, stride=stride, padding=pool_size // 2)
- elif stride == pool_size:
- # You can use Maxpooldark instead, here is convenient to convert onnx.
- # Example: [maxpool] size=2 stride=2
- model = nn.MaxPool2d(kernel_size=pool_size, stride=stride, padding=0)
- else:
- model = MaxPoolDark(pool_size, stride)
- out_filters.append(prev_filters)
- prev_stride = stride * prev_stride
- out_strides.append(prev_stride)
- models.append(model)
- elif block['type'] == 'avgpool':
- model = GlobalAvgPool2d()
- out_filters.append(prev_filters)
- models.append(model)
- elif block['type'] == 'softmax':
- model = nn.Softmax()
- out_strides.append(prev_stride)
- out_filters.append(prev_filters)
- models.append(model)
- elif block['type'] == 'cost':
- if block['_type'] == 'sse':
- model = nn.MSELoss(reduction='mean')
- elif block['_type'] == 'L1':
- model = nn.L1Loss(reduction='mean')
- elif block['_type'] == 'smooth':
- model = nn.SmoothL1Loss(reduction='mean')
- out_filters.append(1)
- out_strides.append(prev_stride)
- models.append(model)
- elif block['type'] == 'reorg':
- stride = int(block['stride'])
- prev_filters = stride * stride * prev_filters
- out_filters.append(prev_filters)
- prev_stride = prev_stride * stride
- out_strides.append(prev_stride)
- models.append(Reorg(stride))
- elif block['type'] == 'upsample':
- stride = int(block['stride'])
- out_filters.append(prev_filters)
- prev_stride = prev_stride // stride
- out_strides.append(prev_stride)
-
- models.append(Upsample_expand(stride))
- # models.append(Upsample_interpolate(stride))
-
- elif block['type'] == 'route':
- layers = block['layers'].split(',')
- ind = len(models)
- layers = [int(i) if int(i) > 0 else int(i) + ind for i in layers]
- if len(layers) == 1:
- if 'groups' not in block.keys() or int(block['groups']) == 1:
- prev_filters = out_filters[layers[0]]
- prev_stride = out_strides[layers[0]]
- else:
- prev_filters = out_filters[layers[0]] // int(block['groups'])
- prev_stride = out_strides[layers[0]] // int(block['groups'])
- elif len(layers) == 2:
- assert (layers[0] == ind - 1 or layers[1] == ind - 1)
- prev_filters = out_filters[layers[0]] + out_filters[layers[1]]
- prev_stride = out_strides[layers[0]]
- elif len(layers) == 4:
- assert (layers[0] == ind - 1)
- prev_filters = out_filters[layers[0]] + out_filters[layers[1]] + out_filters[layers[2]] + \
- out_filters[layers[3]]
- prev_stride = out_strides[layers[0]]
- else:
- print("route error!!!")
-
- out_filters.append(prev_filters)
- out_strides.append(prev_stride)
- models.append(EmptyModule())
- elif block['type'] == 'shortcut':
- ind = len(models)
- prev_filters = out_filters[ind - 1]
- out_filters.append(prev_filters)
- prev_stride = out_strides[ind - 1]
- out_strides.append(prev_stride)
- models.append(EmptyModule())
- elif block['type'] == 'sam':
- ind = len(models)
- prev_filters = out_filters[ind - 1]
- out_filters.append(prev_filters)
- prev_stride = out_strides[ind - 1]
- out_strides.append(prev_stride)
- models.append(EmptyModule())
- elif block['type'] == 'connected':
- filters = int(block['output'])
- if block['activation'] == 'linear':
- model = nn.Linear(prev_filters, filters)
- elif block['activation'] == 'leaky':
- model = nn.Sequential(
- nn.Linear(prev_filters, filters),
- nn.LeakyReLU(0.1, inplace=True))
- elif block['activation'] == 'relu':
- model = nn.Sequential(
- nn.Linear(prev_filters, filters),
- nn.ReLU(inplace=True))
- prev_filters = filters
- out_filters.append(prev_filters)
- out_strides.append(prev_stride)
- models.append(model)
- elif block['type'] == 'region':
- loss = RegionLoss()
- anchors = block['anchors'].split(',')
- loss.anchors = [float(i) for i in anchors]
- loss.num_classes = int(block['classes'])
- loss.num_anchors = int(block['num'])
- loss.anchor_step = len(loss.anchors) // loss.num_anchors
- loss.object_scale = float(block['object_scale'])
- loss.noobject_scale = float(block['noobject_scale'])
- loss.class_scale = float(block['class_scale'])
- loss.coord_scale = float(block['coord_scale'])
- out_filters.append(prev_filters)
- out_strides.append(prev_stride)
- models.append(loss)
- elif block['type'] == 'yolo':
- yolo_layer = YoloLayer()
- anchors = block['anchors'].split(',')
- anchor_mask = block['mask'].split(',')
- yolo_layer.anchor_mask = [int(i) for i in anchor_mask]
- yolo_layer.anchors = [float(i) for i in anchors]
- yolo_layer.num_classes = int(block['classes'])
- self.num_classes = yolo_layer.num_classes
- yolo_layer.num_anchors = int(block['num'])
- yolo_layer.anchor_step = len(yolo_layer.anchors) // yolo_layer.num_anchors
- yolo_layer.stride = prev_stride
- yolo_layer.scale_x_y = float(block.get('scale_x_y', 1.0))
- # yolo_layer.object_scale = float(block['object_scale'])
- # yolo_layer.noobject_scale = float(block['noobject_scale'])
- # yolo_layer.class_scale = float(block['class_scale'])
- # yolo_layer.coord_scale = float(block['coord_scale'])
- out_filters.append(prev_filters)
- out_strides.append(prev_stride)
- models.append(yolo_layer)
- else:
- print('unknown type %s' % (block['type']))
-
- return models
-
- def load_weights(self, weightfile):
- fp = open(weightfile, 'rb')
- header = np.fromfile(fp, count=5, dtype=np.int32)
- self.header = torch.from_numpy(header)
- self.seen = self.header[3]
- buf = np.fromfile(fp, dtype=np.float32)
- fp.close()
-
- start = 0
- ind = -2
- for block in self.blocks:
- if start >= buf.size:
- break
- ind = ind + 1
- if block['type'] == 'net':
- continue
- elif block['type'] == 'convolutional':
- model = self.models[ind]
- batch_normalize = int(block['batch_normalize'])
- if batch_normalize:
- start = load_conv_bn(buf, start, model[0], model[1])
- else:
- start = load_conv(buf, start, model[0])
- elif block['type'] == 'connected':
- model = self.models[ind]
- if block['activation'] != 'linear':
- start = load_fc(buf, start, model[0])
- else:
- start = load_fc(buf, start, model)
- elif block['type'] == 'maxpool':
- pass
- elif block['type'] == 'reorg':
- pass
- elif block['type'] == 'upsample':
- pass
- elif block['type'] == 'route':
- pass
- elif block['type'] == 'shortcut':
- pass
- elif block['type'] == 'sam':
- pass
- elif block['type'] == 'region':
- pass
- elif block['type'] == 'yolo':
- pass
- elif block['type'] == 'avgpool':
- pass
- elif block['type'] == 'softmax':
- pass
- elif block['type'] == 'cost':
- pass
- else:
- print('unknown type %s' % (block['type']))
-
- # def save_weights(self, outfile, cutoff=0):
- # if cutoff <= 0:
- # cutoff = len(self.blocks) - 1
- #
- # fp = open(outfile, 'wb')
- # self.header[3] = self.seen
- # header = self.header
- # header.numpy().tofile(fp)
- #
- # ind = -1
- # for blockId in range(1, cutoff + 1):
- # ind = ind + 1
- # block = self.blocks[blockId]
- # if block['type'] == 'convolutional':
- # model = self.models[ind]
- # batch_normalize = int(block['batch_normalize'])
- # if batch_normalize:
- # save_conv_bn(fp, model[0], model[1])
- # else:
- # save_conv(fp, model[0])
- # elif block['type'] == 'connected':
- # model = self.models[ind]
- # if block['activation'] != 'linear':
- # save_fc(fc, model)
- # else:
- # save_fc(fc, model[0])
- # elif block['type'] == 'maxpool':
- # pass
- # elif block['type'] == 'reorg':
- # pass
- # elif block['type'] == 'upsample':
- # pass
- # elif block['type'] == 'route':
- # pass
- # elif block['type'] == 'shortcut':
- # pass
- # elif block['type'] == 'sam':
- # pass
- # elif block['type'] == 'region':
- # pass
- # elif block['type'] == 'yolo':
- # pass
- # elif block['type'] == 'avgpool':
- # pass
- # elif block['type'] == 'softmax':
- # pass
- # elif block['type'] == 'cost':
- # pass
- # else:
- # print('unknown type %s' % (block['type']))
- # fp.close()
diff --git a/yolov3/demo.py b/yolov3/demo.py
deleted file mode 100644
index dcb69e52d97da1b9d3848642f43cadb6f055c331..0000000000000000000000000000000000000000
--- a/yolov3/demo.py
+++ /dev/null
@@ -1,129 +0,0 @@
-"""
-Demo script for YOLOv3 ONNX model using OpenCV DNN.
-
-Output format:
- - boxes: [batch, N, 1, 4] -> [x1, y1, x2, y2] normalized to [0, 1]
- - confs: [batch, N, num_classes]
-
-Default input size: 416x416
-
-Usage:
- python demo.py --image example_outputs/input.jpg --output result.jpg
-"""
-
-import argparse
-import cv2
-import numpy as np
-
-
-COCO_CLASSES = [
- "person", "bicycle", "car", "motorcycle", "airplane", "bus", "train", "truck",
- "boat", "traffic light", "fire hydrant", "stop sign", "parking meter", "bench",
- "bird", "cat", "dog", "horse", "sheep", "cow", "elephant", "bear", "zebra",
- "giraffe", "backpack", "umbrella", "handbag", "tie", "suitcase", "frisbee",
- "skis", "snowboard", "sports ball", "kite", "baseball bat", "baseball glove",
- "skateboard", "surfboard", "tennis racket", "bottle", "wine glass", "cup",
- "fork", "knife", "spoon", "bowl", "banana", "apple", "sandwich", "orange",
- "broccoli", "carrot", "hot dog", "pizza", "donut", "cake", "chair", "couch",
- "potted plant", "bed", "dining table", "toilet", "tv", "laptop", "mouse",
- "remote", "keyboard", "cell phone", "microwave", "oven", "toaster", "sink",
- "refrigerator", "book", "clock", "vase", "scissors", "teddy bear", "hair drier",
- "toothbrush",
-]
-
-
-def postprocess(outputs, conf_threshold, nms_threshold):
- """Parse [boxes, confs] outputs and run NMS."""
- boxes_raw = outputs[0].reshape(-1, 4)
- confs_raw = outputs[1].reshape(boxes_raw.shape[0], -1)
-
- class_ids = []
- confidences = []
- boxes_xywh = []
-
- for j in range(boxes_raw.shape[0]):
- cls_id = int(np.argmax(confs_raw[j]))
- score = float(confs_raw[j][cls_id])
- if score >= conf_threshold:
- x1, y1, x2, y2 = boxes_raw[j]
- class_ids.append(cls_id)
- confidences.append(score)
- boxes_xywh.append([float(x1), float(y1), float(x2 - x1), float(y2 - y1)])
-
- if not boxes_xywh:
- return []
-
- indices = cv2.dnn.NMSBoxes(boxes_xywh, confidences, conf_threshold, nms_threshold)
- if len(indices) == 0:
- return []
- indices = np.array(indices).flatten()
-
- detections = []
- for i in indices:
- x, y, w, h = boxes_xywh[i]
- detections.append((class_ids[i], confidences[i], [x, y, x + w, y + h]))
- return detections
-
-
-def draw_detections(image, detections, output_path):
- """Draw bounding boxes and labels on the image."""
- out = image.copy()
- h, w = out.shape[:2]
- for cls_id, score, (x1, y1, x2, y2) in detections:
- px1, py1 = int(x1 * w), int(y1 * h)
- px2, py2 = int(x2 * w), int(y2 * h)
- label = f"{COCO_CLASSES[cls_id]} {score:.2f}"
- cv2.rectangle(out, (px1, py1), (px2, py2), (0, 0, 255), 2)
- (tw, th), _ = cv2.getTextSize(label, cv2.FONT_HERSHEY_SIMPLEX, 0.6, 2)
- cv2.rectangle(out, (px1, py1 - th - 6), (px1 + tw + 4, py1), (0, 0, 255), -1)
- cv2.putText(out, label, (px1 + 2, py1 - 4), cv2.FONT_HERSHEY_SIMPLEX,
- 0.6, (255, 255, 255), 2, cv2.LINE_AA)
- cv2.imwrite(output_path, out)
- print(f"Saved annotated image: {output_path}")
-
-
-def main():
- parser = argparse.ArgumentParser(description="YOLOv3 ONNX demo (OpenCV DNN)")
- parser.add_argument("--model", default="yolov3.onnx", help="Path to ONNX model")
- parser.add_argument("--image", default="example_outputs/input.jpg", help="Path to input image")
- parser.add_argument("--output", default="output.jpg", help="Path for annotated output")
- parser.add_argument("--input-size", type=int, default=416,
- help="Model input size (W=H). Default: 416")
- parser.add_argument("--conf", type=float, default=0.4, help="Confidence threshold")
- parser.add_argument("--nms", type=float, default=0.5, help="NMS IoU threshold")
- args = parser.parse_args()
-
- print(f"Using input size: {args.input_size}x{args.input_size}")
-
- img = cv2.imread(args.image)
- if img is None:
- raise FileNotFoundError(f"Cannot read image: {args.image}")
- print(f"Input image: {args.image} ({img.shape[1]}x{img.shape[0]})")
-
- blob = cv2.dnn.blobFromImage(img, 1.0 / 255.0,
- (args.input_size, args.input_size),
- swapRB=True, crop=False)
- print(f"Blob shape: {blob.shape}")
-
- net = cv2.dnn.readNetFromONNX(args.model)
- net.setPreferableBackend(cv2.dnn.DNN_BACKEND_OPENCV)
- net.setPreferableTarget(cv2.dnn.DNN_TARGET_CPU)
-
- net.setInput(blob)
- out_names = net.getUnconnectedOutLayersNames()
- print(f"Output layer names: {out_names}")
- outputs = net.forward(out_names)
- for name, o in zip(out_names, outputs):
- print(f"Output '{name}' shape: {o.shape}")
-
- detections = postprocess(outputs, args.conf, args.nms)
- print(f"\nDetections (conf >= {args.conf}, after NMS): {len(detections)}")
- for cls_id, score, (x1, y1, x2, y2) in detections:
- print(f" {COCO_CLASSES[cls_id]:15s} score={score:.4f} "
- f"bbox=[{x1:.4f}, {y1:.4f}, {x2:.4f}, {y2:.4f}]")
-
- draw_detections(img, detections, args.output)
-
-
-if __name__ == "__main__":
- main()
diff --git a/yolov3/example_outputs/input.jpg b/yolov3/example_outputs/input.jpg
deleted file mode 100644
index 4b37071c4b38a5112c700e7a3d46ebb351d9b494..0000000000000000000000000000000000000000
--- a/yolov3/example_outputs/input.jpg
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:5a9522051c3cec2bbd2f6323fccba32e8fbf3ddcc2b3e2fd46b04c720bc6f866
-size 163759
diff --git a/yolov3/example_outputs/yolov3_output.jpg b/yolov3/example_outputs/yolov3_output.jpg
deleted file mode 100644
index 8105c1361e8a383fd41d4542c81aaf605a51acee..0000000000000000000000000000000000000000
--- a/yolov3/example_outputs/yolov3_output.jpg
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:d7eef868800e786ca7f6cfbeca2bef3be37fda343ca661658b1d97e8fbc6f246
-size 188032
diff --git a/yolov3/yolov3.onnx b/yolov3/yolov3.onnx
deleted file mode 100644
index 7b167d03e02ee738ff5e5b60bb7f0fba5315c124..0000000000000000000000000000000000000000
--- a/yolov3/yolov3.onnx
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:8f97018524d0752062051732c97da311712df2fca2bbb21d931142017d1b8d53
-size 247918553
diff --git a/yolov5nu/LICENSE b/yolov5nu/LICENSE
deleted file mode 100644
index be3f7b28e564e7dd05eaf59d64adba1a4065ac0e..0000000000000000000000000000000000000000
--- a/yolov5nu/LICENSE
+++ /dev/null
@@ -1,661 +0,0 @@
- GNU AFFERO GENERAL PUBLIC LICENSE
- Version 3, 19 November 2007
-
- Copyright (C) 2007 Free Software Foundation, Inc.
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
- Preamble
-
- The GNU Affero General Public License is a free, copyleft license for
-software and other kinds of works, specifically designed to ensure
-cooperation with the community in the case of network server software.
-
- The licenses for most software and other practical works are designed
-to take away your freedom to share and change the works. By contrast,
-our General Public Licenses are intended to guarantee your freedom to
-share and change all versions of a program--to make sure it remains free
-software for all its users.
-
- When we speak of free software, we are referring to freedom, not
-price. Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-them if you wish), that you receive source code or can get it if you
-want it, that you can change the software or use pieces of it in new
-free programs, and that you know you can do these things.
-
- Developers that use our General Public Licenses protect your rights
-with two steps: (1) assert copyright on the software, and (2) offer
-you this License which gives you legal permission to copy, distribute
-and/or modify the software.
-
- A secondary benefit of defending all users' freedom is that
-improvements made in alternate versions of the program, if they
-receive widespread use, become available for other developers to
-incorporate. Many developers of free software are heartened and
-encouraged by the resulting cooperation. However, in the case of
-software used on network servers, this result may fail to come about.
-The GNU General Public License permits making a modified version and
-letting the public access it on a server without ever releasing its
-source code to the public.
-
- The GNU Affero General Public License is designed specifically to
-ensure that, in such cases, the modified source code becomes available
-to the community. It requires the operator of a network server to
-provide the source code of the modified version running there to the
-users of that server. Therefore, public use of a modified version, on
-a publicly accessible server, gives the public access to the source
-code of the modified version.
-
- An older license, called the Affero General Public License and
-published by Affero, was designed to accomplish similar goals. This is
-a different license, not a version of the Affero GPL, but Affero has
-released a new version of the Affero GPL which permits relicensing under
-this license.
-
- The precise terms and conditions for copying, distribution and
-modification follow.
-
- TERMS AND CONDITIONS
-
- 0. Definitions.
-
- "This License" refers to version 3 of the GNU Affero General Public License.
-
- "Copyright" also means copyright-like laws that apply to other kinds of
-works, such as semiconductor masks.
-
- "The Program" refers to any copyrightable work licensed under this
-License. Each licensee is addressed as "you". "Licensees" and
-"recipients" may be individuals or organizations.
-
- To "modify" a work means to copy from or adapt all or part of the work
-in a fashion requiring copyright permission, other than the making of an
-exact copy. The resulting work is called a "modified version" of the
-earlier work or a work "based on" the earlier work.
-
- A "covered work" means either the unmodified Program or a work based
-on the Program.
-
- To "propagate" a work means to do anything with it that, without
-permission, would make you directly or secondarily liable for
-infringement under applicable copyright law, except executing it on a
-computer or modifying a private copy. Propagation includes copying,
-distribution (with or without modification), making available to the
-public, and in some countries other activities as well.
-
- To "convey" a work means any kind of propagation that enables other
-parties to make or receive copies. Mere interaction with a user through
-a computer network, with no transfer of a copy, is not conveying.
-
- An interactive user interface displays "Appropriate Legal Notices"
-to the extent that it includes a convenient and prominently visible
-feature that (1) displays an appropriate copyright notice, and (2)
-tells the user that there is no warranty for the work (except to the
-extent that warranties are provided), that licensees may convey the
-work under this License, and how to view a copy of this License. If
-the interface presents a list of user commands or options, such as a
-menu, a prominent item in the list meets this criterion.
-
- 1. Source Code.
-
- The "source code" for a work means the preferred form of the work
-for making modifications to it. "Object code" means any non-source
-form of a work.
-
- A "Standard Interface" means an interface that either is an official
-standard defined by a recognized standards body, or, in the case of
-interfaces specified for a particular programming language, one that
-is widely used among developers working in that language.
-
- The "System Libraries" of an executable work include anything, other
-than the work as a whole, that (a) is included in the normal form of
-packaging a Major Component, but which is not part of that Major
-Component, and (b) serves only to enable use of the work with that
-Major Component, or to implement a Standard Interface for which an
-implementation is available to the public in source code form. A
-"Major Component", in this context, means a major essential component
-(kernel, window system, and so on) of the specific operating system
-(if any) on which the executable work runs, or a compiler used to
-produce the work, or an object code interpreter used to run it.
-
- The "Corresponding Source" for a work in object code form means all
-the source code needed to generate, install, and (for an executable
-work) run the object code and to modify the work, including scripts to
-control those activities. However, it does not include the work's
-System Libraries, or general-purpose tools or generally available free
-programs which are used unmodified in performing those activities but
-which are not part of the work. For example, Corresponding Source
-includes interface definition files associated with source files for
-the work, and the source code for shared libraries and dynamically
-linked subprograms that the work is specifically designed to require,
-such as by intimate data communication or control flow between those
-subprograms and other parts of the work.
-
- The Corresponding Source need not include anything that users
-can regenerate automatically from other parts of the Corresponding
-Source.
-
- The Corresponding Source for a work in source code form is that
-same work.
-
- 2. Basic Permissions.
-
- All rights granted under this License are granted for the term of
-copyright on the Program, and are irrevocable provided the stated
-conditions are met. This License explicitly affirms your unlimited
-permission to run the unmodified Program. The output from running a
-covered work is covered by this License only if the output, given its
-content, constitutes a covered work. This License acknowledges your
-rights of fair use or other equivalent, as provided by copyright law.
-
- You may make, run and propagate covered works that you do not
-convey, without conditions so long as your license otherwise remains
-in force. You may convey covered works to others for the sole purpose
-of having them make modifications exclusively for you, or provide you
-with facilities for running those works, provided that you comply with
-the terms of this License in conveying all material for which you do
-not control copyright. Those thus making or running the covered works
-for you must do so exclusively on your behalf, under your direction
-and control, on terms that prohibit them from making any copies of
-your copyrighted material outside their relationship with you.
-
- Conveying under any other circumstances is permitted solely under
-the conditions stated below. Sublicensing is not allowed; section 10
-makes it unnecessary.
-
- 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
-
- No covered work shall be deemed part of an effective technological
-measure under any applicable law fulfilling obligations under article
-11 of the WIPO copyright treaty adopted on 20 December 1996, or
-similar laws prohibiting or restricting circumvention of such
-measures.
-
- When you convey a covered work, you waive any legal power to forbid
-circumvention of technological measures to the extent such circumvention
-is effected by exercising rights under this License with respect to
-the covered work, and you disclaim any intention to limit operation or
-modification of the work as a means of enforcing, against the work's
-users, your or third parties' legal rights to forbid circumvention of
-technological measures.
-
- 4. Conveying Verbatim Copies.
-
- You may convey verbatim copies of the Program's source code as you
-receive it, in any medium, provided that you conspicuously and
-appropriately publish on each copy an appropriate copyright notice;
-keep intact all notices stating that this License and any
-non-permissive terms added in accord with section 7 apply to the code;
-keep intact all notices of the absence of any warranty; and give all
-recipients a copy of this License along with the Program.
-
- You may charge any price or no price for each copy that you convey,
-and you may offer support or warranty protection for a fee.
-
- 5. Conveying Modified Source Versions.
-
- You may convey a work based on the Program, or the modifications to
-produce it from the Program, in the form of source code under the
-terms of section 4, provided that you also meet all of these conditions:
-
- a) The work must carry prominent notices stating that you modified
- it, and giving a relevant date.
-
- b) The work must carry prominent notices stating that it is
- released under this License and any conditions added under section
- 7. This requirement modifies the requirement in section 4 to
- "keep intact all notices".
-
- c) You must license the entire work, as a whole, under this
- License to anyone who comes into possession of a copy. This
- License will therefore apply, along with any applicable section 7
- additional terms, to the whole of the work, and all its parts,
- regardless of how they are packaged. This License gives no
- permission to license the work in any other way, but it does not
- invalidate such permission if you have separately received it.
-
- d) If the work has interactive user interfaces, each must display
- Appropriate Legal Notices; however, if the Program has interactive
- interfaces that do not display Appropriate Legal Notices, your
- work need not make them do so.
-
- A compilation of a covered work with other separate and independent
-works, which are not by their nature extensions of the covered work,
-and which are not combined with it such as to form a larger program,
-in or on a volume of a storage or distribution medium, is called an
-"aggregate" if the compilation and its resulting copyright are not
-used to limit the access or legal rights of the compilation's users
-beyond what the individual works permit. Inclusion of a covered work
-in an aggregate does not cause this License to apply to the other
-parts of the aggregate.
-
- 6. Conveying Non-Source Forms.
-
- You may convey a covered work in object code form under the terms
-of sections 4 and 5, provided that you also convey the
-machine-readable Corresponding Source under the terms of this License,
-in one of these ways:
-
- a) Convey the object code in, or embodied in, a physical product
- (including a physical distribution medium), accompanied by the
- Corresponding Source fixed on a durable physical medium
- customarily used for software interchange.
-
- b) Convey the object code in, or embodied in, a physical product
- (including a physical distribution medium), accompanied by a
- written offer, valid for at least three years and valid for as
- long as you offer spare parts or customer support for that product
- model, to give anyone who possesses the object code either (1) a
- copy of the Corresponding Source for all the software in the
- product that is covered by this License, on a durable physical
- medium customarily used for software interchange, for a price no
- more than your reasonable cost of physically performing this
- conveying of source, or (2) access to copy the
- Corresponding Source from a network server at no charge.
-
- c) Convey individual copies of the object code with a copy of the
- written offer to provide the Corresponding Source. This
- alternative is allowed only occasionally and noncommercially, and
- only if you received the object code with such an offer, in accord
- with subsection 6b.
-
- d) Convey the object code by offering access from a designated
- place (gratis or for a charge), and offer equivalent access to the
- Corresponding Source in the same way through the same place at no
- further charge. You need not require recipients to copy the
- Corresponding Source along with the object code. If the place to
- copy the object code is a network server, the Corresponding Source
- may be on a different server (operated by you or a third party)
- that supports equivalent copying facilities, provided you maintain
- clear directions next to the object code saying where to find the
- Corresponding Source. Regardless of what server hosts the
- Corresponding Source, you remain obligated to ensure that it is
- available for as long as needed to satisfy these requirements.
-
- e) Convey the object code using peer-to-peer transmission, provided
- you inform other peers where the object code and Corresponding
- Source of the work are being offered to the general public at no
- charge under subsection 6d.
-
- A separable portion of the object code, whose source code is excluded
-from the Corresponding Source as a System Library, need not be
-included in conveying the object code work.
-
- A "User Product" is either (1) a "consumer product", which means any
-tangible personal property which is normally used for personal, family,
-or household purposes, or (2) anything designed or sold for incorporation
-into a dwelling. In determining whether a product is a consumer product,
-doubtful cases shall be resolved in favor of coverage. For a particular
-product received by a particular user, "normally used" refers to a
-typical or common use of that class of product, regardless of the status
-of the particular user or of the way in which the particular user
-actually uses, or expects or is expected to use, the product. A product
-is a consumer product regardless of whether the product has substantial
-commercial, industrial or non-consumer uses, unless such uses represent
-the only significant mode of use of the product.
-
- "Installation Information" for a User Product means any methods,
-procedures, authorization keys, or other information required to install
-and execute modified versions of a covered work in that User Product from
-a modified version of its Corresponding Source. The information must
-suffice to ensure that the continued functioning of the modified object
-code is in no case prevented or interfered with solely because
-modification has been made.
-
- If you convey an object code work under this section in, or with, or
-specifically for use in, a User Product, and the conveying occurs as
-part of a transaction in which the right of possession and use of the
-User Product is transferred to the recipient in perpetuity or for a
-fixed term (regardless of how the transaction is characterized), the
-Corresponding Source conveyed under this section must be accompanied
-by the Installation Information. But this requirement does not apply
-if neither you nor any third party retains the ability to install
-modified object code on the User Product (for example, the work has
-been installed in ROM).
-
- The requirement to provide Installation Information does not include a
-requirement to continue to provide support service, warranty, or updates
-for a work that has been modified or installed by the recipient, or for
-the User Product in which it has been modified or installed. Access to a
-network may be denied when the modification itself materially and
-adversely affects the operation of the network or violates the rules and
-protocols for communication across the network.
-
- Corresponding Source conveyed, and Installation Information provided,
-in accord with this section must be in a format that is publicly
-documented (and with an implementation available to the public in
-source code form), and must require no special password or key for
-unpacking, reading or copying.
-
- 7. Additional Terms.
-
- "Additional permissions" are terms that supplement the terms of this
-License by making exceptions from one or more of its conditions.
-Additional permissions that are applicable to the entire Program shall
-be treated as though they were included in this License, to the extent
-that they are valid under applicable law. If additional permissions
-apply only to part of the Program, that part may be used separately
-under those permissions, but the entire Program remains governed by
-this License without regard to the additional permissions.
-
- When you convey a copy of a covered work, you may at your option
-remove any additional permissions from that copy, or from any part of
-it. (Additional permissions may be written to require their own
-removal in certain cases when you modify the work.) You may place
-additional permissions on material, added by you to a covered work,
-for which you have or can give appropriate copyright permission.
-
- Notwithstanding any other provision of this License, for material you
-add to a covered work, you may (if authorized by the copyright holders of
-that material) supplement the terms of this License with terms:
-
- a) Disclaiming warranty or limiting liability differently from the
- terms of sections 15 and 16 of this License; or
-
- b) Requiring preservation of specified reasonable legal notices or
- author attributions in that material or in the Appropriate Legal
- Notices displayed by works containing it; or
-
- c) Prohibiting misrepresentation of the origin of that material, or
- requiring that modified versions of such material be marked in
- reasonable ways as different from the original version; or
-
- d) Limiting the use for publicity purposes of names of licensors or
- authors of the material; or
-
- e) Declining to grant rights under trademark law for use of some
- trade names, trademarks, or service marks; or
-
- f) Requiring indemnification of licensors and authors of that
- material by anyone who conveys the material (or modified versions of
- it) with contractual assumptions of liability to the recipient, for
- any liability that these contractual assumptions directly impose on
- those licensors and authors.
-
- All other non-permissive additional terms are considered "further
-restrictions" within the meaning of section 10. If the Program as you
-received it, or any part of it, contains a notice stating that it is
-governed by this License along with a term that is a further
-restriction, you may remove that term. If a license document contains
-a further restriction but permits relicensing or conveying under this
-License, you may add to a covered work material governed by the terms
-of that license document, provided that the further restriction does
-not survive such relicensing or conveying.
-
- If you add terms to a covered work in accord with this section, you
-must place, in the relevant source files, a statement of the
-additional terms that apply to those files, or a notice indicating
-where to find the applicable terms.
-
- Additional terms, permissive or non-permissive, may be stated in the
-form of a separately written license, or stated as exceptions;
-the above requirements apply either way.
-
- 8. Termination.
-
- You may not propagate or modify a covered work except as expressly
-provided under this License. Any attempt otherwise to propagate or
-modify it is void, and will automatically terminate your rights under
-this License (including any patent licenses granted under the third
-paragraph of section 11).
-
- However, if you cease all violation of this License, then your
-license from a particular copyright holder is reinstated (a)
-provisionally, unless and until the copyright holder explicitly and
-finally terminates your license, and (b) permanently, if the copyright
-holder fails to notify you of the violation by some reasonable means
-prior to 60 days after the cessation.
-
- Moreover, your license from a particular copyright holder is
-reinstated permanently if the copyright holder notifies you of the
-violation by some reasonable means, this is the first time you have
-received notice of violation of this License (for any work) from that
-copyright holder, and you cure the violation prior to 30 days after
-your receipt of the notice.
-
- Termination of your rights under this section does not terminate the
-licenses of parties who have received copies or rights from you under
-this License. If your rights have been terminated and not permanently
-reinstated, you do not qualify to receive new licenses for the same
-material under section 10.
-
- 9. Acceptance Not Required for Having Copies.
-
- You are not required to accept this License in order to receive or
-run a copy of the Program. Ancillary propagation of a covered work
-occurring solely as a consequence of using peer-to-peer transmission
-to receive a copy likewise does not require acceptance. However,
-nothing other than this License grants you permission to propagate or
-modify any covered work. These actions infringe copyright if you do
-not accept this License. Therefore, by modifying or propagating a
-covered work, you indicate your acceptance of this License to do so.
-
- 10. Automatic Licensing of Downstream Recipients.
-
- Each time you convey a covered work, the recipient automatically
-receives a license from the original licensors, to run, modify and
-propagate that work, subject to this License. You are not responsible
-for enforcing compliance by third parties with this License.
-
- An "entity transaction" is a transaction transferring control of an
-organization, or substantially all assets of one, or subdividing an
-organization, or merging organizations. If propagation of a covered
-work results from an entity transaction, each party to that
-transaction who receives a copy of the work also receives whatever
-licenses to the work the party's predecessor in interest had or could
-give under the previous paragraph, plus a right to possession of the
-Corresponding Source of the work from the predecessor in interest, if
-the predecessor has it or can get it with reasonable efforts.
-
- You may not impose any further restrictions on the exercise of the
-rights granted or affirmed under this License. For example, you may
-not impose a license fee, royalty, or other charge for exercise of
-rights granted under this License, and you may not initiate litigation
-(including a cross-claim or counterclaim in a lawsuit) alleging that
-any patent claim is infringed by making, using, selling, offering for
-sale, or importing the Program or any portion of it.
-
- 11. Patents.
-
- A "contributor" is a copyright holder who authorizes use under this
-License of the Program or a work on which the Program is based. The
-work thus licensed is called the contributor's "contributor version".
-
- A contributor's "essential patent claims" are all patent claims
-owned or controlled by the contributor, whether already acquired or
-hereafter acquired, that would be infringed by some manner, permitted
-by this License, of making, using, or selling its contributor version,
-but do not include claims that would be infringed only as a
-consequence of further modification of the contributor version. For
-purposes of this definition, "control" includes the right to grant
-patent sublicenses in a manner consistent with the requirements of
-this License.
-
- Each contributor grants you a non-exclusive, worldwide, royalty-free
-patent license under the contributor's essential patent claims, to
-make, use, sell, offer for sale, import and otherwise run, modify and
-propagate the contents of its contributor version.
-
- In the following three paragraphs, a "patent license" is any express
-agreement or commitment, however denominated, not to enforce a patent
-(such as an express permission to practice a patent or covenant not to
-sue for patent infringement). To "grant" such a patent license to a
-party means to make such an agreement or commitment not to enforce a
-patent against the party.
-
- If you convey a covered work, knowingly relying on a patent license,
-and the Corresponding Source of the work is not available for anyone
-to copy, free of charge and under the terms of this License, through a
-publicly available network server or other readily accessible means,
-then you must either (1) cause the Corresponding Source to be so
-available, or (2) arrange to deprive yourself of the benefit of the
-patent license for this particular work, or (3) arrange, in a manner
-consistent with the requirements of this License, to extend the patent
-license to downstream recipients. "Knowingly relying" means you have
-actual knowledge that, but for the patent license, your conveying the
-covered work in a country, or your recipient's use of the covered work
-in a country, would infringe one or more identifiable patents in that
-country that you have reason to believe are valid.
-
- If, pursuant to or in connection with a single transaction or
-arrangement, you convey, or propagate by procuring conveyance of, a
-covered work, and grant a patent license to some of the parties
-receiving the covered work authorizing them to use, propagate, modify
-or convey a specific copy of the covered work, then the patent license
-you grant is automatically extended to all recipients of the covered
-work and works based on it.
-
- A patent license is "discriminatory" if it does not include within
-the scope of its coverage, prohibits the exercise of, or is
-conditioned on the non-exercise of one or more of the rights that are
-specifically granted under this License. You may not convey a covered
-work if you are a party to an arrangement with a third party that is
-in the business of distributing software, under which you make payment
-to the third party based on the extent of your activity of conveying
-the work, and under which the third party grants, to any of the
-parties who would receive the covered work from you, a discriminatory
-patent license (a) in connection with copies of the covered work
-conveyed by you (or copies made from those copies), or (b) primarily
-for and in connection with specific products or compilations that
-contain the covered work, unless you entered into that arrangement,
-or that patent license was granted, prior to 28 March 2007.
-
- Nothing in this License shall be construed as excluding or limiting
-any implied license or other defenses to infringement that may
-otherwise be available to you under applicable patent law.
-
- 12. No Surrender of Others' Freedom.
-
- If conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot convey a
-covered work so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you may
-not convey it at all. For example, if you agree to terms that obligate you
-to collect a royalty for further conveying from those to whom you convey
-the Program, the only way you could satisfy both those terms and this
-License would be to refrain entirely from conveying the Program.
-
- 13. Remote Network Interaction; Use with the GNU General Public License.
-
- Notwithstanding any other provision of this License, if you modify the
-Program, your modified version must prominently offer all users
-interacting with it remotely through a computer network (if your version
-supports such interaction) an opportunity to receive the Corresponding
-Source of your version by providing access to the Corresponding Source
-from a network server at no charge, through some standard or customary
-means of facilitating copying of software. This Corresponding Source
-shall include the Corresponding Source for any work covered by version 3
-of the GNU General Public License that is incorporated pursuant to the
-following paragraph.
-
- Notwithstanding any other provision of this License, you have
-permission to link or combine any covered work with a work licensed
-under version 3 of the GNU General Public License into a single
-combined work, and to convey the resulting work. The terms of this
-License will continue to apply to the part which is the covered work,
-but the work with which it is combined will remain governed by version
-3 of the GNU General Public License.
-
- 14. Revised Versions of this License.
-
- The Free Software Foundation may publish revised and/or new versions of
-the GNU Affero General Public License from time to time. Such new versions
-will be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
- Each version is given a distinguishing version number. If the
-Program specifies that a certain numbered version of the GNU Affero General
-Public License "or any later version" applies to it, you have the
-option of following the terms and conditions either of that numbered
-version or of any later version published by the Free Software
-Foundation. If the Program does not specify a version number of the
-GNU Affero General Public License, you may choose any version ever published
-by the Free Software Foundation.
-
- If the Program specifies that a proxy can decide which future
-versions of the GNU Affero General Public License can be used, that proxy's
-public statement of acceptance of a version permanently authorizes you
-to choose that version for the Program.
-
- Later license versions may give you additional or different
-permissions. However, no additional obligations are imposed on any
-author or copyright holder as a result of your choosing to follow a
-later version.
-
- 15. Disclaimer of Warranty.
-
- THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
-APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
-HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
-OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
-THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
-IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
-ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
- 16. Limitation of Liability.
-
- IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
-THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
-GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
-USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
-DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
-PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
-EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGES.
-
- 17. Interpretation of Sections 15 and 16.
-
- If the disclaimer of warranty and limitation of liability provided
-above cannot be given local legal effect according to their terms,
-reviewing courts shall apply local law that most closely approximates
-an absolute waiver of all civil liability in connection with the
-Program, unless a warranty or assumption of liability accompanies a
-copy of the Program in return for a fee.
-
- END OF TERMS AND CONDITIONS
-
- How to Apply These Terms to Your New Programs
-
- If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
- To do so, attach the following notices to the program. It is safest
-to attach them to the start of each source file to most effectively
-state the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
-
- Copyright (C)
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU Affero General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU Affero General Public License for more details.
-
- You should have received a copy of the GNU Affero General Public License
- along with this program. If not, see .
-
-Also add information on how to contact you by electronic and paper mail.
-
- If your software can interact with users remotely through a computer
-network, you should also make sure that it provides a way for users to
-get its source. For example, if your program is a web application, its
-interface could display a "Source" link that leads users to an archive
-of the code. There are many ways you could offer source, and different
-solutions will be better for different programs; see section 13 for the
-specific requirements.
-
- You should also get your employer (if you work as a programmer) or school,
-if any, to sign a "copyright disclaimer" for the program, if necessary.
-For more information on this, and how to apply and follow the GNU AGPL, see
-.
diff --git a/yolov5nu/README.md b/yolov5nu/README.md
deleted file mode 100644
index 460207c28091d7e005d508718185c6cdf14abd8b..0000000000000000000000000000000000000000
--- a/yolov5nu/README.md
+++ /dev/null
@@ -1,60 +0,0 @@
-# YOLOv5nu TFLite Conversion
-
-YOLOv5nu is the anchor-free ("u") variant of YOLOv5 from [Ultralytics](https://github.com/ultralytics/ultralytics). It uses the YOLOv8-style decoupled, anchor-free detection head, so its output is a single `[1, 84, 8400]` tensor (`84 = 4` box coordinates `+ 80` COCO class scores, no separate objectness channel).
-
-The exported TFLite outputs box coordinates **normalized to `[0, 1]`** (the demo's post-processing accounts for this).
-
-## Prerequisites
-
-### Python environment
-
-The `.pt` → TFLite conversion uses Ultralytics. Python **3.10** was used.
-
-```bash
-conda create -n python=3.10 -y
-conda activate
-pip install "ultralytics==8.4.90" "torch==2.12.1" "torchvision==0.27.1" \
- "tensorflow==2.21.0" "ai-edge-litert==2.1.5"
-```
-
-These are the exact versions used to produce the provided `yolov5nu.tflite` (Python `3.10.20`). `tensorflow` is required for the TFLite export, and `torchvision` must match `torch` (0.27.1 ↔ 2.12.1).
-
----
-
-## Conversion of YOLOv5nu to TFLite
-
-The `yolov5nu.pt` checkpoint is downloaded automatically by Ultralytics on first use.
-
-```bash
-# CLI
-yolo export model=yolov5nu.pt format=tflite imgsz=640
-```
-
-or equivalently with the Python API:
-
-```python
-from ultralytics import YOLO
-YOLO("yolov5nu.pt").export(format="tflite", imgsz=640)
-```
-
-Ultralytics writes the export artifacts to `yolov5nu_saved_model/`; the float32 model is `yolov5nu_saved_model/yolov5nu_float32.tflite`. Copy/rename it to `yolov5nu.tflite` (the name the demo expects).
-
----
-
-## Usage
-
-A demo script is provided to run inference using OpenCV DNN:
-
-```bash
-python demo.py --model yolov5nu.tflite --image example_outputs/input.jpg --output example_outputs/yolov5nu_output.jpg
-```
-
-`demo.py` uses only OpenCV's dnn module (`cv2.dnn.readNet`). It letterboxes the input to 640x640 (aspect-preserving resize + centered 114-pad, matching `ultralytics.data.augment.LetterBox`), runs the network, decodes the `[1, 84, 8400]` head (argmax over the 80 class scores; boxes are normalized `[0, 1]`, scaled to the letterboxed input and mapped back through the inverse letterbox), applies class-aware NMS (`NMSBoxesBatched`), prints the detected COCO classes / confidences / bounding boxes, and saves an annotated output image. It also handles the NMS-free (v10/26-style) `[1, 300, 6+]` head, so the same script works for other exported YOLO `.tflite` models.
-
-On the provided `example_outputs/input.jpg` it detects `dog`, `truck` and `bicycle`.
-
----
-
-## License
-
-YOLOv5nu weights and the Ultralytics exporter are released under **AGPL-3.0** — see the [Ultralytics LICENSE](https://github.com/ultralytics/ultralytics/blob/main/LICENSE). Any redistribution of the converted `yolov5nu.tflite` is subject to those terms.
diff --git a/yolov5nu/demo.py b/yolov5nu/demo.py
deleted file mode 100644
index a601ebedff0abbae40f24721a22c949cc882185d..0000000000000000000000000000000000000000
--- a/yolov5nu/demo.py
+++ /dev/null
@@ -1,142 +0,0 @@
-"""
-Demo script for YOLOv5nu TFLite model using OpenCV DNN.
-
-Output format:
- - single tensor [1, 84, 8400] -> 84 = 4 box (cx, cy, w, h, normalized [0, 1])
- + 80 COCO class scores (no separate objectness)
-
-Default input size: 640x640 (letterboxed, matching ultralytics.data.augment.LetterBox).
-
-Also handles the NMS-free (v10/26) [1, 300, 6+] head, so the same script works for
-other exported YOLO .tflite models.
-
-Usage:
- python demo.py --model yolov5nu.tflite --image example_outputs/input.jpg --output example_outputs/yolov5nu_output.jpg
-"""
-
-import argparse
-import cv2
-import numpy as np
-
-
-COCO = [
- "person", "bicycle", "car", "motorbike", "aeroplane", "bus", "train", "truck", "boat", "traffic light",
- "fire hydrant", "stop sign", "parking meter", "bench", "bird", "cat", "dog", "horse", "sheep", "cow",
- "elephant", "bear", "zebra", "giraffe", "backpack", "umbrella", "handbag", "tie", "suitcase", "frisbee",
- "skis", "snowboard", "sports ball", "kite", "baseball bat", "baseball glove", "skateboard", "surfboard", "tennis racket", "bottle",
- "wine glass", "cup", "fork", "knife", "spoon", "bowl", "banana", "apple", "sandwich", "orange",
- "broccoli", "carrot", "hot dog", "pizza", "donut", "cake", "chair", "sofa", "pottedplant", "bed",
- "diningtable", "toilet", "tvmonitor", "laptop", "mouse", "remote", "keyboard", "cell phone", "microwave", "oven",
- "toaster", "sink", "refrigerator", "book", "clock", "vase", "scissors", "teddy bear", "hair drier", "toothbrush",
-]
-
-PAD_COLOR = (114, 114, 114)
-
-
-def letterbox(img, new_h, new_w):
- """Aspect-preserving resize + centered pad (Ultralytics LetterBox defaults, pad=114)."""
- h0, w0 = img.shape[:2]
- ratio = min(new_h / h0, new_w / w0)
- unpad_w, unpad_h = round(w0 * ratio), round(h0 * ratio)
- dw, dh = (new_w - unpad_w) / 2.0, (new_h - unpad_h) / 2.0
- top, bottom = round(dh - 0.1), round(dh + 0.1)
- left, right = round(dw - 0.1), round(dw + 0.1)
- if (unpad_w, unpad_h) != (w0, h0):
- img = cv2.resize(img, (unpad_w, unpad_h), interpolation=cv2.INTER_LINEAR)
- padded = cv2.copyMakeBorder(img, top, bottom, left, right, cv2.BORDER_CONSTANT, value=PAD_COLOR)
- return padded, ratio, left, top
-
-
-def unletterbox(x, y, ratio, pad_x, pad_y):
- return (x - pad_x) / ratio, (y - pad_y) / ratio
-
-
-def is_nms_free_head(shape):
- # v10/26-style heads emit a fixed 300 already-decoded detections with a small row width.
- return len(shape) == 3 and shape[1] == 300 and shape[2] < shape[1]
-
-
-def decode_classic_head(out, net_w, net_h, ratio, pad_x, pad_y, conf_thresh):
- # out: (1, 4+nc, num_anchors) -> (num_anchors, 4+nc)
- pred = out.reshape(out.shape[1], -1).T
- cls_scores = pred[:, 4:]
- class_ids = np.argmax(cls_scores, axis=1)
- confs = cls_scores[np.arange(cls_scores.shape[0]), class_ids]
- keep = confs >= conf_thresh
- pred, class_ids, confs = pred[keep], class_ids[keep], confs[keep]
-
- boxes = []
- for row in pred:
- # normalized [0,1] of the letterboxed input -> original-image pixels
- cx, cy, bw, bh = row[0] * net_w, row[1] * net_h, row[2] * net_w, row[3] * net_h
- x1, y1 = unletterbox(cx - bw / 2.0, cy - bh / 2.0, ratio, pad_x, pad_y)
- x2, y2 = unletterbox(cx + bw / 2.0, cy + bh / 2.0, ratio, pad_x, pad_y)
- boxes.append([x1, y1, x2 - x1, y2 - y1])
- return boxes, confs.tolist(), class_ids.tolist()
-
-
-def decode_nms_free_head(out, ratio, pad_x, pad_y, conf_thresh):
- # out: (1, 300, 6+) -- [x1, y1, x2, y2, conf, class_id, ...]; coords in letterboxed pixels
- dets = out.reshape(out.shape[1], -1)
- boxes, scores, class_ids = [], [], []
- for row in dets:
- if row[4] < conf_thresh:
- continue
- x1, y1 = unletterbox(row[0], row[1], ratio, pad_x, pad_y)
- x2, y2 = unletterbox(row[2], row[3], ratio, pad_x, pad_y)
- boxes.append([x1, y1, x2 - x1, y2 - y1])
- scores.append(float(row[4]))
- class_ids.append(int(row[5]))
- return boxes, scores, class_ids
-
-
-def main():
- parser = argparse.ArgumentParser(description="YOLO TFLite demo (OpenCV DNN)")
- parser.add_argument("--model", required=True, help="Path to TFLite model")
- parser.add_argument("--image", default="example_outputs/input.jpg", help="Path to input image")
- parser.add_argument("--output", default="output.jpg", help="Path for annotated output")
- parser.add_argument("--input-size", type=int, default=640, help="Model input size (W=H)")
- parser.add_argument("--conf", type=float, default=0.5, help="Confidence threshold")
- parser.add_argument("--nms", type=float, default=0.45, help="NMS IoU threshold")
- args = parser.parse_args()
-
- img = cv2.imread(args.image)
- if img is None:
- raise FileNotFoundError(f"Cannot read image: {args.image}")
-
- net = cv2.dnn.readNet(args.model)
-
- imgsz = args.input_size
- padded, ratio, pad_x, pad_y = letterbox(img, imgsz, imgsz)
- blob = cv2.dnn.blobFromImage(padded, 1.0 / 255.0, (imgsz, imgsz), swapRB=True, crop=False)
- net.setInput(blob)
- outs = net.forward(net.getUnconnectedOutLayersNames())
- print("outputs:", [o.shape for o in outs])
-
- # Pick the detection head: the output with the largest last dimension.
- det = max(outs, key=lambda o: o.shape[-1] if o.ndim == 3 else -1)
-
- if is_nms_free_head(det.shape):
- boxes, scores, class_ids = decode_nms_free_head(det, ratio, pad_x, pad_y, args.conf)
- keep = list(range(len(boxes)))
- else:
- boxes, scores, class_ids = decode_classic_head(det, imgsz, imgsz, ratio, pad_x, pad_y, args.conf)
- keep = cv2.dnn.NMSBoxesBatched(boxes, scores, class_ids, args.conf, args.nms)
- keep = np.array(keep).flatten().tolist()
-
- out = img.copy()
- for idx in keep:
- x, y, w, h = (int(v) for v in boxes[idx])
- cls = COCO[class_ids[idx]] if 0 <= class_ids[idx] < 80 else str(class_ids[idx])
- label = f"{cls} {scores[idx]:.2f}"
- cv2.rectangle(out, (x, y), (x + w, y + h), (0, 255, 0), 2)
- cv2.putText(out, label, (x, max(15, y - 5)), cv2.FONT_HERSHEY_SIMPLEX, 0.6, (0, 255, 0), 2)
- print(f" {label} box=[{x},{y},{w},{h}]")
-
- print(f"{len(keep)} detections above conf {args.conf}")
- cv2.imwrite(args.output, out)
- print(f"Saved annotated image: {args.output}")
-
-
-if __name__ == "__main__":
- main()
diff --git a/yolov5nu/example_outputs/input.jpg b/yolov5nu/example_outputs/input.jpg
deleted file mode 100644
index 4b37071c4b38a5112c700e7a3d46ebb351d9b494..0000000000000000000000000000000000000000
--- a/yolov5nu/example_outputs/input.jpg
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:5a9522051c3cec2bbd2f6323fccba32e8fbf3ddcc2b3e2fd46b04c720bc6f866
-size 163759
diff --git a/yolov5nu/example_outputs/yolov5nu_output.jpg b/yolov5nu/example_outputs/yolov5nu_output.jpg
deleted file mode 100644
index 9592007b16b2d9d4eaa83a4c6b4d5390071de3f3..0000000000000000000000000000000000000000
--- a/yolov5nu/example_outputs/yolov5nu_output.jpg
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:c702a80c8f6766d19740a750157bcc256957de4953ec81a0001a0a5caac80678
-size 182907
diff --git a/yolov5nu/yolov5nu.tflite b/yolov5nu/yolov5nu.tflite
deleted file mode 100644
index 900d40562d0a3091a9367689f7eca232faf73abb..0000000000000000000000000000000000000000
--- a/yolov5nu/yolov5nu.tflite
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:dfa8013d0b5e4ac0ba939405f02d414d189c1fa0e6a4d37c94bf063ce178447a
-size 10848662
diff --git a/yolov8n/LICENSE b/yolov8n/LICENSE
deleted file mode 100644
index be3f7b28e564e7dd05eaf59d64adba1a4065ac0e..0000000000000000000000000000000000000000
--- a/yolov8n/LICENSE
+++ /dev/null
@@ -1,661 +0,0 @@
- GNU AFFERO GENERAL PUBLIC LICENSE
- Version 3, 19 November 2007
-
- Copyright (C) 2007 Free Software Foundation, Inc.
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
- Preamble
-
- The GNU Affero General Public License is a free, copyleft license for
-software and other kinds of works, specifically designed to ensure
-cooperation with the community in the case of network server software.
-
- The licenses for most software and other practical works are designed
-to take away your freedom to share and change the works. By contrast,
-our General Public Licenses are intended to guarantee your freedom to
-share and change all versions of a program--to make sure it remains free
-software for all its users.
-
- When we speak of free software, we are referring to freedom, not
-price. Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-them if you wish), that you receive source code or can get it if you
-want it, that you can change the software or use pieces of it in new
-free programs, and that you know you can do these things.
-
- Developers that use our General Public Licenses protect your rights
-with two steps: (1) assert copyright on the software, and (2) offer
-you this License which gives you legal permission to copy, distribute
-and/or modify the software.
-
- A secondary benefit of defending all users' freedom is that
-improvements made in alternate versions of the program, if they
-receive widespread use, become available for other developers to
-incorporate. Many developers of free software are heartened and
-encouraged by the resulting cooperation. However, in the case of
-software used on network servers, this result may fail to come about.
-The GNU General Public License permits making a modified version and
-letting the public access it on a server without ever releasing its
-source code to the public.
-
- The GNU Affero General Public License is designed specifically to
-ensure that, in such cases, the modified source code becomes available
-to the community. It requires the operator of a network server to
-provide the source code of the modified version running there to the
-users of that server. Therefore, public use of a modified version, on
-a publicly accessible server, gives the public access to the source
-code of the modified version.
-
- An older license, called the Affero General Public License and
-published by Affero, was designed to accomplish similar goals. This is
-a different license, not a version of the Affero GPL, but Affero has
-released a new version of the Affero GPL which permits relicensing under
-this license.
-
- The precise terms and conditions for copying, distribution and
-modification follow.
-
- TERMS AND CONDITIONS
-
- 0. Definitions.
-
- "This License" refers to version 3 of the GNU Affero General Public License.
-
- "Copyright" also means copyright-like laws that apply to other kinds of
-works, such as semiconductor masks.
-
- "The Program" refers to any copyrightable work licensed under this
-License. Each licensee is addressed as "you". "Licensees" and
-"recipients" may be individuals or organizations.
-
- To "modify" a work means to copy from or adapt all or part of the work
-in a fashion requiring copyright permission, other than the making of an
-exact copy. The resulting work is called a "modified version" of the
-earlier work or a work "based on" the earlier work.
-
- A "covered work" means either the unmodified Program or a work based
-on the Program.
-
- To "propagate" a work means to do anything with it that, without
-permission, would make you directly or secondarily liable for
-infringement under applicable copyright law, except executing it on a
-computer or modifying a private copy. Propagation includes copying,
-distribution (with or without modification), making available to the
-public, and in some countries other activities as well.
-
- To "convey" a work means any kind of propagation that enables other
-parties to make or receive copies. Mere interaction with a user through
-a computer network, with no transfer of a copy, is not conveying.
-
- An interactive user interface displays "Appropriate Legal Notices"
-to the extent that it includes a convenient and prominently visible
-feature that (1) displays an appropriate copyright notice, and (2)
-tells the user that there is no warranty for the work (except to the
-extent that warranties are provided), that licensees may convey the
-work under this License, and how to view a copy of this License. If
-the interface presents a list of user commands or options, such as a
-menu, a prominent item in the list meets this criterion.
-
- 1. Source Code.
-
- The "source code" for a work means the preferred form of the work
-for making modifications to it. "Object code" means any non-source
-form of a work.
-
- A "Standard Interface" means an interface that either is an official
-standard defined by a recognized standards body, or, in the case of
-interfaces specified for a particular programming language, one that
-is widely used among developers working in that language.
-
- The "System Libraries" of an executable work include anything, other
-than the work as a whole, that (a) is included in the normal form of
-packaging a Major Component, but which is not part of that Major
-Component, and (b) serves only to enable use of the work with that
-Major Component, or to implement a Standard Interface for which an
-implementation is available to the public in source code form. A
-"Major Component", in this context, means a major essential component
-(kernel, window system, and so on) of the specific operating system
-(if any) on which the executable work runs, or a compiler used to
-produce the work, or an object code interpreter used to run it.
-
- The "Corresponding Source" for a work in object code form means all
-the source code needed to generate, install, and (for an executable
-work) run the object code and to modify the work, including scripts to
-control those activities. However, it does not include the work's
-System Libraries, or general-purpose tools or generally available free
-programs which are used unmodified in performing those activities but
-which are not part of the work. For example, Corresponding Source
-includes interface definition files associated with source files for
-the work, and the source code for shared libraries and dynamically
-linked subprograms that the work is specifically designed to require,
-such as by intimate data communication or control flow between those
-subprograms and other parts of the work.
-
- The Corresponding Source need not include anything that users
-can regenerate automatically from other parts of the Corresponding
-Source.
-
- The Corresponding Source for a work in source code form is that
-same work.
-
- 2. Basic Permissions.
-
- All rights granted under this License are granted for the term of
-copyright on the Program, and are irrevocable provided the stated
-conditions are met. This License explicitly affirms your unlimited
-permission to run the unmodified Program. The output from running a
-covered work is covered by this License only if the output, given its
-content, constitutes a covered work. This License acknowledges your
-rights of fair use or other equivalent, as provided by copyright law.
-
- You may make, run and propagate covered works that you do not
-convey, without conditions so long as your license otherwise remains
-in force. You may convey covered works to others for the sole purpose
-of having them make modifications exclusively for you, or provide you
-with facilities for running those works, provided that you comply with
-the terms of this License in conveying all material for which you do
-not control copyright. Those thus making or running the covered works
-for you must do so exclusively on your behalf, under your direction
-and control, on terms that prohibit them from making any copies of
-your copyrighted material outside their relationship with you.
-
- Conveying under any other circumstances is permitted solely under
-the conditions stated below. Sublicensing is not allowed; section 10
-makes it unnecessary.
-
- 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
-
- No covered work shall be deemed part of an effective technological
-measure under any applicable law fulfilling obligations under article
-11 of the WIPO copyright treaty adopted on 20 December 1996, or
-similar laws prohibiting or restricting circumvention of such
-measures.
-
- When you convey a covered work, you waive any legal power to forbid
-circumvention of technological measures to the extent such circumvention
-is effected by exercising rights under this License with respect to
-the covered work, and you disclaim any intention to limit operation or
-modification of the work as a means of enforcing, against the work's
-users, your or third parties' legal rights to forbid circumvention of
-technological measures.
-
- 4. Conveying Verbatim Copies.
-
- You may convey verbatim copies of the Program's source code as you
-receive it, in any medium, provided that you conspicuously and
-appropriately publish on each copy an appropriate copyright notice;
-keep intact all notices stating that this License and any
-non-permissive terms added in accord with section 7 apply to the code;
-keep intact all notices of the absence of any warranty; and give all
-recipients a copy of this License along with the Program.
-
- You may charge any price or no price for each copy that you convey,
-and you may offer support or warranty protection for a fee.
-
- 5. Conveying Modified Source Versions.
-
- You may convey a work based on the Program, or the modifications to
-produce it from the Program, in the form of source code under the
-terms of section 4, provided that you also meet all of these conditions:
-
- a) The work must carry prominent notices stating that you modified
- it, and giving a relevant date.
-
- b) The work must carry prominent notices stating that it is
- released under this License and any conditions added under section
- 7. This requirement modifies the requirement in section 4 to
- "keep intact all notices".
-
- c) You must license the entire work, as a whole, under this
- License to anyone who comes into possession of a copy. This
- License will therefore apply, along with any applicable section 7
- additional terms, to the whole of the work, and all its parts,
- regardless of how they are packaged. This License gives no
- permission to license the work in any other way, but it does not
- invalidate such permission if you have separately received it.
-
- d) If the work has interactive user interfaces, each must display
- Appropriate Legal Notices; however, if the Program has interactive
- interfaces that do not display Appropriate Legal Notices, your
- work need not make them do so.
-
- A compilation of a covered work with other separate and independent
-works, which are not by their nature extensions of the covered work,
-and which are not combined with it such as to form a larger program,
-in or on a volume of a storage or distribution medium, is called an
-"aggregate" if the compilation and its resulting copyright are not
-used to limit the access or legal rights of the compilation's users
-beyond what the individual works permit. Inclusion of a covered work
-in an aggregate does not cause this License to apply to the other
-parts of the aggregate.
-
- 6. Conveying Non-Source Forms.
-
- You may convey a covered work in object code form under the terms
-of sections 4 and 5, provided that you also convey the
-machine-readable Corresponding Source under the terms of this License,
-in one of these ways:
-
- a) Convey the object code in, or embodied in, a physical product
- (including a physical distribution medium), accompanied by the
- Corresponding Source fixed on a durable physical medium
- customarily used for software interchange.
-
- b) Convey the object code in, or embodied in, a physical product
- (including a physical distribution medium), accompanied by a
- written offer, valid for at least three years and valid for as
- long as you offer spare parts or customer support for that product
- model, to give anyone who possesses the object code either (1) a
- copy of the Corresponding Source for all the software in the
- product that is covered by this License, on a durable physical
- medium customarily used for software interchange, for a price no
- more than your reasonable cost of physically performing this
- conveying of source, or (2) access to copy the
- Corresponding Source from a network server at no charge.
-
- c) Convey individual copies of the object code with a copy of the
- written offer to provide the Corresponding Source. This
- alternative is allowed only occasionally and noncommercially, and
- only if you received the object code with such an offer, in accord
- with subsection 6b.
-
- d) Convey the object code by offering access from a designated
- place (gratis or for a charge), and offer equivalent access to the
- Corresponding Source in the same way through the same place at no
- further charge. You need not require recipients to copy the
- Corresponding Source along with the object code. If the place to
- copy the object code is a network server, the Corresponding Source
- may be on a different server (operated by you or a third party)
- that supports equivalent copying facilities, provided you maintain
- clear directions next to the object code saying where to find the
- Corresponding Source. Regardless of what server hosts the
- Corresponding Source, you remain obligated to ensure that it is
- available for as long as needed to satisfy these requirements.
-
- e) Convey the object code using peer-to-peer transmission, provided
- you inform other peers where the object code and Corresponding
- Source of the work are being offered to the general public at no
- charge under subsection 6d.
-
- A separable portion of the object code, whose source code is excluded
-from the Corresponding Source as a System Library, need not be
-included in conveying the object code work.
-
- A "User Product" is either (1) a "consumer product", which means any
-tangible personal property which is normally used for personal, family,
-or household purposes, or (2) anything designed or sold for incorporation
-into a dwelling. In determining whether a product is a consumer product,
-doubtful cases shall be resolved in favor of coverage. For a particular
-product received by a particular user, "normally used" refers to a
-typical or common use of that class of product, regardless of the status
-of the particular user or of the way in which the particular user
-actually uses, or expects or is expected to use, the product. A product
-is a consumer product regardless of whether the product has substantial
-commercial, industrial or non-consumer uses, unless such uses represent
-the only significant mode of use of the product.
-
- "Installation Information" for a User Product means any methods,
-procedures, authorization keys, or other information required to install
-and execute modified versions of a covered work in that User Product from
-a modified version of its Corresponding Source. The information must
-suffice to ensure that the continued functioning of the modified object
-code is in no case prevented or interfered with solely because
-modification has been made.
-
- If you convey an object code work under this section in, or with, or
-specifically for use in, a User Product, and the conveying occurs as
-part of a transaction in which the right of possession and use of the
-User Product is transferred to the recipient in perpetuity or for a
-fixed term (regardless of how the transaction is characterized), the
-Corresponding Source conveyed under this section must be accompanied
-by the Installation Information. But this requirement does not apply
-if neither you nor any third party retains the ability to install
-modified object code on the User Product (for example, the work has
-been installed in ROM).
-
- The requirement to provide Installation Information does not include a
-requirement to continue to provide support service, warranty, or updates
-for a work that has been modified or installed by the recipient, or for
-the User Product in which it has been modified or installed. Access to a
-network may be denied when the modification itself materially and
-adversely affects the operation of the network or violates the rules and
-protocols for communication across the network.
-
- Corresponding Source conveyed, and Installation Information provided,
-in accord with this section must be in a format that is publicly
-documented (and with an implementation available to the public in
-source code form), and must require no special password or key for
-unpacking, reading or copying.
-
- 7. Additional Terms.
-
- "Additional permissions" are terms that supplement the terms of this
-License by making exceptions from one or more of its conditions.
-Additional permissions that are applicable to the entire Program shall
-be treated as though they were included in this License, to the extent
-that they are valid under applicable law. If additional permissions
-apply only to part of the Program, that part may be used separately
-under those permissions, but the entire Program remains governed by
-this License without regard to the additional permissions.
-
- When you convey a copy of a covered work, you may at your option
-remove any additional permissions from that copy, or from any part of
-it. (Additional permissions may be written to require their own
-removal in certain cases when you modify the work.) You may place
-additional permissions on material, added by you to a covered work,
-for which you have or can give appropriate copyright permission.
-
- Notwithstanding any other provision of this License, for material you
-add to a covered work, you may (if authorized by the copyright holders of
-that material) supplement the terms of this License with terms:
-
- a) Disclaiming warranty or limiting liability differently from the
- terms of sections 15 and 16 of this License; or
-
- b) Requiring preservation of specified reasonable legal notices or
- author attributions in that material or in the Appropriate Legal
- Notices displayed by works containing it; or
-
- c) Prohibiting misrepresentation of the origin of that material, or
- requiring that modified versions of such material be marked in
- reasonable ways as different from the original version; or
-
- d) Limiting the use for publicity purposes of names of licensors or
- authors of the material; or
-
- e) Declining to grant rights under trademark law for use of some
- trade names, trademarks, or service marks; or
-
- f) Requiring indemnification of licensors and authors of that
- material by anyone who conveys the material (or modified versions of
- it) with contractual assumptions of liability to the recipient, for
- any liability that these contractual assumptions directly impose on
- those licensors and authors.
-
- All other non-permissive additional terms are considered "further
-restrictions" within the meaning of section 10. If the Program as you
-received it, or any part of it, contains a notice stating that it is
-governed by this License along with a term that is a further
-restriction, you may remove that term. If a license document contains
-a further restriction but permits relicensing or conveying under this
-License, you may add to a covered work material governed by the terms
-of that license document, provided that the further restriction does
-not survive such relicensing or conveying.
-
- If you add terms to a covered work in accord with this section, you
-must place, in the relevant source files, a statement of the
-additional terms that apply to those files, or a notice indicating
-where to find the applicable terms.
-
- Additional terms, permissive or non-permissive, may be stated in the
-form of a separately written license, or stated as exceptions;
-the above requirements apply either way.
-
- 8. Termination.
-
- You may not propagate or modify a covered work except as expressly
-provided under this License. Any attempt otherwise to propagate or
-modify it is void, and will automatically terminate your rights under
-this License (including any patent licenses granted under the third
-paragraph of section 11).
-
- However, if you cease all violation of this License, then your
-license from a particular copyright holder is reinstated (a)
-provisionally, unless and until the copyright holder explicitly and
-finally terminates your license, and (b) permanently, if the copyright
-holder fails to notify you of the violation by some reasonable means
-prior to 60 days after the cessation.
-
- Moreover, your license from a particular copyright holder is
-reinstated permanently if the copyright holder notifies you of the
-violation by some reasonable means, this is the first time you have
-received notice of violation of this License (for any work) from that
-copyright holder, and you cure the violation prior to 30 days after
-your receipt of the notice.
-
- Termination of your rights under this section does not terminate the
-licenses of parties who have received copies or rights from you under
-this License. If your rights have been terminated and not permanently
-reinstated, you do not qualify to receive new licenses for the same
-material under section 10.
-
- 9. Acceptance Not Required for Having Copies.
-
- You are not required to accept this License in order to receive or
-run a copy of the Program. Ancillary propagation of a covered work
-occurring solely as a consequence of using peer-to-peer transmission
-to receive a copy likewise does not require acceptance. However,
-nothing other than this License grants you permission to propagate or
-modify any covered work. These actions infringe copyright if you do
-not accept this License. Therefore, by modifying or propagating a
-covered work, you indicate your acceptance of this License to do so.
-
- 10. Automatic Licensing of Downstream Recipients.
-
- Each time you convey a covered work, the recipient automatically
-receives a license from the original licensors, to run, modify and
-propagate that work, subject to this License. You are not responsible
-for enforcing compliance by third parties with this License.
-
- An "entity transaction" is a transaction transferring control of an
-organization, or substantially all assets of one, or subdividing an
-organization, or merging organizations. If propagation of a covered
-work results from an entity transaction, each party to that
-transaction who receives a copy of the work also receives whatever
-licenses to the work the party's predecessor in interest had or could
-give under the previous paragraph, plus a right to possession of the
-Corresponding Source of the work from the predecessor in interest, if
-the predecessor has it or can get it with reasonable efforts.
-
- You may not impose any further restrictions on the exercise of the
-rights granted or affirmed under this License. For example, you may
-not impose a license fee, royalty, or other charge for exercise of
-rights granted under this License, and you may not initiate litigation
-(including a cross-claim or counterclaim in a lawsuit) alleging that
-any patent claim is infringed by making, using, selling, offering for
-sale, or importing the Program or any portion of it.
-
- 11. Patents.
-
- A "contributor" is a copyright holder who authorizes use under this
-License of the Program or a work on which the Program is based. The
-work thus licensed is called the contributor's "contributor version".
-
- A contributor's "essential patent claims" are all patent claims
-owned or controlled by the contributor, whether already acquired or
-hereafter acquired, that would be infringed by some manner, permitted
-by this License, of making, using, or selling its contributor version,
-but do not include claims that would be infringed only as a
-consequence of further modification of the contributor version. For
-purposes of this definition, "control" includes the right to grant
-patent sublicenses in a manner consistent with the requirements of
-this License.
-
- Each contributor grants you a non-exclusive, worldwide, royalty-free
-patent license under the contributor's essential patent claims, to
-make, use, sell, offer for sale, import and otherwise run, modify and
-propagate the contents of its contributor version.
-
- In the following three paragraphs, a "patent license" is any express
-agreement or commitment, however denominated, not to enforce a patent
-(such as an express permission to practice a patent or covenant not to
-sue for patent infringement). To "grant" such a patent license to a
-party means to make such an agreement or commitment not to enforce a
-patent against the party.
-
- If you convey a covered work, knowingly relying on a patent license,
-and the Corresponding Source of the work is not available for anyone
-to copy, free of charge and under the terms of this License, through a
-publicly available network server or other readily accessible means,
-then you must either (1) cause the Corresponding Source to be so
-available, or (2) arrange to deprive yourself of the benefit of the
-patent license for this particular work, or (3) arrange, in a manner
-consistent with the requirements of this License, to extend the patent
-license to downstream recipients. "Knowingly relying" means you have
-actual knowledge that, but for the patent license, your conveying the
-covered work in a country, or your recipient's use of the covered work
-in a country, would infringe one or more identifiable patents in that
-country that you have reason to believe are valid.
-
- If, pursuant to or in connection with a single transaction or
-arrangement, you convey, or propagate by procuring conveyance of, a
-covered work, and grant a patent license to some of the parties
-receiving the covered work authorizing them to use, propagate, modify
-or convey a specific copy of the covered work, then the patent license
-you grant is automatically extended to all recipients of the covered
-work and works based on it.
-
- A patent license is "discriminatory" if it does not include within
-the scope of its coverage, prohibits the exercise of, or is
-conditioned on the non-exercise of one or more of the rights that are
-specifically granted under this License. You may not convey a covered
-work if you are a party to an arrangement with a third party that is
-in the business of distributing software, under which you make payment
-to the third party based on the extent of your activity of conveying
-the work, and under which the third party grants, to any of the
-parties who would receive the covered work from you, a discriminatory
-patent license (a) in connection with copies of the covered work
-conveyed by you (or copies made from those copies), or (b) primarily
-for and in connection with specific products or compilations that
-contain the covered work, unless you entered into that arrangement,
-or that patent license was granted, prior to 28 March 2007.
-
- Nothing in this License shall be construed as excluding or limiting
-any implied license or other defenses to infringement that may
-otherwise be available to you under applicable patent law.
-
- 12. No Surrender of Others' Freedom.
-
- If conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot convey a
-covered work so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you may
-not convey it at all. For example, if you agree to terms that obligate you
-to collect a royalty for further conveying from those to whom you convey
-the Program, the only way you could satisfy both those terms and this
-License would be to refrain entirely from conveying the Program.
-
- 13. Remote Network Interaction; Use with the GNU General Public License.
-
- Notwithstanding any other provision of this License, if you modify the
-Program, your modified version must prominently offer all users
-interacting with it remotely through a computer network (if your version
-supports such interaction) an opportunity to receive the Corresponding
-Source of your version by providing access to the Corresponding Source
-from a network server at no charge, through some standard or customary
-means of facilitating copying of software. This Corresponding Source
-shall include the Corresponding Source for any work covered by version 3
-of the GNU General Public License that is incorporated pursuant to the
-following paragraph.
-
- Notwithstanding any other provision of this License, you have
-permission to link or combine any covered work with a work licensed
-under version 3 of the GNU General Public License into a single
-combined work, and to convey the resulting work. The terms of this
-License will continue to apply to the part which is the covered work,
-but the work with which it is combined will remain governed by version
-3 of the GNU General Public License.
-
- 14. Revised Versions of this License.
-
- The Free Software Foundation may publish revised and/or new versions of
-the GNU Affero General Public License from time to time. Such new versions
-will be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
- Each version is given a distinguishing version number. If the
-Program specifies that a certain numbered version of the GNU Affero General
-Public License "or any later version" applies to it, you have the
-option of following the terms and conditions either of that numbered
-version or of any later version published by the Free Software
-Foundation. If the Program does not specify a version number of the
-GNU Affero General Public License, you may choose any version ever published
-by the Free Software Foundation.
-
- If the Program specifies that a proxy can decide which future
-versions of the GNU Affero General Public License can be used, that proxy's
-public statement of acceptance of a version permanently authorizes you
-to choose that version for the Program.
-
- Later license versions may give you additional or different
-permissions. However, no additional obligations are imposed on any
-author or copyright holder as a result of your choosing to follow a
-later version.
-
- 15. Disclaimer of Warranty.
-
- THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
-APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
-HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
-OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
-THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
-IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
-ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
- 16. Limitation of Liability.
-
- IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
-THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
-GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
-USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
-DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
-PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
-EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGES.
-
- 17. Interpretation of Sections 15 and 16.
-
- If the disclaimer of warranty and limitation of liability provided
-above cannot be given local legal effect according to their terms,
-reviewing courts shall apply local law that most closely approximates
-an absolute waiver of all civil liability in connection with the
-Program, unless a warranty or assumption of liability accompanies a
-copy of the Program in return for a fee.
-
- END OF TERMS AND CONDITIONS
-
- How to Apply These Terms to Your New Programs
-
- If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
- To do so, attach the following notices to the program. It is safest
-to attach them to the start of each source file to most effectively
-state the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
-
- Copyright (C)
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU Affero General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU Affero General Public License for more details.
-
- You should have received a copy of the GNU Affero General Public License
- along with this program. If not, see .
-
-Also add information on how to contact you by electronic and paper mail.
-
- If your software can interact with users remotely through a computer
-network, you should also make sure that it provides a way for users to
-get its source. For example, if your program is a web application, its
-interface could display a "Source" link that leads users to an archive
-of the code. There are many ways you could offer source, and different
-solutions will be better for different programs; see section 13 for the
-specific requirements.
-
- You should also get your employer (if you work as a programmer) or school,
-if any, to sign a "copyright disclaimer" for the program, if necessary.
-For more information on this, and how to apply and follow the GNU AGPL, see
-.
diff --git a/yolov8n/README.md b/yolov8n/README.md
deleted file mode 100644
index eea31ea98b90831d906b360d2ffcfc2388027023..0000000000000000000000000000000000000000
--- a/yolov8n/README.md
+++ /dev/null
@@ -1,60 +0,0 @@
-# YOLOv8n TFLite Conversion
-
-YOLOv8n is the nano detection model from [Ultralytics](https://github.com/ultralytics/ultralytics). It uses the anchor-free, decoupled detection head, so its output is a single `[1, 84, 8400]` tensor (`84 = 4` box coordinates `+ 80` COCO class scores, no separate objectness channel).
-
-The exported TFLite outputs box coordinates **normalized to `[0, 1]`** (the demo's post-processing accounts for this).
-
-## Prerequisites
-
-### Python environment
-
-The `.pt` → TFLite conversion uses Ultralytics. Python **3.10** was used.
-
-```bash
-conda create -n python=3.10 -y
-conda activate
-pip install "ultralytics==8.4.90" "torch==2.12.1" "torchvision==0.27.1" \
- "tensorflow==2.21.0" "ai-edge-litert==2.1.5"
-```
-
-These are the exact versions used to produce the provided `yolov8n.tflite` (Python `3.10.20`). `tensorflow` is required for the TFLite export, and `torchvision` must match `torch` (0.27.1 ↔ 2.12.1).
-
----
-
-## Conversion of YOLOv8n to TFLite
-
-The `yolov8n.pt` checkpoint is downloaded automatically by Ultralytics on first use.
-
-```bash
-# CLI
-yolo export model=yolov8n.pt format=tflite imgsz=640
-```
-
-or equivalently with the Python API:
-
-```python
-from ultralytics import YOLO
-YOLO("yolov8n.pt").export(format="tflite", imgsz=640)
-```
-
-Ultralytics writes the export artifacts to `yolov8n_saved_model/`; the float32 model is `yolov8n_saved_model/yolov8n_float32.tflite`. Copy/rename it to `yolov8n.tflite` (the name the demo expects).
-
----
-
-## Usage
-
-A demo script is provided to run inference using OpenCV DNN:
-
-```bash
-python demo.py --model yolov8n.tflite --image example_outputs/input.jpg --output example_outputs/yolov8n_output.jpg
-```
-
-`demo.py` uses only OpenCV's dnn module (`cv2.dnn.readNet`). It letterboxes the input to 640x640 (aspect-preserving resize + centered 114-pad, matching `ultralytics.data.augment.LetterBox`), runs the network, decodes the `[1, 84, 8400]` head (argmax over the 80 class scores; boxes are normalized `[0, 1]`, scaled to the letterboxed input and mapped back through the inverse letterbox), applies class-aware NMS (`NMSBoxesBatched`), prints the detected COCO classes / confidences / bounding boxes, and saves an annotated output image. It also handles the NMS-free (v10/26-style) `[1, 300, 6+]` head, so the same script works for other exported YOLO `.tflite` models.
-
-On the provided `example_outputs/input.jpg` it detects `dog`, `bicycle` and `car`.
-
----
-
-## License
-
-YOLOv8n weights and the Ultralytics exporter are released under **AGPL-3.0** — see the [Ultralytics LICENSE](https://github.com/ultralytics/ultralytics/blob/main/LICENSE). Any redistribution of the converted `yolov8n.tflite` is subject to those terms.
diff --git a/yolov8n/demo.py b/yolov8n/demo.py
deleted file mode 100644
index 2e9cedb6d0d1e6195953aced05ef0409ef10b463..0000000000000000000000000000000000000000
--- a/yolov8n/demo.py
+++ /dev/null
@@ -1,142 +0,0 @@
-"""
-Demo script for YOLOv8n TFLite model using OpenCV DNN.
-
-Output format:
- - single tensor [1, 84, 8400] -> 84 = 4 box (cx, cy, w, h, normalized [0, 1])
- + 80 COCO class scores (no separate objectness)
-
-Default input size: 640x640 (letterboxed, matching ultralytics.data.augment.LetterBox).
-
-Also handles the NMS-free (v10/26) [1, 300, 6+] head, so the same script works for
-other exported YOLO .tflite models.
-
-Usage:
- python demo.py --model yolov8n.tflite --image example_outputs/input.jpg --output example_outputs/yolov8n_output.jpg
-"""
-
-import argparse
-import cv2
-import numpy as np
-
-
-COCO = [
- "person", "bicycle", "car", "motorbike", "aeroplane", "bus", "train", "truck", "boat", "traffic light",
- "fire hydrant", "stop sign", "parking meter", "bench", "bird", "cat", "dog", "horse", "sheep", "cow",
- "elephant", "bear", "zebra", "giraffe", "backpack", "umbrella", "handbag", "tie", "suitcase", "frisbee",
- "skis", "snowboard", "sports ball", "kite", "baseball bat", "baseball glove", "skateboard", "surfboard", "tennis racket", "bottle",
- "wine glass", "cup", "fork", "knife", "spoon", "bowl", "banana", "apple", "sandwich", "orange",
- "broccoli", "carrot", "hot dog", "pizza", "donut", "cake", "chair", "sofa", "pottedplant", "bed",
- "diningtable", "toilet", "tvmonitor", "laptop", "mouse", "remote", "keyboard", "cell phone", "microwave", "oven",
- "toaster", "sink", "refrigerator", "book", "clock", "vase", "scissors", "teddy bear", "hair drier", "toothbrush",
-]
-
-PAD_COLOR = (114, 114, 114)
-
-
-def letterbox(img, new_h, new_w):
- """Aspect-preserving resize + centered pad (Ultralytics LetterBox defaults, pad=114)."""
- h0, w0 = img.shape[:2]
- ratio = min(new_h / h0, new_w / w0)
- unpad_w, unpad_h = round(w0 * ratio), round(h0 * ratio)
- dw, dh = (new_w - unpad_w) / 2.0, (new_h - unpad_h) / 2.0
- top, bottom = round(dh - 0.1), round(dh + 0.1)
- left, right = round(dw - 0.1), round(dw + 0.1)
- if (unpad_w, unpad_h) != (w0, h0):
- img = cv2.resize(img, (unpad_w, unpad_h), interpolation=cv2.INTER_LINEAR)
- padded = cv2.copyMakeBorder(img, top, bottom, left, right, cv2.BORDER_CONSTANT, value=PAD_COLOR)
- return padded, ratio, left, top
-
-
-def unletterbox(x, y, ratio, pad_x, pad_y):
- return (x - pad_x) / ratio, (y - pad_y) / ratio
-
-
-def is_nms_free_head(shape):
- # v10/26-style heads emit a fixed 300 already-decoded detections with a small row width.
- return len(shape) == 3 and shape[1] == 300 and shape[2] < shape[1]
-
-
-def decode_classic_head(out, net_w, net_h, ratio, pad_x, pad_y, conf_thresh):
- # out: (1, 4+nc, num_anchors) -> (num_anchors, 4+nc)
- pred = out.reshape(out.shape[1], -1).T
- cls_scores = pred[:, 4:]
- class_ids = np.argmax(cls_scores, axis=1)
- confs = cls_scores[np.arange(cls_scores.shape[0]), class_ids]
- keep = confs >= conf_thresh
- pred, class_ids, confs = pred[keep], class_ids[keep], confs[keep]
-
- boxes = []
- for row in pred:
- # normalized [0,1] of the letterboxed input -> original-image pixels
- cx, cy, bw, bh = row[0] * net_w, row[1] * net_h, row[2] * net_w, row[3] * net_h
- x1, y1 = unletterbox(cx - bw / 2.0, cy - bh / 2.0, ratio, pad_x, pad_y)
- x2, y2 = unletterbox(cx + bw / 2.0, cy + bh / 2.0, ratio, pad_x, pad_y)
- boxes.append([x1, y1, x2 - x1, y2 - y1])
- return boxes, confs.tolist(), class_ids.tolist()
-
-
-def decode_nms_free_head(out, ratio, pad_x, pad_y, conf_thresh):
- # out: (1, 300, 6+) -- [x1, y1, x2, y2, conf, class_id, ...]; coords in letterboxed pixels
- dets = out.reshape(out.shape[1], -1)
- boxes, scores, class_ids = [], [], []
- for row in dets:
- if row[4] < conf_thresh:
- continue
- x1, y1 = unletterbox(row[0], row[1], ratio, pad_x, pad_y)
- x2, y2 = unletterbox(row[2], row[3], ratio, pad_x, pad_y)
- boxes.append([x1, y1, x2 - x1, y2 - y1])
- scores.append(float(row[4]))
- class_ids.append(int(row[5]))
- return boxes, scores, class_ids
-
-
-def main():
- parser = argparse.ArgumentParser(description="YOLO TFLite demo (OpenCV DNN)")
- parser.add_argument("--model", required=True, help="Path to TFLite model")
- parser.add_argument("--image", default="example_outputs/input.jpg", help="Path to input image")
- parser.add_argument("--output", default="output.jpg", help="Path for annotated output")
- parser.add_argument("--input-size", type=int, default=640, help="Model input size (W=H)")
- parser.add_argument("--conf", type=float, default=0.5, help="Confidence threshold")
- parser.add_argument("--nms", type=float, default=0.45, help="NMS IoU threshold")
- args = parser.parse_args()
-
- img = cv2.imread(args.image)
- if img is None:
- raise FileNotFoundError(f"Cannot read image: {args.image}")
-
- net = cv2.dnn.readNet(args.model)
-
- imgsz = args.input_size
- padded, ratio, pad_x, pad_y = letterbox(img, imgsz, imgsz)
- blob = cv2.dnn.blobFromImage(padded, 1.0 / 255.0, (imgsz, imgsz), swapRB=True, crop=False)
- net.setInput(blob)
- outs = net.forward(net.getUnconnectedOutLayersNames())
- print("outputs:", [o.shape for o in outs])
-
- # Pick the detection head: the output with the largest last dimension.
- det = max(outs, key=lambda o: o.shape[-1] if o.ndim == 3 else -1)
-
- if is_nms_free_head(det.shape):
- boxes, scores, class_ids = decode_nms_free_head(det, ratio, pad_x, pad_y, args.conf)
- keep = list(range(len(boxes)))
- else:
- boxes, scores, class_ids = decode_classic_head(det, imgsz, imgsz, ratio, pad_x, pad_y, args.conf)
- keep = cv2.dnn.NMSBoxesBatched(boxes, scores, class_ids, args.conf, args.nms)
- keep = np.array(keep).flatten().tolist()
-
- out = img.copy()
- for idx in keep:
- x, y, w, h = (int(v) for v in boxes[idx])
- cls = COCO[class_ids[idx]] if 0 <= class_ids[idx] < 80 else str(class_ids[idx])
- label = f"{cls} {scores[idx]:.2f}"
- cv2.rectangle(out, (x, y), (x + w, y + h), (0, 255, 0), 2)
- cv2.putText(out, label, (x, max(15, y - 5)), cv2.FONT_HERSHEY_SIMPLEX, 0.6, (0, 255, 0), 2)
- print(f" {label} box=[{x},{y},{w},{h}]")
-
- print(f"{len(keep)} detections above conf {args.conf}")
- cv2.imwrite(args.output, out)
- print(f"Saved annotated image: {args.output}")
-
-
-if __name__ == "__main__":
- main()
diff --git a/yolov8n/example_outputs/input.jpg b/yolov8n/example_outputs/input.jpg
deleted file mode 100644
index 4b37071c4b38a5112c700e7a3d46ebb351d9b494..0000000000000000000000000000000000000000
--- a/yolov8n/example_outputs/input.jpg
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:5a9522051c3cec2bbd2f6323fccba32e8fbf3ddcc2b3e2fd46b04c720bc6f866
-size 163759
diff --git a/yolov8n/example_outputs/yolov8n_output.jpg b/yolov8n/example_outputs/yolov8n_output.jpg
deleted file mode 100644
index 6943da2f2717ebbd28dbdf1f94e0037b890c8154..0000000000000000000000000000000000000000
--- a/yolov8n/example_outputs/yolov8n_output.jpg
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:0805a90629d465c4986e8044a363ff824e7a8cac0bf3ac996e8a9f1ac0262ccd
-size 183077
diff --git a/yolov8n/yolov8n.tflite b/yolov8n/yolov8n.tflite
deleted file mode 100644
index 088ea0cbcb26583994408c701cc2d256f0d138f3..0000000000000000000000000000000000000000
--- a/yolov8n/yolov8n.tflite
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:a2dde486ad6ec930ec3be2f9248351baef0ac4b1ad93a083fc80bf4884ed74ae
-size 12841237