Instructions to use nnopt-dev/YOLO11n-TensorRT with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- TensorRT
How to use nnopt-dev/YOLO11n-TensorRT with TensorRT:
# No code snippets available yet for this library. # To use this model, check the repository files and the library's documentation. # Want to help? PRs adding snippets are welcome at: # https://github.com/huggingface/huggingface.js
- Notebooks
- Google Colab
- Kaggle
nnopt port: YOLO11n-TensorRT
Browse filesFiles changed (22)
- .gitattributes+17-32
- LICENSEAdded+661
- NOTICEAdded+6
- README.mdAdded+70
- config.jsonAdded+34
- orin-nano-gpu-int8/build.shAdded+12
- orin-nano-gpu-int8/deploy.shAdded+15
- orin-nano-gpu-int8/fetch.shAdded+28
- orin-nano-gpu-int8/report.htmlAdded
- orin-nano-gpu-int8/report/reproduce.shAdded+14
- orin-nano-gpu-int8/report/results.csvAdded+71
- orin-nano-gpu-int8/report/results.jsonAdded
- orin-nano-gpu-int8/src/build_engine.pyAdded+457
- orin-nano-gpu-int8/src/calib/act_amax.jsonAdded
- orin-nano-gpu-int8/src/cudart.pyAdded+64
- orin-nano-gpu-int8/src/export_weights.pyAdded+160
- orin-nano-gpu-int8/src/port.jsonAdded+1
- orin-nano-gpu-int8/src/prepost.pyAdded+101
- orin-nano-gpu-int8/src/run.pyAdded+99
- orin-nano-gpu-int8/src/run.shAdded+4
- orin-nano-gpu-int8/src/tools/calib_stats.pyAdded+44
- orin-nano-gpu-int8/src/tools/sensitivity.pyAdded+96
1234567891011121314151617181920212223242526272829303132333435*.7z filter=lfs diff=lfs merge=lfs -text*.arrow filter=lfs diff=lfs merge=lfs -text*.bin filter=lfs diff=lfs merge=lfs -text*.bz2 filter=lfs diff=lfs merge=lfs -text*.ckpt filter=lfs diff=lfs merge=lfs -text*.ftz filter=lfs diff=lfs merge=lfs -text*.gz filter=lfs diff=lfs merge=lfs -text*.h5 filter=lfs diff=lfs merge=lfs -text*.joblib filter=lfs diff=lfs merge=lfs -text*.lfs.* filter=lfs diff=lfs merge=lfs -text*.mlmodel filter=lfs diff=lfs merge=lfs -text*.model filter=lfs diff=lfs merge=lfs -text*.msgpack filter=lfs diff=lfs merge=lfs -text*.npy filter=lfs diff=lfs merge=lfs -text*.npz filter=lfs diff=lfs merge=lfs -text*.onnx filter=lfs diff=lfs merge=lfs -text*.ot filter=lfs diff=lfs merge=lfs -text*.parquet filter=lfs diff=lfs merge=lfs -text*.pb filter=lfs diff=lfs merge=lfs -text*.pickle filter=lfs diff=lfs merge=lfs -text*.pkl filter=lfs diff=lfs merge=lfs -text*.pt filter=lfs diff=lfs merge=lfs -text*.pth filter=lfs diff=lfs merge=lfs -text*.rar filter=lfs diff=lfs merge=lfs -text*.safetensors filter=lfs diff=lfs merge=lfs -textsaved_model/**/* filter=lfs diff=lfs merge=lfs -text*.tar.* filter=lfs diff=lfs merge=lfs -text*.tar filter=lfs diff=lfs merge=lfs -text*.tflite filter=lfs diff=lfs merge=lfs -text*.tgz filter=lfs diff=lfs merge=lfs -text*.wasm filter=lfs diff=lfs merge=lfs -text*.xz filter=lfs diff=lfs merge=lfs -text*.zip filter=lfs diff=lfs merge=lfs -text*.zst filter=lfs diff=lfs merge=lfs -text*tfevents* filter=lfs diff=lfs merge=lfs -text1234567891011121314151617181920*.bin filter=lfs diff=lfs merge=lfs -text*.tflite filter=lfs diff=lfs merge=lfs -text*.gguf filter=lfs diff=lfs merge=lfs -text*.onnx filter=lfs diff=lfs merge=lfs -text*.npz filter=lfs diff=lfs merge=lfs -text*.wav filter=lfs diff=lfs merge=lfs -text*.so filter=lfs diff=lfs merge=lfs -text*.bf16 filter=lfs diff=lfs merge=lfs -text*.f16 filter=lfs diff=lfs merge=lfs -text*.f32 filter=lfs diff=lfs merge=lfs -text*.npy filter=lfs diff=lfs merge=lfs -text*.tkb filter=lfs diff=lfs merge=lfs -text*.png filter=lfs diff=lfs merge=lfs -text*.jpg filter=lfs diff=lfs merge=lfs -text*.jpeg filter=lfs diff=lfs merge=lfs -text*.pdf filter=lfs diff=lfs merge=lfs -text*.zip filter=lfs diff=lfs merge=lfs -text*.gz filter=lfs diff=lfs merge=lfs -text*.safetensors filter=lfs diff=lfs merge=lfs -text*.pt filter=lfs diff=lfs merge=lfs -text
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661 GNU AFFERO GENERAL PUBLIC LICENSE Version 3, 19 November 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/> 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 forsoftware and other kinds of works, specifically designed to ensurecooperation with the community in the case of network server software.
The licenses for most software and other practical works are designedto take away your freedom to share and change the works. By contrast,our General Public Licenses are intended to guarantee your freedom toshare and change all versions of a program--to make sure it remains freesoftware for all its users.
When we speak of free software, we are referring to freedom, notprice. Our General Public Licenses are designed to make sure that youhave the freedom to distribute copies of free software (and charge forthem if you wish), that you receive source code or can get it if youwant it, that you can change the software or use pieces of it in newfree programs, and that you know you can do these things.
Developers that use our General Public Licenses protect your rightswith two steps: (1) assert copyright on the software, and (2) offeryou this License which gives you legal permission to copy, distributeand/or modify the software.
A secondary benefit of defending all users' freedom is thatimprovements made in alternate versions of the program, if theyreceive widespread use, become available for other developers toincorporate. Many developers of free software are heartened andencouraged by the resulting cooperation. However, in the case ofsoftware used on network servers, this result may fail to come about.The GNU General Public License permits making a modified version andletting the public access it on a server without ever releasing itssource code to the public.
The GNU Affero General Public License is designed specifically toensure that, in such cases, the modified source code becomes availableto the community. It requires the operator of a network server toprovide the source code of the modified version running there to theusers of that server. Therefore, public use of a modified version, ona publicly accessible server, gives the public access to the sourcecode of the modified version.
An older license, called the Affero General Public License andpublished by Affero, was designed to accomplish similar goals. This isa different license, not a version of the Affero GPL, but Affero hasreleased a new version of the Affero GPL which permits relicensing underthis license.
The precise terms and conditions for copying, distribution andmodification 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 ofworks, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under thisLicense. 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 workin a fashion requiring copyright permission, other than the making of anexact copy. The resulting work is called a "modified version" of theearlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work basedon the Program.
To "propagate" a work means to do anything with it that, withoutpermission, would make you directly or secondarily liable forinfringement under applicable copyright law, except executing it on acomputer or modifying a private copy. Propagation includes copying,distribution (with or without modification), making available to thepublic, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables otherparties to make or receive copies. Mere interaction with a user througha 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 visiblefeature that (1) displays an appropriate copyright notice, and (2)tells the user that there is no warranty for the work (except to theextent that warranties are provided), that licensees may convey thework under this License, and how to view a copy of this License. Ifthe interface presents a list of user commands or options, such as amenu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the workfor making modifications to it. "Object code" means any non-sourceform of a work.
A "Standard Interface" means an interface that either is an officialstandard defined by a recognized standards body, or, in the case ofinterfaces specified for a particular programming language, one thatis widely used among developers working in that language.
The "System Libraries" of an executable work include anything, otherthan the work as a whole, that (a) is included in the normal form ofpackaging a Major Component, but which is not part of that MajorComponent, and (b) serves only to enable use of the work with thatMajor Component, or to implement a Standard Interface for which animplementation 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 toproduce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means allthe source code needed to generate, install, and (for an executablework) run the object code and to modify the work, including scripts tocontrol those activities. However, it does not include the work'sSystem Libraries, or general-purpose tools or generally available freeprograms which are used unmodified in performing those activities butwhich are not part of the work. For example, Corresponding Sourceincludes interface definition files associated with source files forthe work, and the source code for shared libraries and dynamicallylinked subprograms that the work is specifically designed to require,such as by intimate data communication or control flow between thosesubprograms and other parts of the work.
The Corresponding Source need not include anything that userscan regenerate automatically from other parts of the CorrespondingSource.
The Corresponding Source for a work in source code form is thatsame work.
2. Basic Permissions.
All rights granted under this License are granted for the term ofcopyright on the Program, and are irrevocable provided the statedconditions are met. This License explicitly affirms your unlimitedpermission to run the unmodified Program. The output from running acovered work is covered by this License only if the output, given itscontent, constitutes a covered work. This License acknowledges yourrights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do notconvey, without conditions so long as your license otherwise remainsin force. You may convey covered works to others for the sole purposeof having them make modifications exclusively for you, or provide youwith facilities for running those works, provided that you comply withthe terms of this License in conveying all material for which you donot control copyright. Those thus making or running the covered worksfor you must do so exclusively on your behalf, under your directionand control, on terms that prohibit them from making any copies ofyour copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely underthe conditions stated below. Sublicensing is not allowed; section 10makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technologicalmeasure under any applicable law fulfilling obligations under article11 of the WIPO copyright treaty adopted on 20 December 1996, orsimilar laws prohibiting or restricting circumvention of suchmeasures.
When you convey a covered work, you waive any legal power to forbidcircumvention of technological measures to the extent such circumventionis effected by exercising rights under this License with respect tothe covered work, and you disclaim any intention to limit operation ormodification of the work as a means of enforcing, against the work'susers, your or third parties' legal rights to forbid circumvention oftechnological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as youreceive it, in any medium, provided that you conspicuously andappropriately publish on each copy an appropriate copyright notice;keep intact all notices stating that this License and anynon-permissive terms added in accord with section 7 apply to the code;keep intact all notices of the absence of any warranty; and give allrecipients 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 toproduce it from the Program, in the form of source code under theterms 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 independentworks, 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 notused to limit the access or legal rights of the compilation's usersbeyond what the individual works permit. Inclusion of a covered workin an aggregate does not cause this License to apply to the otherparts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the termsof sections 4 and 5, provided that you also convey themachine-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 excludedfrom the Corresponding Source as a System Library, need not beincluded in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means anytangible personal property which is normally used for personal, family,or household purposes, or (2) anything designed or sold for incorporationinto a dwelling. In determining whether a product is a consumer product,doubtful cases shall be resolved in favor of coverage. For a particularproduct received by a particular user, "normally used" refers to atypical or common use of that class of product, regardless of the statusof the particular user or of the way in which the particular useractually uses, or expects or is expected to use, the product. A productis a consumer product regardless of whether the product has substantialcommercial, industrial or non-consumer uses, unless such uses representthe 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 installand execute modified versions of a covered work in that User Product froma modified version of its Corresponding Source. The information mustsuffice to ensure that the continued functioning of the modified objectcode is in no case prevented or interfered with solely becausemodification has been made.
If you convey an object code work under this section in, or with, orspecifically for use in, a User Product, and the conveying occurs aspart of a transaction in which the right of possession and use of theUser Product is transferred to the recipient in perpetuity or for afixed term (regardless of how the transaction is characterized), theCorresponding Source conveyed under this section must be accompaniedby the Installation Information. But this requirement does not applyif neither you nor any third party retains the ability to installmodified object code on the User Product (for example, the work hasbeen installed in ROM).
The requirement to provide Installation Information does not include arequirement to continue to provide support service, warranty, or updatesfor a work that has been modified or installed by the recipient, or forthe User Product in which it has been modified or installed. Access to anetwork may be denied when the modification itself materially andadversely affects the operation of the network or violates the rules andprotocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,in accord with this section must be in a format that is publiclydocumented (and with an implementation available to the public insource code form), and must require no special password or key forunpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of thisLicense by making exceptions from one or more of its conditions.Additional permissions that are applicable to the entire Program shallbe treated as though they were included in this License, to the extentthat they are valid under applicable law. If additional permissionsapply only to part of the Program, that part may be used separatelyunder those permissions, but the entire Program remains governed bythis License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your optionremove any additional permissions from that copy, or from any part ofit. (Additional permissions may be written to require their ownremoval in certain cases when you modify the work.) You may placeadditional 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 youadd to a covered work, you may (if authorized by the copyright holders ofthat 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 "furtherrestrictions" within the meaning of section 10. If the Program as youreceived it, or any part of it, contains a notice stating that it isgoverned by this License along with a term that is a furtherrestriction, you may remove that term. If a license document containsa further restriction but permits relicensing or conveying under thisLicense, you may add to a covered work material governed by the termsof that license document, provided that the further restriction doesnot survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, youmust place, in the relevant source files, a statement of theadditional terms that apply to those files, or a notice indicatingwhere to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in theform 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 expresslyprovided under this License. Any attempt otherwise to propagate ormodify it is void, and will automatically terminate your rights underthis License (including any patent licenses granted under the thirdparagraph of section 11).
However, if you cease all violation of this License, then yourlicense from a particular copyright holder is reinstated (a)provisionally, unless and until the copyright holder explicitly andfinally terminates your license, and (b) permanently, if the copyrightholder fails to notify you of the violation by some reasonable meansprior to 60 days after the cessation.
Moreover, your license from a particular copyright holder isreinstated permanently if the copyright holder notifies you of theviolation by some reasonable means, this is the first time you havereceived notice of violation of this License (for any work) from thatcopyright holder, and you cure the violation prior to 30 days afteryour receipt of the notice.
Termination of your rights under this section does not terminate thelicenses of parties who have received copies or rights from you underthis License. If your rights have been terminated and not permanentlyreinstated, you do not qualify to receive new licenses for the samematerial under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive orrun a copy of the Program. Ancillary propagation of a covered workoccurring solely as a consequence of using peer-to-peer transmissionto receive a copy likewise does not require acceptance. However,nothing other than this License grants you permission to propagate ormodify any covered work. These actions infringe copyright if you donot accept this License. Therefore, by modifying or propagating acovered 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 automaticallyreceives a license from the original licensors, to run, modify andpropagate that work, subject to this License. You are not responsiblefor enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of anorganization, or substantially all assets of one, or subdividing anorganization, or merging organizations. If propagation of a coveredwork results from an entity transaction, each party to thattransaction who receives a copy of the work also receives whateverlicenses to the work the party's predecessor in interest had or couldgive under the previous paragraph, plus a right to possession of theCorresponding Source of the work from the predecessor in interest, ifthe predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of therights granted or affirmed under this License. For example, you maynot impose a license fee, royalty, or other charge for exercise ofrights granted under this License, and you may not initiate litigation(including a cross-claim or counterclaim in a lawsuit) alleging thatany patent claim is infringed by making, using, selling, offering forsale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under thisLicense of the Program or a work on which the Program is based. Thework thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claimsowned or controlled by the contributor, whether already acquired orhereafter acquired, that would be infringed by some manner, permittedby this License, of making, using, or selling its contributor version,but do not include claims that would be infringed only as aconsequence of further modification of the contributor version. Forpurposes of this definition, "control" includes the right to grantpatent sublicenses in a manner consistent with the requirements ofthis License.
Each contributor grants you a non-exclusive, worldwide, royalty-freepatent license under the contributor's essential patent claims, tomake, use, sell, offer for sale, import and otherwise run, modify andpropagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any expressagreement or commitment, however denominated, not to enforce a patent(such as an express permission to practice a patent or covenant not tosue for patent infringement). To "grant" such a patent license to aparty means to make such an agreement or commitment not to enforce apatent 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 anyoneto copy, free of charge and under the terms of this License, through apublicly available network server or other readily accessible means,then you must either (1) cause the Corresponding Source to be soavailable, or (2) arrange to deprive yourself of the benefit of thepatent license for this particular work, or (3) arrange, in a mannerconsistent with the requirements of this License, to extend the patentlicense to downstream recipients. "Knowingly relying" means you haveactual knowledge that, but for the patent license, your conveying thecovered work in a country, or your recipient's use of the covered workin a country, would infringe one or more identifiable patents in thatcountry that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction orarrangement, you convey, or propagate by procuring conveyance of, acovered work, and grant a patent license to some of the partiesreceiving the covered work authorizing them to use, propagate, modifyor convey a specific copy of the covered work, then the patent licenseyou grant is automatically extended to all recipients of the coveredwork and works based on it.
A patent license is "discriminatory" if it does not include withinthe scope of its coverage, prohibits the exercise of, or isconditioned on the non-exercise of one or more of the rights that arespecifically granted under this License. You may not convey a coveredwork if you are a party to an arrangement with a third party that isin the business of distributing software, under which you make paymentto the third party based on the extent of your activity of conveyingthe work, and under which the third party grants, to any of theparties who would receive the covered work from you, a discriminatorypatent license (a) in connection with copies of the covered workconveyed by you (or copies made from those copies), or (b) primarilyfor and in connection with specific products or compilations thatcontain 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 limitingany implied license or other defenses to infringement that mayotherwise 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 orotherwise) that contradict the conditions of this License, they do notexcuse you from the conditions of this License. If you cannot convey acovered work so as to satisfy simultaneously your obligations under thisLicense and any other pertinent obligations, then as a consequence you maynot convey it at all. For example, if you agree to terms that obligate youto collect a royalty for further conveying from those to whom you conveythe Program, the only way you could satisfy both those terms and thisLicense 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 theProgram, your modified version must prominently offer all usersinteracting with it remotely through a computer network (if your versionsupports such interaction) an opportunity to receive the CorrespondingSource of your version by providing access to the Corresponding Sourcefrom a network server at no charge, through some standard or customarymeans of facilitating copying of software. This Corresponding Sourceshall include the Corresponding Source for any work covered by version 3of the GNU General Public License that is incorporated pursuant to thefollowing paragraph.
Notwithstanding any other provision of this License, you havepermission to link or combine any covered work with a work licensedunder version 3 of the GNU General Public License into a singlecombined work, and to convey the resulting work. The terms of thisLicense will continue to apply to the part which is the covered work,but the work with which it is combined will remain governed by version3 of the GNU General Public License.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions ofthe GNU Affero General Public License from time to time. Such new versionswill be similar in spirit to the present version, but may differ in detail toaddress new problems or concerns.
Each version is given a distinguishing version number. If theProgram specifies that a certain numbered version of the GNU Affero GeneralPublic License "or any later version" applies to it, you have theoption of following the terms and conditions either of that numberedversion or of any later version published by the Free SoftwareFoundation. If the Program does not specify a version number of theGNU Affero General Public License, you may choose any version ever publishedby the Free Software Foundation.
If the Program specifies that a proxy can decide which futureversions of the GNU Affero General Public License can be used, that proxy'spublic statement of acceptance of a version permanently authorizes youto choose that version for the Program.
Later license versions may give you additional or differentpermissions. However, no additional obligations are imposed on anyauthor or copyright holder as a result of your choosing to follow alater version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BYAPPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHTHOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTYOF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULARPURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAMIS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OFALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITINGWILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYSTHE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANYGENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THEUSE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OFDATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRDPARTIES 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 OFSUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability providedabove cannot be given local legal effect according to their terms,reviewing courts shall apply local law that most closely approximatesan absolute waiver of all civil liability in connection with theProgram, unless a warranty or assumption of liability accompanies acopy 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 greatestpossible use to the public, the best way to achieve this is to make itfree software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safestto attach them to the start of each source file to most effectivelystate the exclusion of warranty; and each file should have at leastthe "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.> Copyright (C) <year> <name of author>
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 <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If your software can interact with users remotely through a computernetwork, you should also make sure that it provides a way for users toget its source. For example, if your program is a web application, itsinterface could display a "Source" link that leads users to an archiveof the code. There are many ways you could offer source, and differentsolutions will be better for different programs; see section 13 for thespecific 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<https://www.gnu.org/licenses/>.123456This repository is a modified version of Ultralytics/YOLO11 by Ultralytics, revision v8.3.0 (yolo11n.pt, sha256 0ebbc80d4a7680d14987a577cd21342b65ecfd94632bd9a8da63ae6417644ee1).
Changes, made by nnopt (https://nnopt.dev):- `orin-nano-gpu-int8/` (nnopt job NN-373FB4): fetched: fetch.sh downloads yolo11n.pt from Ultralytics; the INT8 engine is built on the Jetson by deploy.sh. The runtime code (src/, build.sh, deploy.sh, run.sh) is new, written by nnopt's agents for this device.
YOLO11n is Copyright Ultralytics and licensed under AGPL-3.0 (LICENSE). As AGPL-3.0 requires, the complete source of every modification is in this repository (src/, build.sh, deploy.sh). Ultralytics also offers an Enterprise License for uses that cannot follow AGPL-3.0: https://www.ultralytics.com/license12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970---license: agpl-3.0base_model: Ultralytics/YOLO11pipeline_tag: object-detectiontags:- on-device- nnopt- tensorrt- cuda- jetson- gpu- int8- object-detection- jetson-orin-nano---
# YOLO11n on NVIDIA Jetson Orin Nano (TensorRT)
Ported and verified on a real NVIDIA Jetson Orin Nano by [nnopt.dev](https://nnopt.dev) — AI agents that port and optimize models for the hardware you ship.
The model is [Ultralytics YOLO11n](https://huggingface.co/Ultralytics/YOLO11) (`yolo11n.pt` v8.3.0) by Ultralytics, and it is theirs. The TensorRT port in this repository is nnopt's work: nnopt job NN-373FB4.
| | ||---|---|| Device | NVIDIA Jetson Orin Nano, JetPack 6 (Linux) || Chip | Jetson Orin Nano || Processor | GPU (Jetson Orin Nano, CUDA) || Runtime | TensorRT 10.3 (Python API) + CUDA 12.6, JetPack 6 || Precision | int8 || Modality | image -> objects (detection) || Weights | fetched: fetch.sh downloads yolo11n.pt from Ultralytics; the INT8 engine is built on the Jetson by deploy.sh || nnopt job | NN-373FB4 (port) || Folder | [`orin-nano-gpu-int8/`](https://huggingface.co/nnopt-dev/YOLO11n-TensorRT/tree/main/orin-nano-gpu-int8) |
## Verified results
nnopt built the folder from a clean copy, deployed it to the device and checked it against the model's reference code on hidden inputs. The full report is `report.html` in the folder.
- Passed. mAP@0.5 vs reference 95.6% (bar at least 85.0%, int8 precision)- Throughput 187 images/s- Latency 5.4 ms- Load time 519 ms- Peak memory 455 MB
## Use it
```mkdir YOLO11n-TensorRT && cd YOLO11n-TensorRTcurl -fsSL https://huggingface.co/nnopt-dev/YOLO11n-TensorRT/resolve/main/config.json -o config.jsonhf download nnopt-dev/YOLO11n-TensorRT --include "orin-nano-gpu-int8/*" --local-dir .cd orin-nano-gpu-int8bash fetch.shNNOPT_WEIGHTS=$PWD/weights/yolo11n.pt bash build.sh # python3 with torch + numpy: module tree + BN-fused weightsbash deploy.sh nnopt/port # rsync to ssh host 'jetson', builds the INT8 TensorRT engine there (~10 min)ssh jetson 'cd nnopt/port && sh ./run.sh --image bus.jpg --repeat 10 --out out.json --metrics m.json'```
Needs: A build host with python3, torch and numpy; a Jetson Orin Nano with JetPack 6 (TensorRT 10.3, CUDA 12.6) reachable as ssh host `jetson`.
`README.md` in the folder has every flag, the requirements and the known limits; `REPRO.md` (where present) reproduces the measurements.
## License
AGPL-3.0, like Ultralytics YOLO11: see LICENSE and NOTICE. The full source of the port is in this repository. For uses that cannot follow AGPL-3.0, Ultralytics offers an Enterprise License.
## Made with nnopt
[nnopt](https://nnopt.dev) is a platform where AI agents port, optimize and benchmark a model for a specific device. They write the runtime code on the real device, and a locked verification kit then checks the result against the model's own reference code before anything ships. Every number on this page comes from that check.
Want your model on your device? Start a job at [nnopt.dev](https://nnopt.dev).12345678910111213141516171819202122232425262728293031323334{ "nnopt_manifest": 1, "repo": "nnopt-dev/YOLO11n-TensorRT", "model": { "name": "YOLO11n", "source_repo": "Ultralytics/YOLO11", "source_revision": "v8.3.0 (yolo11n.pt, sha256 0ebbc80d4a7680d14987a577cd21342b65ecfd94632bd9a8da63ae6417644ee1)", "source_file": "https://github.com/ultralytics/assets/releases/download/v8.3.0/yolo11n.pt", "authors": "Ultralytics", "license": "agpl-3.0" }, "variants": [ { "id": "orin-nano-gpu-int8", "device": "NVIDIA Jetson Orin Nano", "chip": "Jetson Orin Nano", "os": "JetPack 6 (Linux)", "processor": "GPU (Jetson Orin Nano, CUDA)", "runtime": "TensorRT 10.3 (Python API) + CUDA 12.6, JetPack 6", "runtime_version": "TensorRT 10.3", "precision": "int8", "weights": "fetched: fetch.sh downloads yolo11n.pt from Ultralytics; the INT8 engine is built on the Jetson by deploy.sh", "nnopt_job": "NN-373FB4", "job_kind": "port", "verified": { "verdict": "Passed. mAP@0.5 vs reference 95.6% (bar at least 85.0%, int8 precision)", "speed": "Throughput 187 images/s; Latency 5.4 ms; Load time 519 ms; Peak memory 455 MB" }, "fetch": "orin-nano-gpu-int8/fetch.sh" } ], "license": "agpl-3.0", "made_by": "nnopt (https://nnopt.dev)"}123456789101112#!/bin/bash# Build host step: extract the customer's checkpoint into a module tree (model.json) + BN-fused fp32 weights# (weights.npz). Needs only python3 with torch + numpy (no ultralytics). The TensorRT engine itself is built on# the Jetson by deploy.sh (engines are device-specific).set -euo pipefailcd "$(dirname "$0")"WEIGHTS="${NNOPT_WEIGHTS:-/work/inputs/weights/yolo11n.pt}"rm -rf build && mkdir -p build/modelpython3 -I src/export_weights.py "$WEIGHTS" build/modelcp src/run.py src/prepost.py src/cudart.py src/build_engine.py src/run.sh src/port.json build/cp src/calib/act_amax.json build/model/act_amax.jsonecho "build ok: $(ls build build/model | tr '\n' ' ')"123456789101112131415#!/bin/bash# usage: bash deploy.sh DEST (DEST: folder on the Jetson, absolute or relative to the home folder)# Copies the runtime + weights to DEST and builds the INT8 TensorRT engine there (DEST/model.engine).set -euo pipefailcd "$(dirname "$0")"DEST="${1:?usage: deploy.sh DEST}"SSH="ssh -o BatchMode=yes jetson"[ -f build/model/weights.npz ] || { echo "run build.sh first" >&2; exit 1; }$SSH "mkdir -p '$DEST'"rsync -a --delete build/ "jetson:$DEST/"# explicit INT8 (Q/DQ): activation ranges from src/calib/act_amax.json, per-channel weight scales, fp16 elsewhere$SSH "cd '$DEST' && rm -f model.engine && python3 build_engine.py --model model --out model.engine \ --precision int8qdq --amax model/act_amax.json 2>&1 | grep -v -i -E 'deprecat|obedient|obeys'; test -s model.engine"$SSH "cd '$DEST' && ls -la && test -f run.sh"echo "deployed to jetson:$DEST"12345678910111213141516171819202122232425262728#!/usr/bin/env bash# Run once after downloading this folder: bash fetch.sh# Downloads Ultralytics' yolo11n.pt (v8.3.0, sha256-checked).set -euo pipefailcd "$(dirname "$0")"REPO=nnopt-dev/YOLO11n-TensorRT
# The repository's manifest first (Hugging Face counts a download when config.json is requested).curl -fsSL "https://huggingface.co/$REPO/resolve/main/config.json" -o ../config.json
sha256_of() { if command -v sha256sum >/dev/null 2>&1; then sha256sum "$1" | cut -d" " -f1; else shasum -a 256 "$1" | cut -d" " -f1; fi; }get() { # get URL FILE SHA256: download once, check the sha256 if [ -f "$2" ] && [ "$(sha256_of "$2")" = "$3" ]; then return 0; fi mkdir -p "$(dirname "$2")" curl -fL --retry 3 -o "$2.part" "$1" [ "$(sha256_of "$2.part")" = "$3" ] || { echo "fetch.sh: sha256 mismatch for $1" >&2; rm -f "$2.part"; exit 1; } mv "$2.part" "$2"}git_at() { # git_at URL COMMIT DIR: the exact commit, shallow if [ "$(git -C "$3" rev-parse HEAD 2>/dev/null || true)" = "$2" ]; then return 0; fi rm -rf "$3"; mkdir -p "$3" git -C "$3" init -q && git -C "$3" remote add origin "$1" git -C "$3" fetch -q --depth 1 origin "$2" && git -C "$3" -c advice.detachedHead=false checkout -q FETCH_HEAD}
get "https://github.com/ultralytics/assets/releases/download/v8.3.0/yolo11n.pt" \ weights/yolo11n.pt 0ebbc80d4a7680d14987a577cd21342b65ecfd94632bd9a8da63ae6417644ee1echo "fetch.sh: done. Next: NNOPT_WEIGHTS=$PWD/weights/yolo11n.pt bash build.sh, then bash deploy.sh nnopt/port"1234567891011121314#!/bin/sh# Reproduce the numbers in report.html with nnopt-verify 0.1.0.# Needs: the frozen reference bundle, the port deployed on the device (./deploy.sh), and the device reachable.# Connection: SSH_TARGET=user@host.set -eBUNDLE=${BUNDLE:-./reference-bundle} # bundle digest 6eda989b4342a95d04cff483210d622ad6220800f1361722620c812a919ff183PORT_DIR=${PORT_DIR:-/home/user/nnopt/port} # where deploy.sh put the portOUT=${OUT:-./reproduced}mkdir -p "$OUT"
nnopt-verify check --bundle "$BUNDLE" --port "$PORT_DIR" --executor ssh --ssh "$SSH_TARGET" --precision int8 --split all --out "$OUT/check.json"nnopt-verify bench --bundle "$BUNDLE" --port "$PORT_DIR" --executor ssh --ssh "$SSH_TARGET" --warmup 2 --runs 5 --repeat 3 --max-new-tokens 128 --sustained-s 0.0 --resolution 640x640 --env-specs '{"device": "NVIDIA Jetson Orin Nano", "gpu": "Ampere, 1024 CUDA cores", "name": "NVIDIA Jetson Orin Nano"}' --out "$OUT/bench.json"nnopt-verify grade --check "$OUT/check.json" --bench "$OUT/bench.json" --out "$OUT/grade.json"nnopt-verify report --check "$OUT/check.json" --bench "$OUT/bench.json" --grade "$OUT/grade.json" --bundle "$BUNDLE" --out "$OUT/report"1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071section,name,value,unit_or_op,threshold,passed
grade,correctness,True,,,True
grade,speed_target_met,,,,
check,cases_completed,1.0,>=,1.0,True
check,reference_detections,157.0,>=,1.0,True
check,detection_recall,0.97452,>=,0.93,True
check,detection_precision,0.98693,>=,0.93,True
check,map50_vs_reference,0.95552,>=,0.85,True
check,box_iou,0.98061,>=,0.9,True
check,score_drift,0.020219,<=,0.06,True
check_metric,detection_recall,0.97452,,,
check_metric,detection_precision,0.98693,,,
check_metric,map50_vs_reference,0.95552,,,
check_metric,box_iou,0.98061,,,
check_metric,score_drift,0.020219,,,
check_metric,max_score_drift,0.15486,,,
check_metric,reference_detections,157,,,
check_metric,port_detections,153,,,
check_metric,comparison_threshold,0.3041,,,
check_metric,score_margin,0.05,,,
check_metric,iou_match,0.5,,,
check_metric,per_class,"[{'class': 0, 'name': 'class 0', 'objects': 64, 'ap50': 0.9577}, {'class': 2, 'name': 'class 2', 'objects': 19, 'ap50': 1.0}, {'class': 11, 'name': 'class 11', 'objects': 9, 'ap50': 1.0}, {'class': 9, 'name': 'class 9', 'objects': 6, 'ap50': 1.0}, {'class': 62, 'name': 'class 62', 'objects': 5, 'ap50': 1.0}, {'class': 58, 'name': 'class 58', 'objects': 5, 'ap50': 1.0}, {'class': 56, 'name': 'class 56', 'objects': 4, 'ap50': 1.0}, {'class': 7, 'name': 'class 7', 'objects': 4, 'ap50': 1.0}, {'class': 4, 'name': 'class 4', 'objects': 4, 'ap50': 1.0}, {'class': 3, 'name': 'class 3', 'objects': 4, 'ap50': 0.7525}, {'class': 74, 'name': 'class 74', 'objects': 3, 'ap50': 1.0}, {'class': 38, 'name': 'class 38', 'objects': 3, 'ap50': 1.0}, {'class': 15, 'name': 'class 15', 'objects': 3, 'ap50': 1.0}, {'class': 5, 'name': 'class 5', 'objects': 2, 'ap50': 1.0}, {'class': 75, 'name': 'class 75', 'objects': 2, 'ap50': 1.0}, {'class': 59, 'name': 'class 59', 'objects': 2, 'ap50': 1.0}, {'class': 34, 'name': 'class 34', 'objects': 2, 'ap50': 1.0}, {'class': 50, 'name': 'class 50', 'objects': 2, 'ap50': 1.0}, {'class': 41, 'name': 'class 41', 'objects': 2, 'ap50': 1.0}, {'class': 31, 'name': 'class 31', 'objects': 2, 'ap50': 1.0}, {'class': 25, 'name': 'class 25', 'objects': 2, 'ap50': 1.0}, {'class': 33, 'name': 'class 33', 'objects': 1, 'ap50': 1.0}, {'class': 72, 'name': 'class 72', 'objects': 1, 'ap50': 1.0}, {'class': 60, 'name': 'class 60', 'objects': 1, 'ap50': 1.0}, {'class': 39, 'name': 'class 39', 'objects': 1, 'ap50': 1.0}, {'class': 49, 'name': 'class 49', 'objects': 1, 'ap50': 1.0}, {'class': 30, 'name': 'class 30', 'objects': 1, 'ap50': 0.0}, {'class': 27, 'name': 'class 27', 'objects': 1, 'ap50': 1.0}, {'class': 16, 'name': 'class 16', 'objects': 1, 'ap50': 1.0}]",,,
bench,fps.median,186.632,img/s,,
bench,fps.p10,185.181,img/s,,
bench,fps.p90,187.569,img/s,,
bench,fps.min,178.989,img/s,,
bench,fps.max,188.623,img/s,,
bench,fps.n,1860,img/s,,
bench,latency_ms.median,5.35813,ms,,
bench,latency_ms.p10,5.33136,ms,,
bench,latency_ms.p90,5.40011,ms,,
bench,latency_ms.min,5.30158,ms,,
bench,latency_ms.max,5.58693,ms,,
bench,latency_ms.n,1860,ms,,
bench,per_image_ms.median,5.35813,ms,,
bench,per_image_ms.p10,5.33136,ms,,
bench,per_image_ms.p90,5.40011,ms,,
bench,per_image_ms.min,5.30158,ms,,
bench,per_image_ms.max,5.58693,ms,,
bench,per_image_ms.n,1860,ms,,
bench,cold_latency_ms.median,5.63871,ms,,
bench,cold_latency_ms.p10,5.59194,ms,,
bench,cold_latency_ms.p90,5.704,ms,,
bench,cold_latency_ms.min,5.56226,ms,,
bench,cold_latency_ms.max,5.72201,ms,,
bench,cold_latency_ms.n,5,ms,,
bench,load_ms.median,518.979,ms,,
bench,load_ms.p10,515.093,ms,,
bench,load_ms.p90,524.296,ms,,
bench,load_ms.min,513.939,ms,,
bench,load_ms.max,526.767,ms,,
bench,load_ms.n,5,ms,,
bench,wall_ms.median,2688.6,ms,,
bench,wall_ms.p10,2682.09,ms,,
bench,wall_ms.p90,2699.67,ms,,
bench,wall_ms.min,2678.53,ms,,
bench,wall_ms.max,2704.35,ms,,
bench,wall_ms.n,5,ms,,
bench,peak_rss_mb,454.8,MB,,
bench,peak_hwm_mb,454.8,MB,,
bench,self_reported_peak_mem_mb,453.8,MB,,
graded,fps,186.632,img/s,,
graded,latency_ms,5.35813,ms,,
graded,per_image_ms,5.35813,ms,,
graded,cold_latency_ms,5.63871,ms,,
graded,load_ms,518.979,ms,,
graded,wall_ms,2688.6,ms,,
graded,peak_mem_mb,454.8,MB,,
graded,system_ram_delta_mb,312.0,MB,,
roofline,mem_bandwidth_gbps,,,,
roofline,peak_gflops,,,,123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457"""Build the YOLO11 TensorRT engine from model.json + weights.npz (written by export_weights.py).
The network is defined layer by layer with the TensorRT network API, following the checkpoint's module tree.Each builder function quotes the ultralytics source it implements (reference_code commit fc26c3d).
usage: python3 build_engine.py --model DIR --out ENGINE [--precision int8|fp16|fp32] [--calib-cache FILE] [--calib-images DIR]"""import argparseimport globimport jsonimport osimport sysimport time
import numpy as npimport tensorrt as trt
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
IMGSZ = 640LOGGER = trt.Logger(trt.Logger.WARNING)
class Net: def __init__(self, network, weights): self.net = network self.w = weights self.keep = [] # numpy arrays must outlive the build self.fp_layers = [] # layers we may pin to fp16 (precision-sensitive) self.amax = None # explicit INT8: {conv path: activation amax}; convs listed here get Q/DQ inputs self.qdq_skip = ()
def _qdq(self, x, scale, name, axis=None): """Quantize to int8 and dequantize back (TensorRT fuses the pair into the consumer's int8 kernel).""" sc = np.ascontiguousarray(np.asarray(scale, np.float32)) self.keep.append(sc) c = self._name(self.net.add_constant(sc.shape, trt.Weights(sc)), name + ".scale").get_output(0) q = self.net.add_quantize(x, c) if axis is not None: q.axis = axis dq = self.net.add_dequantize(q.get_output(0), c) if axis is not None: dq.axis = axis self._name(q, name + ".q") return self._name(dq, name + ".dq").get_output(0)
def _name(self, layer, name): layer.name = name for i in range(layer.num_outputs): layer.get_output(i).name = name if layer.num_outputs == 1 else f"{name}:{i}" return layer
def const(self, arr, name): arr = np.ascontiguousarray(arr, dtype=np.float32) self.keep.append(arr) return self._name(self.net.add_constant(arr.shape, trt.Weights(arr)), name).get_output(0)
def ew(self, a, b, op, name): return self._name(self.net.add_elementwise(a, b, op), name).get_output(0)
def reshape(self, x, shape, name): l = self.net.add_shuffle(x) l.reshape_dims = tuple(shape) return self._name(l, name).get_output(0)
def slice(self, x, axis, start, size, name): shp = list(x.shape) st = [0] * len(shp) st[axis] = start shp[axis] = size return self._name(self.net.add_slice(x, st, shp, [1] * len(shp)), name).get_output(0)
def concat(self, xs, axis, name): l = self.net.add_concatenation(xs) l.axis = axis return self._name(l, name).get_output(0)
# ultralytics/nn/modules/conv.py Conv (BN folded at export, as Conv.forward_fuse after fuse_conv_and_bn): # self.conv = nn.Conv2d(c1, c2, k, s, autopad(k, p, d), groups=g, dilation=d, bias=False) # def forward_fuse(self, x): return self.act(self.conv(x)) # act = nn.SiLU() or nn.Identity() # DWConv(Conv) is the same with groups=gcd(c1, c2); a plain nn.Conv2d (Detect's last 1x1 convs) has no act. def conv(self, x, node, w=None): p = node["path"] w = self.w[p + ".w"] if w is None else w b = self.w.get(p + ".b") if b is None: b = np.zeros(node["cout"], np.float32) w = np.ascontiguousarray(w, np.float32) b = np.ascontiguousarray(b, np.float32) self.keep += [w, b] quant = self.amax is not None and p in self.amax and not any(p == k or p.startswith(k + ".") for k in self.qdq_skip) if quant: # explicit INT8: per-tensor activation scale (calibrated amax / 127), per-output-channel weight scale x = self._qdq(x, max(self.amax[p], 1e-6) / 127.0, p + ".in") wa = np.maximum(np.abs(w).reshape(w.shape[0], -1).max(1), 1e-8) / 127.0 wt = self._name(self.net.add_constant(w.shape, trt.Weights(w)), p + ".wconst").get_output(0) wt = self._qdq(wt, wa, p + ".w", axis=0) l = self.net.add_convolution_nd(x, node["cout"], tuple(node["k"]), trt.Weights(), trt.Weights(b)) l.set_input(1, wt) else: l = self.net.add_convolution_nd(x, node["cout"], tuple(node["k"]), trt.Weights(w), trt.Weights(b)) l.stride_nd = tuple(node["s"]) l.padding_nd = tuple(node["p"]) l.num_groups = node["g"] self._name(l, p) y = l.get_output(0) act = node.get("act", "Identity") if act == "SiLU": # x * sigmoid(x) s = self._name(self.net.add_activation(y, trt.ActivationType.SIGMOID), p + ".sig").get_output(0) y = self.ew(y, s, trt.ElementWiseOperation.PROD, p + ".act") elif act != "Identity": raise NotImplementedError(f"activation {act} at {p}") return y, l
def conv_(self, x, node): return self.conv(x, node)[0]
# ultralytics/nn/modules/block.py:460-482 Bottleneck # def forward(self, x): return x + self.cv2(self.cv1(x)) if self.add else self.cv2(self.cv1(x)) def bottleneck(self, x, node): c = node["children"] y = self.conv_(self.conv_(x, c["cv1"]), c["cv2"]) return self.ew(x, y, trt.ElementWiseOperation.SUM, node["path"] + ".add") if node.get("add") else y
# ultralytics/nn/modules/block.py:325-348 C3 (C3k subclasses it, block.py:1109-1127) # def forward(self, x): return self.cv3(torch.cat((self.m(self.cv1(x)), self.cv2(x)), 1)) def c3(self, x, node): c = node["children"] a = self.module(self.conv_(x, c["cv1"]), c["m"]) b = self.conv_(x, c["cv2"]) return self.conv_(self.concat([a, b], 1, node["path"] + ".cat"), c["cv3"])
# ultralytics/nn/modules/block.py:291-322 C2f (C3k2 subclasses it, block.py:1069-1106) # def forward(self, x): # y = list(self.cv1(x).chunk(2, 1)) # y.extend((m(y[-1]) for m in self.m)) # return self.cv2(torch.cat(y, 1)) def c2f(self, x, node): c, p = node["children"], node["path"] y0 = self.conv_(x, c["cv1"]) ch = y0.shape[1] // 2 y = [self.slice(y0, 1, 0, ch, p + ".chunk0"), self.slice(y0, 1, ch, ch, p + ".chunk1")] for k in sorted(c["m"]["children"], key=int): y.append(self.module(y[-1], c["m"]["children"][k])) return self.conv_(self.concat(y, 1, p + ".cat"), c["cv2"])
# ultralytics/nn/modules/block.py:211-240 SPPF # y = [self.cv1(x)] # y.extend((self.m(y[-1]) for _ in range(getattr(self, 'n', 3)))) # y = self.cv2(torch.cat(y, 1)) # return y + x if getattr(self, 'add', False) else y def sppf(self, x, node): c, p = node["children"], node["path"] mp = c["m"] y = [self.conv_(x, c["cv1"])] for i in range(node.get("n", 3)): k, s, pad = mp["kernel_size"], mp["stride"], mp["padding"] l = self.net.add_pooling_nd(y[-1], trt.PoolingType.MAX, (k, k)) l.stride_nd = (s, s) l.padding_nd = (pad, pad) y.append(self._name(l, f"{p}.m{i}").get_output(0)) out = self.conv_(self.concat(y, 1, p + ".cat"), c["cv2"]) return self.ew(out, x, trt.ElementWiseOperation.SUM, p + ".add") if node.get("add") else out
# ultralytics/nn/modules/block.py:1442-1494 C2PSA # a, b = self.cv1(x).split((self.c, self.c), dim=1) # b = self.m(b) # return self.cv2(torch.cat((a, b), 1)) def c2psa(self, x, node): c, p, cc = node["children"], node["path"], node["c"] y = self.conv_(x, c["cv1"]) a = self.slice(y, 1, 0, cc, p + ".a") b = self.module(self.slice(y, 1, cc, cc, p + ".b"), c["m"]) return self.conv_(self.concat([a, b], 1, p + ".cat"), c["cv2"])
# ultralytics/nn/modules/block.py:1337-1384 PSABlock # x = x + self.attn(x) if self.add else self.attn(x) # x = x + self.ffn(x) if self.add else self.ffn(x) def psablock(self, x, node): c, p = node["children"], node["path"] a = self.module(x, c["attn"]) x = self.ew(x, a, trt.ElementWiseOperation.SUM, p + ".add1") if node.get("add") else a f = self.module(x, c["ffn"]) return self.ew(x, f, trt.ElementWiseOperation.SUM, p + ".add2") if node.get("add") else f
# ultralytics/nn/modules/block.py:1271-1334 Attention # B, C, H, W = x.shape; N = H * W # qkv = self.qkv(x) # q, k, v = qkv.view(B, self.num_heads, self.key_dim * 2 + self.head_dim, N).split( # [self.key_dim, self.key_dim, self.head_dim], dim=2) # attn = ((q * self.scale).transpose(-2, -1) @ k).softmax(dim=-1) # x = (v @ attn.transpose(-2, -1)).view(B, C, H, W) + self.pe(v.reshape(B, C, H, W)) # x = self.proj(x) def attention(self, x, node): c, p = node["children"], node["path"] B, C, H, W = x.shape N = H * W nh, kd, hd = node["num_heads"], node["key_dim"], node["head_dim"] qkv = self.reshape(self.conv_(x, c["qkv"]), (B, nh, 2 * kd + hd, N), p + ".qkv_view") q = self.slice(qkv, 2, 0, kd, p + ".q") k = self.slice(qkv, 2, kd, kd, p + ".k") v = self.slice(qkv, 2, 2 * kd, hd, p + ".v") q = self.ew(q, self.const(np.full((1, 1, 1, 1), node["scale"]), p + ".scale_c"), trt.ElementWiseOperation.PROD, p + ".qs") mm = self.net.add_matrix_multiply(q, trt.MatrixOperation.TRANSPOSE, k, trt.MatrixOperation.NONE) self._name(mm, p + ".qk") self.fp_layers.append(mm) sm = self.net.add_softmax(mm.get_output(0)) sm.axes = 1 << 3 self._name(sm, p + ".softmax") self.fp_layers.append(sm) mm2 = self.net.add_matrix_multiply(v, trt.MatrixOperation.NONE, sm.get_output(0), trt.MatrixOperation.TRANSPOSE) self._name(mm2, p + ".av") self.fp_layers.append(mm2) o = self.reshape(mm2.get_output(0), (B, C, H, W), p + ".av_view") pe = self.conv_(self.reshape(v, (B, C, H, W), p + ".v_view"), c["pe"]) o = self.ew(o, pe, trt.ElementWiseOperation.SUM, p + ".pe_add") return self.conv_(o, c["proj"])
def sequential(self, x, node): for k in sorted(node["children"], key=int): x = self.module(x, node["children"][k]) return x
# torch.nn.Upsample(scale_factor=2, mode="nearest"): out[y, x] = in[floor(y / 2), floor(x / 2)] def upsample(self, x, node): assert node.get("mode", "nearest") == "nearest" s = float(node["scale_factor"]) l = self.net.add_resize(x) l.resize_mode = trt.InterpolationMode.NEAREST l.scales = [1.0, 1.0, s, s] l.coordinate_transformation = trt.ResizeCoordinateTransformation.ASYMMETRIC l.nearest_rounding = trt.ResizeRoundMode.FLOOR return self._name(l, node["path"]).get_output(0)
def module(self, x, node): t = node["type"] if t in ("Conv", "DWConv", "Conv2d"): return self.conv_(x, node) fn = {"Bottleneck": self.bottleneck, "C3k": self.c3, "C3": self.c3, "C3k2": self.c2f, "C2f": self.c2f, "SPPF": self.sppf, "C2PSA": self.c2psa, "PSABlock": self.psablock, "Attention": self.attention, "Sequential": self.sequential, "Upsample": self.upsample}.get(t) if fn is None: raise NotImplementedError(f"module type {t} at {node['path']}") return fn(x, node)
# ultralytics/nn/modules/head.py:38-295 Detect (one-to-many head, inference, export=False): # boxes = torch.cat([box_head[i](x[i]).view(bs, 4 * self.reg_max, -1) for i in range(self.nl)], dim=-1) # scores = torch.cat([cls_head[i](x[i]).view(bs, self.nc, -1) for i in range(self.nl)], dim=-1) # dbox = self.decode_bboxes(self.dfl(x['boxes']), self.anchors.unsqueeze(0)) * self.strides # y = torch.cat((dbox, x['scores'].sigmoid()), 1) # block.py:60-81 DFL: self.conv(x.view(b, 4, self.c1, a).transpose(2, 1).softmax(1)).view(b, 4, a) # utils/tal.py make_anchors(offset 0.5): anchor (sx, sy) = (x + 0.5, y + 0.5), row-major over (y, x) # utils/tal.py dist2bbox: lt, rb = distance.chunk(2, dim); x1y1 = anchor - lt; x2y2 = anchor + rb # We emit xyxy directly (nms.py converts the reference's xywh to xyxy before NMS), then the best class per # anchor (non_max_suppression multi_label=False: conf, j = cls.max(1)) so the host only filters + NMSes. def detect(self, xs, node): c, p = node["children"], node["path"] nc, reg_max = node["nc"], node["reg_max"] strides = node["stride"] assert not node.get("end2end") and "one2one_cv2" not in c, "end2end heads not supported" boxes, scores, anchors, stride_t = [], [], [], [] for i, x in enumerate(xs): _, _, H, W = x.shape bh = c["cv2"]["children"][str(i)] ch = c["cv3"]["children"][str(i)] b = self.sequential(x, bh) s = self.sequential(x, ch) boxes.append(self.reshape(b, (1, 4 * reg_max, H * W), f"{p}.box{i}")) scores.append(self.reshape(s, (1, nc, H * W), f"{p}.cls{i}")) sy, sx = np.meshgrid(np.arange(H, dtype=np.float32) + 0.5, np.arange(W, dtype=np.float32) + 0.5, indexing="ij") anchors.append(np.stack((sx.ravel(), sy.ravel()), 0)) stride_t.append(np.full((1, H * W), strides[i], np.float32)) A = sum(a.shape[1] for a in anchors) box = self.concat(boxes, 2, p + ".boxes") score = self.concat(scores, 2, p + ".scores") # DFL: softmax over the reg_max bins, then the 1x1 conv with weights 0..reg_max-1 (expected bin) d = self.reshape(box, (1, 4, reg_max, A), p + ".dfl_view") sm = self.net.add_softmax(d) sm.axes = 1 << 2 self._name(sm, p + ".dfl_softmax") self.fp_layers.append(sm) wdfl = self.w[c["dfl"]["children"]["conv"]["path"] + ".w"].reshape(1, 1, reg_max, 1) prod = self.ew(sm.get_output(0), self.const(wdfl, p + ".dfl_w"), trt.ElementWiseOperation.PROD, p + ".dfl_mul") red = self.net.add_reduce(prod, trt.ReduceOperation.SUM, 1 << 2, False) self._name(red, p + ".dfl") dist = red.get_output(0) # [1, 4, A] = l, t, r, b anc = self.const(np.concatenate(anchors, 1)[None], p + ".anchors") # [1, 2, A] st = self.const(np.concatenate(stride_t, 1)[None], p + ".strides") # [1, 1, A] lt = self.slice(dist, 1, 0, 2, p + ".lt") rb = self.slice(dist, 1, 2, 2, p + ".rb") x1y1 = self.ew(self.ew(anc, lt, trt.ElementWiseOperation.SUB, p + ".x1y1g"), st, trt.ElementWiseOperation.PROD, p + ".x1y1") x2y2 = self.ew(self.ew(anc, rb, trt.ElementWiseOperation.SUM, p + ".x2y2g"), st, trt.ElementWiseOperation.PROD, p + ".x2y2") # best class: sigmoid is monotonic, so top-1 over logits then sigmoid on the winner only tk = self.net.add_topk(score, trt.TopKOperation.MAX, 1, 1 << 1) self._name(tk, p + ".top1") conf = self._name(self.net.add_activation(tk.get_output(0), trt.ActivationType.SIGMOID), p + ".conf").get_output(0) cls = self._name(self.net.add_cast(tk.get_output(1), trt.float32), p + ".cls").get_output(0) out = self.concat([x1y1, x2y2, conf, cls], 1, "output") # [1, 6, A] for l in (red,): self.fp_layers.append(l) return out
def build_network(builder, meta, weights, amax=None, qdq_skip=()): network = builder.create_network(0) g = Net(network, weights) g.amax, g.qdq_skip = amax, tuple(qdq_skip) # Input: the letterboxed 640x640 BGR uint8 image (HWC), exactly the array LetterBox returns. # ultralytics/engine/predictor.py preprocess: im.permute(0, 3, 1, 2); im.flip(1) (BGR->RGB); im.float() / 255 # The BGR->RGB flip and the 1/255 are folded into the first conv's weights (conv is linear, zero padding). inp = network.add_input("images", trt.uint8, (1, IMGSZ, IMGSZ, 3)) x = g._name(network.add_cast(inp, trt.float32), "input_cast").get_output(0) sh = network.add_shuffle(x) sh.first_transpose = (0, 3, 1, 2) x = g._name(sh, "input_nchw").get_output(0) outs = [] layers = meta["layers"] for li, node in enumerate(layers): f = node["f"] if node["type"] == "Detect": out = g.detect([outs[j] for j in f], node) break if node["type"] == "Concat": y = g.concat([outs[j] if j != -1 else outs[-1] for j in f], node.get("d", 1), node["path"]) else: src = x if li == 0 else outs[f if f != -1 else -1] if isinstance(f, int) else None if li == 0: # (kept out of int8: 3 input channels, raw 0..255 pixels) w0 = weights[node["path"] + ".w"][:, ::-1] / 255.0 # RGB-ordered weights applied to BGR / 255 y, first = g.conv(src, node, w=w0) else: y = g.module(src, node) outs.append(y) out.name = "output" network.mark_output(out) return network, g
def make_calibrator(kind, cache, images): base = {"entropy": trt.IInt8EntropyCalibrator2, "minmax": trt.IInt8MinMaxCalibrator}[kind]
class Calibrator(_CalibData, base): def __init__(self): base.__init__(self) _CalibData.__init__(self, cache, images)
return Calibrator()
class _CalibData: def __init__(self, cache, images): self.cache = cache self.files = sorted(images) self.idx = 0 self.dev = None if self.files: import cudart self.cu = cudart self.dev = cudart.malloc(IMGSZ * IMGSZ * 3)
def get_batch_size(self): return 1
def get_batch(self, names): if self.idx >= len(self.files): return None import cv2 from prepost import letterbox im = np.ascontiguousarray(letterbox(cv2.imread(self.files[self.idx]), (IMGSZ, IMGSZ))) self.idx += 1 self.cu.memcpy(self.dev, im.ctypes.data, im.nbytes, self.cu.H2D) return [self.dev]
def read_calibration_cache(self): if self.cache and os.path.exists(self.cache): with open(self.cache, "rb") as f: return f.read() return None
def write_calibration_cache(self, cache): if self.cache: with open(self.cache, "wb") as f: f.write(cache)
def main(): ap = argparse.ArgumentParser() ap.add_argument("--model", required=True) ap.add_argument("--out", required=True) ap.add_argument("--precision", default="int8", choices=["int8", "int8qdq", "fp16", "fp32"]) ap.add_argument("--amax", default=None, help="int8qdq: JSON from tools/calib_stats.py") ap.add_argument("--amax-mode", default="max", help="int8qdq: max | pNN (percentile of per-image amax)") ap.add_argument("--qdq-skip", default="model.0,model.1,model.2,model.10,model.23", help="int8qdq: module paths whose convs stay fp16 (chosen with tools/sensitivity.py)") ap.add_argument("--calib-cache", default=None) ap.add_argument("--calib-images", default=None) ap.add_argument("--fp16-sensitive", type=int, default=1, help="pin attention/DFL math to fp16 in int8 mode") # Default chosen with tools/sensitivity.py (simulated int8 vs fp32 detections, see NOTES.md): the stem # (model.0-2), the attention block (model.10) and the Detect head (model.23) stay fp16. ap.add_argument("--fp16-layers", default="input_cast,input_nchw,model.0,model.1,model.2,model.10,model.23,output", help="comma-separated module paths kept out of int8 (int8 mode)") ap.add_argument("--calibrator", default="minmax", choices=["minmax", "entropy"]) ap.add_argument("--opt-level", type=int, default=3, help="TensorRT builder optimization level (0-5)") ap.add_argument("--workspace-mb", type=int, default=1024) a = ap.parse_args() t0 = time.time() meta = json.load(open(os.path.join(a.model, "model.json"))) weights = dict(np.load(os.path.join(a.model, "weights.npz"))) builder = trt.Builder(LOGGER) amax = None if a.precision == "int8qdq": st = json.load(open(a.amax))["amax"] if a.amax_mode == "max": amax = {k: float(np.max(v)) for k, v in st.items()} else: amax = {k: float(np.percentile(v, float(a.amax_mode[1:]))) for k, v in st.items()} network, g = build_network(builder, meta, weights, amax, [s for s in a.qdq_skip.split(",") if s]) config = builder.create_builder_config() config.set_memory_pool_limit(trt.MemoryPoolType.WORKSPACE, a.workspace_mb << 20) config.builder_optimization_level = a.opt_level if a.precision in ("fp16", "int8", "int8qdq"): config.set_flag(trt.BuilderFlag.FP16) if a.precision == "int8qdq": config.set_flag(trt.BuilderFlag.INT8) # explicit quantization: int8 only where the Q/DQ pairs are if a.precision == "int8": config.set_flag(trt.BuilderFlag.INT8) imgs = [] if a.calib_images: imgs = glob.glob(os.path.join(a.calib_images, "*.jpg")) if not imgs and not (a.calib_cache and os.path.exists(a.calib_cache)): raise SystemExit("int8 needs --calib-images or an existing --calib-cache") config.int8_calibrator = make_calibrator(a.calibrator, a.calib_cache, imgs) pins = list(g.fp_layers) if a.fp16_sensitive else [] prefixes = [s for s in a.fp16_layers.split(",") if s] if prefixes: for i in range(network.num_layers): l = network.get_layer(i) if any(l.name == pfx or l.name.startswith((pfx + ".", pfx + ":")) for pfx in prefixes): pins.append(l) for l in pins: l.precision = trt.float16 config.set_flag(trt.BuilderFlag.PREFER_PRECISION_CONSTRAINTS) plan = builder.build_serialized_network(network, config) if plan is None: raise SystemExit("engine build failed") with open(a.out, "wb") as f: f.write(plan) print(f"built {a.out} ({a.precision}, {network.num_layers} layers) in {time.time() - t0:.1f}s")
if __name__ == "__main__": main()12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364"""Minimal ctypes binding to the CUDA runtime (the Jetson image has no pycuda / cuda-python)."""import ctypesimport os
_lib = Nonefor _p in ("libcudart.so.12", "/usr/local/cuda/lib64/libcudart.so.12", "libcudart.so"): try: _lib = ctypes.CDLL(_p) break except OSError: continueif _lib is None: raise OSError("libcudart not found")
H2D, D2H = 1, 2_vp = ctypes.c_void_p_lib.cudaMalloc.argtypes = [ctypes.POINTER(_vp), ctypes.c_size_t]_lib.cudaFree.argtypes = [_vp]_lib.cudaMallocHost.argtypes = [ctypes.POINTER(_vp), ctypes.c_size_t]_lib.cudaFreeHost.argtypes = [_vp]_lib.cudaMemcpy.argtypes = [_vp, _vp, ctypes.c_size_t, ctypes.c_int]_lib.cudaMemcpyAsync.argtypes = [_vp, _vp, ctypes.c_size_t, ctypes.c_int, _vp]_lib.cudaStreamCreate.argtypes = [ctypes.POINTER(_vp)]_lib.cudaStreamSynchronize.argtypes = [_vp]_lib.cudaGetErrorString.restype = ctypes.c_char_p
def _check(err, what): if err != 0: raise RuntimeError(f"{what}: CUDA error {err} {_lib.cudaGetErrorString(err).decode()}")
def malloc(nbytes): p = _vp() _check(_lib.cudaMalloc(ctypes.byref(p), nbytes), "cudaMalloc") return p.value
def malloc_host(nbytes): p = _vp() _check(_lib.cudaMallocHost(ctypes.byref(p), nbytes), "cudaMallocHost") return p.value
def free(p): _check(_lib.cudaFree(p), "cudaFree")
def memcpy(dst, src, nbytes, kind): _check(_lib.cudaMemcpy(dst, src, nbytes, kind), "cudaMemcpy")
def memcpy_async(dst, src, nbytes, kind, stream): _check(_lib.cudaMemcpyAsync(dst, src, nbytes, kind, stream), "cudaMemcpyAsync")
def stream_create(): s = _vp() _check(_lib.cudaStreamCreate(ctypes.byref(s)), "cudaStreamCreate") return s.value
def stream_sync(s): _check(_lib.cudaStreamSynchronize(s), "cudaStreamSynchronize")123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160"""Extract a YOLO11 checkpoint (ultralytics .pt) into a module-tree JSON + BN-fused fp32 weights (.npz).
Runs on the build host with only torch + numpy: ultralytics classes are unpickled into inert stand-ins(no ultralytics import needed), and we read their attributes and child modules directly.
usage: python export_weights.py yolo11n.pt OUT_DIR"""import json, os, pickle, sys, types
import numpy as npimport torch
class _Stub: """Inert stand-in for any non-torch class in the pickle (ultralytics modules, namespaces...)."""
def __init__(self, *a, **k): pass
def __setstate__(self, state): if isinstance(state, tuple) and len(state) == 2: # (dict, slots) state = {**(state[0] or {}), **(state[1] or {})} if isinstance(state, dict): self.__dict__.update(state)
_stub_types = {}
class _Unpickler(pickle.Unpickler): def find_class(self, module, name): if module.startswith(("torch", "collections", "numpy", "builtins", "copyreg", "_codecs")) or module in ( "__builtin__", ): return super().find_class(module, name) key = f"{module}.{name}" if key not in _stub_types: _stub_types[key] = type(name, (_Stub,), {"_qualname": key}) return _stub_types[key]
_pm = types.ModuleType("stub_pickle")_pm.Unpickler = _Unpickler_pm.load = lambda f, **kw: _Unpickler(f, **kw).load()_pm.__name__ = "pickle"
def tname(m): return getattr(m, "_qualname", type(m).__module__ + "." + type(m).__name__).split(".")[-1]
def children(m): return m.__dict__.get("_modules", {}) or {}
def params(m): d = {} for k, v in (m.__dict__.get("_parameters", {}) or {}).items(): if v is not None: d[k] = v.detach().float() for k, v in (m.__dict__.get("_buffers", {}) or {}).items(): if v is not None: d[k] = v.detach().float() return d
ATTRS = ("f", "i", "c", "add", "n", "num_heads", "head_dim", "key_dim", "scale", "nc", "nl", "reg_max", "no", "c1", "d", "dimension", "scale_factor", "mode", "kernel_size", "stride", "padding", "dilation", "groups", "in_channels", "out_channels", "eps", "end2end", "_end2end", "legacy", "xyxy")
def jsonable(v): if isinstance(v, torch.Tensor): return v.tolist() if isinstance(v, (list, tuple)): return [jsonable(x) for x in v] if isinstance(v, (bool, int, float, str)) or v is None: return v return None
def walk(m, path, weights, used): t = tname(m) node = {"type": t, "path": path} for a in ATTRS: if a in m.__dict__: node[a] = jsonable(m.__dict__[a]) ch = children(m) if "conv" in ch and "bn" in ch: # Conv / DWConv: Conv2d + BatchNorm2d (+act): fold BN into conv (ultralytics fuse_conv_and_bn) conv, bn = ch["conv"], ch["bn"] p, q = params(conv), params(bn) w = p["weight"] std = torch.sqrt(q["running_var"] + bn.eps) g = q["weight"] / std wf = w * g.view(-1, 1, 1, 1) bf = q["bias"] - q["running_mean"] * g + (p["bias"] * g if "bias" in p else 0) weights[path + ".w"] = wf.numpy().astype(np.float32) weights[path + ".b"] = bf.numpy().astype(np.float32) used.update(f"{path}.conv.{k}" for k in p) used.update(f"{path}.bn.{k}" for k in q) node.update(k=list(conv.kernel_size), s=list(conv.stride), p=list(conv.padding), g=conv.groups, cin=conv.in_channels, cout=conv.out_channels, act=tname(ch["act"]) if "act" in ch else "Identity") return node if t == "Conv2d": p = params(m) weights[path + ".w"] = p["weight"].numpy().astype(np.float32) if "bias" in p: weights[path + ".b"] = p["bias"].numpy().astype(np.float32) used.update(f"{path}.{k}" for k in p) node.update(k=list(m.kernel_size), s=list(m.stride), p=list(m.padding), g=m.groups, cin=m.in_channels, cout=m.out_channels) return node for k, v in params(m).items(): # e.g. Detect.stride buffers are attributes, not params; record any stray tensors weights[f"{path}.{k}"] = v.numpy() used.add(f"{path}.{k}") node["children"] = {k: walk(v, f"{path}.{k}", weights, used) for k, v in ch.items() if v is not None} return node
def all_keys(m, path, out): for k, v in params(m).items(): out[f"{path}.{k}"] = tuple(v.shape) for k, v in children(m).items(): if v is not None: all_keys(v, f"{path}.{k}", out)
def main(): src, out = sys.argv[1], sys.argv[2] os.makedirs(out, exist_ok=True) ckpt = torch.load(src, map_location="cpu", pickle_module=_pm, weights_only=False) model = ckpt.get("ema") or ckpt["model"] weights, used = {}, set() top = children(model)["model"] layers = [walk(l, f"model.{i}", weights, used) for i, l in children(top).items()] det = model.__dict__ keys = {} all_keys(top, "model", keys) names = det.get("names") meta = { "layers": layers, "stride": jsonable(det.get("stride")), "names": {int(k): v for k, v in names.items()} if isinstance(names, dict) else names, "yaml": det.get("yaml") if isinstance(det.get("yaml"), dict) else None, "keys_total": len(keys), "keys_used": len(used & set(keys)), "keys_unused": sorted(set(keys) - used), } with open(os.path.join(out, "model.json"), "w") as f: json.dump(meta, f, indent=1, default=lambda o: None) np.savez(os.path.join(out, "weights.npz"), **weights) with open(os.path.join(out, "keys.txt"), "w") as f: for k, s in keys.items(): f.write(f"{k}\t{list(s)}\t{'used' if k in used else 'UNUSED'}\n") print(f"keys: {len(keys)} total, {meta['keys_used']} used; unused: {meta['keys_unused'][:10]}") print(f"fused tensors: {len(weights)}, params: {sum(v.size for v in weights.values())}")
if __name__ == "__main__": main()1{"contract": 1, "model_type": "vision_detection", "runtime": "TensorRT 10.3 (Python API) + CUDA 12.6, JetPack 6", "precision": "int8", "external_files": []}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101"""Pre- and post-processing, ported from ultralytics (reference_code commit fc26c3d).
Golden outputs match a square 640x640 letterbox (LetterBox(auto=False)), conf 0.25, IoU 0.7, max_det 300,class-aware NMS, best class only (multi_label=False). See NOTES.md for how this was established."""import cv2import numpy as np
# ultralytics/data/augment.py LetterBox.get_params / apply_image (auto=False, scaleup=True, center=True, 114 pad):# r = min(new_shape[0] / shape[0], new_shape[1] / shape[1])# new_unpad = round(shape[1] * r), round(shape[0] * r)# dw, dh = new_shape[1] - new_unpad[0], new_shape[0] - new_unpad[1]# dw /= 2; dh /= 2# top, bottom = round(dh - 0.1), round(dh + 0.1); left, right = round(dw - 0.1), round(dw + 0.1)# img = cv2.resize(img, new_unpad, interpolation=cv2.INTER_LINEAR)# img = cv2.copyMakeBorder(img, top, bottom, left, right, cv2.BORDER_CONSTANT, value=(114,) * 3)def letterbox(img, new_shape=(640, 640), out=None): shape = img.shape[:2] r = min(new_shape[0] / shape[0], new_shape[1] / shape[1]) new_unpad = round(shape[1] * r), round(shape[0] * r) dw, dh = (new_shape[1] - new_unpad[0]) / 2, (new_shape[0] - new_unpad[1]) / 2 top, bottom = round(dh - 0.1), round(dh + 0.1) left, right = round(dw - 0.1), round(dw + 0.1) if out is None: out = np.empty((new_shape[0], new_shape[1], 3), np.uint8) # same pixels as resize + copyMakeBorder, written straight into the (pinned) input buffer out[:top] = 114 out[top + new_unpad[1]:] = 114 out[top:top + new_unpad[1], :left] = 114 out[top:top + new_unpad[1], left + new_unpad[0]:] = 114 dst = out[top:top + new_unpad[1], left:left + new_unpad[0]] if shape[::-1] != new_unpad: dst[...] = cv2.resize(img, new_unpad, interpolation=cv2.INTER_LINEAR) else: dst[...] = img return out
# ultralytics/utils/nms.py non_max_suppression (multi_label=False, agnostic=False, max_wh=7680, max_nms=30000):# xc = prediction[:, 4:mi].amax(1) > conf_thres# conf, j = cls.max(1, keepdim=True); x = torch.cat((box, conf, j.float(), mask), 1)[conf.view(-1) > conf_thres]# if n > max_nms: x = x[x[:, 4].argsort(descending=True)[:max_nms]]# c = x[:, 5:6] * max_wh; boxes = x[:, :4] + c; i = torchvision.ops.nms(boxes, scores, iou_thres)[:max_det]# The engine already gives, per anchor, xyxy box, max class score (sigmoid) and its class id.def nms(pred, conf_thres=0.25, iou_thres=0.7, max_det=300, max_nms=30000, max_wh=7680): """pred: [6, A] float32 rows x1, y1, x2, y2, conf, cls. Returns [n, 6] rows (x1, y1, x2, y2, conf, cls).""" keep = pred[4] > conf_thres x = pred[:, keep].T.astype(np.float32) if not len(x): return np.zeros((0, 6), np.float32) order = np.argsort(-x[:, 4], kind="stable") if len(order) > max_nms: order = order[:max_nms] x = x[order] b = x[:, :4] + x[:, 5:6] * max_wh areas = (b[:, 2] - b[:, 0]) * (b[:, 3] - b[:, 1]) # torchvision.ops.nms: greedy in descending score order, drop boxes with IoU > iou_thres n = len(b) suppressed = np.zeros(n, bool) kept = [] for i in range(n): if suppressed[i]: continue kept.append(i) if len(kept) >= max_det: break rest = np.arange(i + 1, n) rest = rest[~suppressed[rest]] if not len(rest): break xx1 = np.maximum(b[i, 0], b[rest, 0]) yy1 = np.maximum(b[i, 1], b[rest, 1]) xx2 = np.minimum(b[i, 2], b[rest, 2]) yy2 = np.minimum(b[i, 3], b[rest, 3]) inter = np.clip(xx2 - xx1, 0, None) * np.clip(yy2 - yy1, 0, None) iou = inter / (areas[i] + areas[rest] - inter) suppressed[rest[iou > iou_thres]] = True return x[kept]
# ultralytics/utils/ops.py scale_boxes (ratio_pad=None, padding=True, xywh=False) + clip_boxes:# gain = min(img1_shape[0] / img0_shape[0], img1_shape[1] / img0_shape[1])# new_h, new_w = round(img0_shape[0] * gain), round(img0_shape[1] * gain)# gain_y, gain_x = new_h / img0_shape[0], new_w / img0_shape[1]# pad_x, pad_y = round((img1_shape[1] - new_w) / 2 - 0.1), round((img1_shape[0] - new_h) / 2 - 0.1)# boxes[..., [0, 2]] -= pad_x; boxes[..., [1, 3]] -= pad_y; boxes[..., [0, 2]] /= gain_x; boxes[..., [1, 3]] /= gain_y# boxes[..., [0, 2]] = boxes[..., [0, 2]].clip(0, w); boxes[..., [1, 3]] = boxes[..., [1, 3]].clip(0, h)def scale_boxes(img1_shape, boxes, img0_shape): gain = min(img1_shape[0] / img0_shape[0], img1_shape[1] / img0_shape[1]) new_h, new_w = round(img0_shape[0] * gain), round(img0_shape[1] * gain) gain_y, gain_x = new_h / img0_shape[0], new_w / img0_shape[1] pad_x, pad_y = round((img1_shape[1] - new_w) / 2 - 0.1), round((img1_shape[0] - new_h) / 2 - 0.1) boxes = boxes.astype(np.float32).copy() boxes[:, [0, 2]] -= pad_x boxes[:, [1, 3]] -= pad_y boxes[:, [0, 2]] /= gain_x boxes[:, [1, 3]] /= gain_y boxes[:, [0, 2]] = boxes[:, [0, 2]].clip(0, img0_shape[1]) boxes[:, [1, 3]] = boxes[:, [1, 3]].clip(0, img0_shape[0]) return boxes123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899"""YOLO11 detection on TensorRT (port of ultralytics YOLO.predict with default settings).
sh run.sh --image IN.jpg [--image IN2.jpg ...] [--repeat R] --out OUT.json --metrics M.json"""import time
T0 = time.monotonic()
import argparseimport jsonimport osimport resourceimport sys
import cv2import numpy as npimport tensorrt as trt
HERE = os.path.dirname(os.path.abspath(__file__))sys.path.insert(0, HERE)import cudart # noqa: E402from prepost import letterbox, nms, scale_boxes # noqa: E402
CONF, IOU, MAX_DET = 0.25, 0.7, 300 # ultralytics predict defaults (cfg/default.yaml; conf defaults to 0.25)
class Detector: def __init__(self, engine_path): self.logger = trt.Logger(trt.Logger.WARNING) self.runtime = trt.Runtime(self.logger) with open(engine_path, "rb") as f: self.engine = self.runtime.deserialize_cuda_engine(f.read()) self.ctx = self.engine.create_execution_context() self.stream = cudart.stream_create() self.in_shape = tuple(self.engine.get_tensor_shape("images")) # (1, 640, 640, 3) uint8 self.out_shape = tuple(self.engine.get_tensor_shape("output")) # (1, 6, A) float32 self.imgsz = self.in_shape[1:3] n_in = int(np.prod(self.in_shape)) n_out = int(np.prod(self.out_shape)) * 4 self.d_in, self.d_out = cudart.malloc(n_in), cudart.malloc(n_out) self.h_in_p, self.h_out_p = cudart.malloc_host(n_in), cudart.malloc_host(n_out) self.h_in = np.ctypeslib.as_array((ctypes_u8 * n_in).from_address(self.h_in_p)).reshape(self.in_shape[1:]) self.h_out = np.ctypeslib.as_array((ctypes_f32 * (n_out // 4)).from_address(self.h_out_p)).reshape( self.out_shape[1:]) self.ctx.set_tensor_address("images", self.d_in) self.ctx.set_tensor_address("output", self.d_out)
def __call__(self, im0): letterbox(im0, self.imgsz, out=self.h_in) cudart.memcpy_async(self.d_in, self.h_in_p, self.h_in.nbytes, cudart.H2D, self.stream) if not self.ctx.execute_async_v3(self.stream): raise RuntimeError("TensorRT execution failed") cudart.memcpy_async(self.h_out_p, self.d_out, self.h_out.nbytes, cudart.D2H, self.stream) cudart.stream_sync(self.stream) det = nms(self.h_out, CONF, IOU, MAX_DET) boxes = scale_boxes(self.imgsz, det[:, :4], im0.shape) return {"boxes": boxes.tolist(), "scores": det[:, 4].tolist(), "classes": det[:, 5].astype(int).tolist()}
import ctypes # noqa: E402
ctypes_u8, ctypes_f32 = ctypes.c_uint8, ctypes.c_float
def main(): ap = argparse.ArgumentParser() ap.add_argument("--image", action="append", required=True) ap.add_argument("--repeat", type=int, default=1) ap.add_argument("--out", required=True) ap.add_argument("--metrics", required=True) ap.add_argument("--engine", default=os.path.join(HERE, "model.engine")) a = ap.parse_args()
det = Detector(a.engine) imgs = [] for p in a.image: # decoding the JPEG counts as loading the input (ultralytics uses cv2.imread, BGR) im = cv2.imread(p, cv2.IMREAD_COLOR) if im is None: raise SystemExit(f"cannot read image {p}") imgs.append(im) det(imgs[0]) # warm-up (lazy CUDA module loading), not reported as a request load_ms = (time.monotonic() - T0) * 1000
runs, results = [], None for _ in range(max(1, a.repeat)): t = time.monotonic() results = [det(im) for im in imgs] runs.append({"total_ms": (time.monotonic() - t) * 1000})
out = results[0] if len(results) == 1 else {"images": results} with open(a.out, "w") as f: json.dump(out, f) peak = resource.getrusage(resource.RUSAGE_SELF).ru_maxrss / 1024 with open(a.metrics, "w") as f: json.dump({"load_ms": load_ms, "runs": runs, "peak_mem_mb": round(peak, 1)}, f)
if __name__ == "__main__": main()1234# Entry point (POSIX sh). sh ./run.sh --image IN.jpg [--repeat R] --out OUT.json --metrics M.jsoncd "$(dirname "$0")" || exit 1export LD_LIBRARY_PATH="/usr/local/cuda/lib64:/usr/lib/aarch64-linux-gnu${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"exec python3 run.py "$@"1234567891011121314151617181920212223242526272829303132333435363738394041424344"""Collect activation ranges at every conv input of the reference model (for explicit INT8 Q/DQ).
Runs the customer's fused ultralytics model in fp32 on CPU over calibration images, letterboxed exactly likeinference, and records per image the max |x| of each conv's input. Output: JSON {module path: [amax per image]}.Needs the reference code importable (ultralytics + its deps, e.g. opencv) and torch.
usage: python calib_stats.py WEIGHTS.pt IMAGE_DIR OUT.json"""import glob, json, os, sys
import cv2import numpy as npimport torch
sys.path.insert(0, os.environ.get("ULTRALYTICS_SRC", "/work/inputs/reference_code"))from ultralytics import YOLO # noqa: E402from ultralytics.data.augment import LetterBox # noqa: E402
def main(): w, d, out = sys.argv[1:4] model = YOLO(w).model.float().fuse().eval() stats, hooks = {}, [] for name, m in model.named_modules(): t = type(m).__name__ is_conv = t in ("Conv", "DWConv") or (t == "Conv2d" and not name.endswith(".conv")) if is_conv and not name.endswith(".dfl.conv"): stats[name] = [] hooks.append(m.register_forward_hook( lambda mod, inp, outp, n=name: stats[n].append(float(inp[0].abs().amax())))) files = sorted(glob.glob(os.path.join(d, "*.jpg"))) lb = LetterBox(640, auto=False) with torch.no_grad(): for f in files: im = lb(image=cv2.imread(f)) x = torch.from_numpy(im[..., ::-1].copy()).permute(2, 0, 1)[None].float() / 255 model(x) with open(out, "w") as fh: json.dump({"images": len(files), "amax": stats}, fh) print(f"{len(stats)} conv inputs over {len(files)} images -> {out}")
if __name__ == "__main__": main()123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596"""Per-layer INT8 sensitivity with simulated quantization (fake-quant) of the reference model on CPU.
Same quantizer as the explicit-Q/DQ engine: per-tensor activation scale amax/127 at each conv input, per-output-channelweight scale. Compares detections with the fp32 model's (recall at score>=0.3, mean IoU, mean score drift).usage: python sensitivity.py WEIGHTS.pt act_amax.json EVAL_IMAGE_DIR [skip-set ...]"""import copy, glob, json, os, sys
import cv2import numpy as npimport torch
sys.path.insert(0, os.environ.get("ULTRALYTICS_SRC", "/work/inputs/reference_code"))from ultralytics import YOLO # noqa: E402from ultralytics.data.augment import LetterBox # noqa: E402from ultralytics.utils import nms # noqa: E402
torch.set_num_threads(12)
def fq(x, s): return torch.clamp(torch.round(x / s), -127, 127) * s
def quantize_model(base, amax, skip): m = copy.deepcopy(base) for name, mod in m.named_modules(): if name not in amax or any(name == k or name.startswith(k + ".") for k in skip): continue conv = mod.conv if hasattr(mod, "conv") else mod w = conv.weight.data ws = w.abs().reshape(w.shape[0], -1).amax(1).clamp(min=1e-8).view(-1, 1, 1, 1) / 127 conv.weight.data = fq(w, ws) s = max(amax[name], 1e-6) / 127 mod.register_forward_pre_hook(lambda md, inp, s=s: (fq(inp[0], s),)) return m
def detect(m, xs): out = [] with torch.no_grad(): for x in xs: out.append(nms.non_max_suppression(m(x)[0], 0.25, 0.7, max_det=300)[0].numpy()) return out
def iou(a, b): x1, y1 = np.maximum(a[0], b[:, 0]), np.maximum(a[1], b[:, 1]) x2, y2 = np.minimum(a[2], b[:, 2]), np.minimum(a[3], b[:, 3]) i = np.clip(x2 - x1, 0, None) * np.clip(y2 - y1, 0, None) return i / ((a[2] - a[0]) * (a[3] - a[1]) + (b[:, 2] - b[:, 0]) * (b[:, 3] - b[:, 1]) - i)
def score(ref, port, thr=0.3, margin=0.05): found = tot = 0 ious, drift = [], [] pc = pt = 0 for r, p in zip(ref, port): for side, other, count in ((r, p, True), (p, r, False)): for d in side[side[:, 4] >= thr]: cand = other[(other[:, 5] == d[5]) & (other[:, 4] >= thr - margin)] ok = False if len(cand): v = iou(d[:4], cand[:, :4]) j = v.argmax() if v[j] >= 0.5: ok = True if count: ious.append(v[j]); drift.append(abs(cand[j, 4] - d[4])) if count: tot += 1; found += ok else: pt += 1; pc += ok return found / max(tot, 1), pc / max(pt, 1), float(np.mean(ious)), float(np.mean(drift))
def main(): w, amax_f, d = sys.argv[1:4] st = json.load(open(amax_f))["amax"] amax = {k: float(np.max(v)) for k, v in st.items()} base_skip = ["model.0"] + [f"model.23.cv{b}.{i}.2" for b in (2, 3) for i in range(3)] base = YOLO(w).model.float().fuse().eval() lb = LetterBox(640, auto=False) xs = [torch.from_numpy(lb(image=cv2.imread(f))[..., ::-1].copy()).permute(2, 0, 1)[None].float() / 255 for f in sorted(glob.glob(os.path.join(d, "*.jpg")))] ref = detect(base, xs) groups = sys.argv[4:] or ["all"] + [f"model.{i}" for i in range(1, 23)] + \ [f"model.23.cv2", "model.23.cv3"] for g in groups: skip = base_skip + ([] if g == "all" else g.split("+")) r = score(ref, detect(quantize_model(base, amax, skip), xs)) print(f"fp16 {g:30s} recall {r[0]:.3f} precision {r[1]:.3f} iou {r[2]:.4f} drift {r[3]:.4f}", flush=True)
if __name__ == "__main__": main().gitattributes+17-32
LICENSEAdded+661
NOTICEAdded+6
README.mdAdded+70
config.jsonAdded+34
orin-nano-gpu-int8/build.shAdded+12
orin-nano-gpu-int8/deploy.shAdded+15
orin-nano-gpu-int8/fetch.shAdded+28
orin-nano-gpu-int8/report.htmlAdded
orin-nano-gpu-int8/report/reproduce.shAdded+14
orin-nano-gpu-int8/report/results.csvAdded+71
orin-nano-gpu-int8/report/results.jsonAdded
orin-nano-gpu-int8/src/build_engine.pyAdded+457
orin-nano-gpu-int8/src/calib/act_amax.jsonAdded
orin-nano-gpu-int8/src/cudart.pyAdded+64
orin-nano-gpu-int8/src/export_weights.pyAdded+160
orin-nano-gpu-int8/src/port.jsonAdded+1
orin-nano-gpu-int8/src/prepost.pyAdded+101
orin-nano-gpu-int8/src/run.pyAdded+99
orin-nano-gpu-int8/src/run.shAdded+4
orin-nano-gpu-int8/src/tools/calib_stats.pyAdded+44
orin-nano-gpu-int8/src/tools/sensitivity.pyAdded+96