first commit

This commit is contained in:
2025-10-13 02:32:30 +08:00
commit cf19ef2020
25 changed files with 1916 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
.DS_Store

674
LICENSE Normal file
View File

@@ -0,0 +1,674 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 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 General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<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 General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<https://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<https://www.gnu.org/licenses/why-not-lgpl.html>.

6
Makefile Normal file
View File

@@ -0,0 +1,6 @@
pdf:
xelatex beamerJLU.tex
clean:
rm -f *.aux *.log *.nav *.out *.snm *.toc *.vrb
all: clean pdf

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

BIN
assets/JLU_logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 221 KiB

BIN
assets/JLU_logo_1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 243 KiB

BIN
assets/JLU_logo_2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 259 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 224 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 246 KiB

BIN
assets/background.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 81 KiB

BIN
assets/background.xcf Normal file

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 102 KiB

BIN
assets/logo_RGB.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 400 KiB

BIN
assets/logo_RGB.xcf Normal file

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 458 KiB

BIN
assets/oldbackground.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 236 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 216 KiB

BIN
assets/oldlogo_RGB.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 483 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 535 KiB

256
beamerJLU.tex Normal file
View File

@@ -0,0 +1,256 @@
\documentclass{beamer}
\usepackage{amsfonts,amsmath,oldgerm,mathrsfs,booktabs}
\usetheme{sintef}
\usepackage{xeCJK}
\usepackage{amsthm}
\usepackage{amssymb}
\usepackage{setspace}
\newcommand{\testcolor}[1]{\colorbox{#1}{\textcolor{#1}{test}}~\texttt{#1}}
\usefonttheme[onlymath]{serif}
\titlebackground*{assets/JLU_math_background.png}
\newcommand{\hrefcol}[2]{\textcolor{cyan}{\href{#1}{#2}}}
% \theoremstyle{definition} \newtheorem{definition}{Definition}
\theoremstyle{definition} \newtheorem{thm}{定理}[section]
\theoremstyle{definition} \newtheorem{lem}[thm]{引理}
\theoremstyle{definition} \newtheorem{prop}[thm]{命题}
\theoremstyle{definition} \newtheorem{coro}{推论}[thm]
\theoremstyle{definition} \newtheorem{df}[thm]{定义}
\title{标题}
\subtitle{小标题}
\author{报告人}
\insti{xx大学}
\supervisor{xxx教授}
\date{xxxx年x月x日}
% \course{}
% \IDnumber{1234567}
\begin{document}
\maketitle
\onehalfspacing
\setlength{\parindent}{2em}
\allowdisplaybreaks[4]
\begin{frame}
This template is a based on \hrefcol{https://www.overleaf.com/latex/templates/xiang-gang-zhong-wen-da-xue-zhong-wen-mo-ban-cuhk-beamer-template/bpgghjpjkqxw}{beamer template adapted for Chinese University of Hong Kong (CUHK)} from \hrefcol{https://richardfury.github.io/}{Rui HU} which is based on \hrefcol{https://www.overleaf.com/latex/templates/sintef-presentation/jhbhdffczpnx}{SINTEF Presentation} from \hrefcol{mailto:federico.zenith@sintef.no}{Federico Zenith} and its derivation \hrefcol{https://github.com/TOB-KNPOB/Beamer-LaTeX-Themes}{Beamer-LaTeX-Themes} from Liu Qilong. 该模版基于\hrefcol{https://richardfury.github.io/}{Rui HU}所做的\hrefcol{https://www.overleaf.com/latex/templates/xiang-gang-zhong-wen-da-xue-zhong-wen-mo-ban-cuhk-beamer-template/bpgghjpjkqxw}{香港中文大学beamer模板}改编而成, 并源于\hrefcol{mailto:federico.zenith@sintef.no}{Federico Zenith}\hrefcol{https://www.overleaf.com/latex/templates/sintef-presentation/jhbhdffczpnx}{SINTEF Presentation }模板以及Liu Qilong由它改编的模板\hrefcol{https://github.com/TOB-KNPOB/Beamer-LaTeX-Themes}{Beamer-LaTeX-Themes}.
\vspace{\baselineskip}
This JLU style beamer template is adapted by \hrefcol{https://GEOR-TS.github.io/}{Junyan Ye}. 该JLU版的beamer模板由作者\hrefcol{https://GEOR-TS.github.io/}{Junyan Ye}改编而成.
\vspace{\baselineskip}
由于该模板改编的主要目的是为了本科毕业论文答辩, 实在找不到太合适的模板, 因此根据自己比较喜欢的模板\hrefcol{https://www.overleaf.com/latex/templates/xiang-gang-zhong-wen-da-xue-zhong-wen-mo-ban-cuhk-beamer-template/bpgghjpjkqxw}{beamer template adapted for Chinese University of Hong Kong (CUHK)}改编了一个, 并希望分享给所有需要答辩的JLUer. 该模板制作比较急, 因此许多基于原模板\hrefcol{https://www.overleaf.com/latex/templates/xiang-gang-zhong-wen-da-xue-zhong-wen-mo-ban-cuhk-beamer-template/bpgghjpjkqxw}{beamer template adapted for Chinese University of Hong Kong (CUHK)}的功能并未发掘和改编, 请大家见谅, 若想继续发掘有意思的功能(如chapter slide以及色块等)可参考\hrefcol{https://www.overleaf.com/latex/templates/xiang-gang-zhong-wen-da-xue-zhong-wen-mo-ban-cuhk-beamer-template/bpgghjpjkqxw}{beamer template adapted for Chinese University of Hong Kong (CUHK)}中的教程.
接下来将简单介绍如何使用该beamer模板.
% This template is released under \hrefcol{https://creativecommons.org/licenses/by-nc/4.0/legalcode}{Creative Commons CC BY 4.0} license
\end{frame}
\section{如何制作幻灯片}
\begin{frame}[fragile]{封面}
在该文件的开头的以下代码进行修改得到想要的封面:
\begin{block}{封面代码}
\begin{verbatim}
\title{标题}
\subtitle{小标题}
\author{报告人}
\insti{xx大学}
\supervisor{xxx教授}
\date{xxxx年x月x日}
\end{verbatim}
\end{block}
\noindent 然后在\verb|\begin{document}|后加入代码\verb|\maketitle|来显示封面.
若打算改变封面右下角的院徽/校徽, 可去设计工具用相同大小和颜色的画布加上想改成的院徽/校徽(我这里用的数学学院院徽), 然后在\verb|\begin{document}|前利用代码\verb|\titlebackground*|把图片的路径加进来即可.
\end{frame}
\begin{frame}[fragile]{制作第一张幻灯片}
\framesubtitle{非常容易}
我们的beamer模板是基于\texttt{sintef}主题制作的, 最简单的幻灯片制作如下即可(在\verb|\begin{document}|和\verb|\end{document}|之间):
\begin{block}{最简单的幻灯片制作}
\verb|\begin{frame}{标题}|\\
\verb|\framesubtitle{小标题} %可加可不加, 不加则以所在section为小标题 | \\
\verb|这是最简单的一张幻灯片制作| \\
\verb|\end{frame}|\\
\end{block}
\end{frame}
\section{如何加入定理定义等模块}
\begin{frame}[fragile]{定理}
中文定理模块可由以下代码生成
\begin{block}{定理块}
\begin{verbatim}
\begin{thm}
$A=B$, $B=C$, 则
\begin{equation}
A=C .
\end{equation}
\end{thm}
\end{verbatim}
\end{block}
\noindent 显示如下:
\begin{thm}
$A=B$, $B=C$, 则
\begin{equation}
A=C .
\end{equation}
\end{thm}
\end{frame}
\begin{frame}[fragile]{定义}
中文定义模块可由以下代码生成
\begin{block}{定义块}
\begin{verbatim}
\begin{df}
$C=A+B$, 则称$C$$A$$B$的和.
\end{df}
\end{verbatim}
\end{block}
\noindent 显示如下:
\begin{df}
$C=A+B$, 则称$C$$A$$B$的和.
\end{df}
\end{frame}
\begin{frame}[fragile]{引理}
中文引理模块可由以下代码生成
\begin{block}{引理块}
\begin{verbatim}
\begin{lem}
$A,B$可积.
\end{lem}
\end{verbatim}
\end{block}
\noindent 显示如下:
\begin{lem}
$A,B$可积.
\end{lem}
\end{frame}
\begin{frame}[fragile]{命题}
中文命题模块可由以下代码生成
\begin{block}{命题块}
\begin{verbatim}
\begin{prop}
$A$可积, 则$B$可积.
\end{prop}
\end{verbatim}
\end{block}
\noindent 显示如下:
\begin{prop}
$A$可积, 则$B$可积.
\end{prop}
\end{frame}
\begin{frame}[fragile]{推论}
中文推论模块可由以下代码生成
\begin{block}{推论块}
\begin{verbatim}
\begin{coro}
$A$可积, 则$B$不可积.
\end{coro}
\end{verbatim}
\end{block}
\noindent 显示如下:
\begin{coro}
$A$可积, 则$B$不可积.
\end{coro}
\end{frame}
\section{插图, 表格}
\begin{frame}[fragile]{插图}
我们可以用以下代码进行插图
\begin{block}{推论块}
\begin{verbatim}
\begin{figure}[H]
\centering %让图片居中
\includegraphics[width=3cm,height=3cm]{assets/JLU_logo_1.png}
%设置图片格式和图片名(如果文档和图片不在一个文件夹下,需要给出图片路径)
\end{figure}
\end{verbatim}
\end{block}
\begin{figure}[H]
\centering %让图片居中
\includegraphics[width=3cm,height=3cm]{assets/JLU_logo_1.png}
\end{figure}
\end{frame}
\begin{frame}[fragile]{表格}
我们可以用以下代码制表
\begin{block}{表格块}
\begin{verbatim}
\begin{table}[H] \caption{标题} \resizebox{0.3\columnwidth}{!}{ \begin{tabular}{ccccccccc}
\toprule
第一列 & 第二列 & 第三列 & 第四列 \\
\midrule
$1$ & $2$ & $3$ & $4$ \\
\bottomrule
\end{tabular} } % \resizebox只是用于缩放表格, 视情况可删\end{table}
\end{verbatim}
\end{block}
\begin{table}[H]
\caption{标题}
\resizebox{0.3\columnwidth}{!}{
\begin{tabular}{ccccccccc}
\toprule
第一列 & 第二列 & 第三列 & 第四列 \\
\midrule
$1$ & $2$ & $3$ & $4$ \\
\bottomrule
\end{tabular}
}
\end{table}
\end{frame}
\section{引用}
\begin{frame}[fragile]{如何引用}
直接用代码\verb|\cite{}|引用即可, 例如\cite{bagla2005cosmological}.
\end{frame}
\section{结尾}
\begin{frame}[fragile]{设置结尾页}
\verb|\end{document}|前输入\verb|\backmatter|即可, 具体结尾页语句可在\texttt{beamerthemesintef.sty}文件对应处进行修改.
\end{frame}
\section{参考文献}
\begin{frame}[allowframebreaks]{参考文献}
\tiny
\bibliographystyle{apalike}
\bibliography{bibliography}
\end{frame}
\backmatter
\end{document}

345
beamerthemesintef.sty Normal file
View File

@@ -0,0 +1,345 @@
% Template for Sapienza presentations with LaTeX beamer.
%
% Adapted by Andrea Gasparini, andrea@gasparini.cloud for
% Sapienza presentations.
%
% Original template by Federico Zenith, federico.zenith@sintef.no.
% Derived (through several iterations) from Håvard Berland's
% beamerthementnu class.
%
%
% This program is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% This program is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with this program. If not, see <http://www.gnu.org/licenses/>.
% TODO: remove top-right logo from title page
\ProvidesPackage{beamerthemesintef}[2021/11/02]
\RequirePackage{etoolbox}
\RequirePackage{tikz}
\RequirePackage{setspace}
% Force 16:9 aspect ratio
\RequirePackage{geometry}
\geometry{paperwidth=20cm,paperheight=11cm}
% Caladea is a Cambria clone, Carlito a Calibri clone
\RequirePackage{caladea,carlito}
\renewcommand{\familydefault}{\sfdefault}
\RequirePackage{graphicx,sintefcolor}
% No navigation symbols
\setbeamertemplate{navigation symbols}{}
\newcommand{\@footlineauthor}{\insertauthor \enspace$\vert$\enspace}
\newcommand{\@footlinepayoff}{\@footlineauthor\inserttitle}
\newcommand{\footlinepayoff}[1]{\renewcommand{\@footlinepayoff}{#1}}
% Define footline content
\setbeamertemplate{footline}{%
\begin{beamercolorbox}[wd=\textwidth,ht=5mm,dp=3mm,rightskip=1cm,leftskip=1cm]{footline}
\insertframenumber/\inserttotalframenumber
\ifstrempty{\@footlinepayoff}{}{%
\usebeamerfont{footline}\hfill\@footlinepayoff
}
\end{beamercolorbox}
}
% Set footline AND coordinate blocks with it
\newcommand{\footlinecolor}[1]{% if #1 is empty, makes footline transparent
\ifstrempty{#1}{%
\footlinepayoff{}
\setbeamercolor{footline}{fg=darkgray, bg=}
\setbeamercolor{block title}{fg=white,bg=maincolor}
\setbeamercolor{block body}{fg=white,bg=maincolor}
}{
\footlinepayoff{\@footlineauthor\inserttitle}
\setbeamercolor{footline}{fg=white,bg=#1}
\setbeamercolor{block title}{fg=white,bg=#1}
\setbeamercolor{block body}{fg=white,bg=#1}
}%
}
\footlinecolor{} % Default: no footline
\pgfdeclareimage[width=0.07\paperwidth]{logo}{assets/JLU_logo_negative_1.png}
%\pgfdeclareimage[width=0.07\paperwidth]{logo}{assets/logo_RGB}
\pgfdeclareimage[width=0.07\paperwidth]{whitelogo}{assets/JLU_logo_2.png}
%\pgfdeclareimage[width=0.07\paperwidth]{whitelogo}{assets/logo_RGB_negative}
\newcommand{\@logo}{logo}
% Set colours
% NOTE! Beamer colors should be set in the preamble. It often works fine in the
% document itself, but NOT for normal text foreground.
% \themecolor should only be called from the preamble.
\newcommand{\themecolor}[1]{
\ifstrequal{#1}{main}{%
\setbeamercolor{footline}{fg=white}
\setbeamercolor{normal text}{fg=white,bg=maincolor}
\setbeamercolor{structure}{fg=white}
\renewcommand{\@logo}{whitelogo}
\setbeamercolor{block title}{fg=maincolor,bg=sintefgrey}
\setbeamercolor{block body}{fg=darkgray,bg=JLUblockcolor}
% \setbeamercolor{block body}{fg=darkgray,bg=sintefgrey}
}{%
\setbeamercolor{footline}{fg=darkgray}
\setbeamercolor{normal text}{fg=darkgray,bg=white}
\setbeamercolor{structure}{fg=maincolor}
\renewcommand{\@logo}{logo}
\setbeamercolor{block title}{fg=white,bg=maincolor}
\setbeamercolor{block body}{fg=darkgray,bg=JLUblockcolor}
%\setbeamercolor{block body}{fg=darkgray,bg=sintefgrey}
}
}
\themecolor{white} % Default: white theme
\setbeamercolor{title}{fg=maincolor,bg=white}
\setbeamercolor{alerted text}{fg=sintefred}
\setbeamercolor{author}{fg=black}
\setbeamercolor{date}{fg=black}
\setbeamercolor{supervisor}{fg=maincolor}
\setbeamerfont{author}{size=\small, series=\mdseries}
\setbeamerfont{supervisor}{size=\small, series=\mdseries}
\setbeamerfont{date}{size=\small}
\setbeamerfont{title}{series=\bfseries, size=\large}
\setbeamerfont{subtitle}{series=\mdseries,size=\small}
\setbeamerfont{frametitle}{series=\bfseries}
\setbeamerfont{framesubtitle}{series=\mdseries}
\setbeamerfont{footline}{size=\scriptsize}
\setbeamerfont{block title}{series=\bfseries}
%\setbeamerfont{block title}{series=\centering\bfseries}
% Code to get prettier boxes
\setbeamertemplate{blocks}[rounded]
% Bullets in several levels
\setbeamertemplate{itemize item}{\textbullet}
\setbeamertemplate{itemize subitem}{\textemdash}
\setbeamertemplate{itemize subsubitem}{\ensuremath{\circ}}
\newenvironment{colorblock}[3][white]{%
\begingroup
\setbeamercolor{block title}{fg=#1,bg=#2}
\setbeamercolor{block body} {fg=#1,bg=#2}
\begin{block}{#3}
}{%
\end{block}
\endgroup
}
% Put the logo in each slide's top left area
\setbeamertemplate{headline}{\hspace{0.05\textwidth}\pgfuseimage{\@logo}}
% Define frame title and subtitle layout
\setbeamertemplate{frametitle}{%
% \vspace*{-4.0ex}
\vspace*{-4.50ex}
\begin{beamercolorbox}[leftskip=1.7cm]{frametitle}%
\usebeamerfont{frametitle}\insertframetitle\\
\usebeamerfont{framesubtitle}\insertframesubtitle
\end{beamercolorbox}
}
\def\@courseLabel{}
\def\@IDnumber{}
\def\@supervisor{}
\def\@insti{}
\newcommand{\course}[1]{\def\@courseLabel{#1}}
\newcommand{\IDnumber}[1]{\def\@IDnumber{#1}}
\newcommand{\supervisor}[1]{\def\@supervisor{#1}}
\newcommand{\insti}[1]{\def\@insti{#1}}
% Define the title page
\setbeamertemplate{title page}{%
\vskip2pt plus 1filll%
% Reposition the box in an inelegant way - but it works!
\onehalfspacing
\hspace{-15mm}
\vspace{28mm}
\begin{beamercolorbox}[wd=0.72\textwidth,sep=10pt,leftskip=11mm]{title}%
{\usebeamerfont{title}\inserttitle}
{\usebeamerfont{subtitle}\insertsubtitle}
{\usebeamerfont{subtitle}\@courseLabel}
{\usebeamerfont{author}\usebeamercolor[fg]{author}\insertauthor \ifdefempty{\@IDnumber}{}{(\@IDnumber)}}
\ifdefempty{\@supervisor}{}{\small{指导教师:} \usebeamerfont{supervisor}\usebeamercolor[fg]{supervisor}\@supervisor}
\ifdefempty{\@insti}{}{ \usebeamerfont{author}\usebeamercolor[fg]{author}\@insti}
{\usebeamerfont{date}\usebeamercolor[fg]{date}\insertdate}
\end{beamercolorbox}
}
% Define slide splitting dimensions (e.g. title and chapter slides)
\newcommand{\TikzSplitSlide}[1]{%
\rule{0.56\paperwidth}{0pt}%
\begin{tikzpicture}
\clip (-0.1\paperwidth,-0.5\paperheight) --
( 0.5\paperwidth,-0.5\paperheight) --
( 0.5\paperwidth, 0.5\paperheight) --
( 0.1\paperwidth, 0.5\paperheight) -- cycle;
\node at (0.2\paperwidth,0) {%
\includegraphics[height=\paperheight]{#1}%
};
\end{tikzpicture}
}
\newbool{splittitle}
\newcommand{\@TitleBackground}{}
\newcommand{\titlebackground}{\@ifstar{\SplitBackground}{\FullBackground}}
\newcommand{\FullBackground}[1]{\renewcommand{\@TitleBackground}{#1}}
\newcommand{\SplitBackground}[1]{%
\booltrue{splittitle}%6
\renewcommand{\@TitleBackground}{#1}%
}
% Overwrite the maketitle command for the title page
\renewcommand{\maketitle}{
\begingroup
\ifdefempty{\@TitleBackground}{}{% Skip if \@TitleBackground is empty
\setbeamertemplate{background}{%
\ifbool{splittitle}{%
\TikzSplitSlide{\@TitleBackground}
}{% Normal, full-screen background
\includegraphics[height=\paperheight]{\@TitleBackground}
}
}
}
\begin{frame}%
\titlepage%
\end{frame}%
\endgroup
}
\makeatletter
\newenvironment{withoutheadline}{
\setbeamertemplate{headline}[default]
\def\beamer@entrycode{\vspace*{-\headheight}}
}{}
\makeatother
% Define chapter environment
\newenvironment{chapter}[3][]{% Args: image (optional), color, frame title
\begingroup
\themecolor{main}
\setbeamertemplate{footline}{}
\ifstrempty{#2}{
\setbeamercolor{frametitle}{fg=white}
\setbeamercolor{normal text}{fg=white,bg=maincolor}
}{
\setbeamercolor{frametitle}{fg=white}
\setbeamercolor{normal text}{fg=white,bg=#2}
}
\ifstrempty{#1}{}{\setbeamertemplate{background}{\TikzSplitSlide{#1}}}
\setbeamertemplate{frametitle}{%
\vspace*{8ex}
\begin{beamercolorbox}[wd=0.45\textwidth]{frametitle}
\usebeamerfont{frametitle}\insertframetitle\\
\usebeamerfont{framesubtitle}\insertframesubtitle
\end{beamercolorbox}
}
\begin{frame}{#3}
\hspace*{0.05\textwidth}%
\minipage{0.35\textwidth}%
\usebeamercolor[fg]{normal text}%
}{%
\endminipage
\end{frame}
\endgroup
}
% Define sidepic environment
\newenvironment{sidepic}[2]{% Args: image, frame title
\begingroup
\setbeamertemplate{background}{%
\hspace*{0.6\paperwidth}%
\includegraphics[height=\paperheight]{#1}%
}
\setbeamertemplate{frametitle}{% Same as normal, but with right skip
\vspace*{-3.5ex}
\begin{beamercolorbox}[leftskip=2cm,rightskip=0.4\textwidth]{frametitle}%
\usebeamerfont{frametitle}\insertframetitle\\
\usebeamerfont{framesubtitle}\insertframesubtitle
\end{beamercolorbox}
}
\begin{frame}{#2}
\minipage{0.6\textwidth}%
}{%
\endminipage
\end{frame}
\endgroup
}
% Define backmatter
\newcommand{\backmatter}[1][]{
\begingroup
\themecolor{main}
\begin{frame}[c]
\centering
\begin{minipage}{\textwidth}
\usebeamercolor[fg]{normal text}
\centering
% \ifstrequal{#1}{notitle}{}{
% \Huge \inserttitle
% \vspace{5mm}
% }
\Huge \textsl{\\谢谢大家!}
\end{minipage}
\end{frame}
\endgroup
}
% Define sectioning and table of contents
\AtBeginSection[]
{
\begingroup
\themecolor{main}
\begin{frame}{目录}
% \tableofcontents[currentsection]
\tableofcontents[sectionstyle=show/shaded,subsectionstyle=show/shaded/hide,subsubsectionstyle=show/shaded/hide]
\end{frame}
\endgroup
}
\AtBeginSubsection[]{
\begingroup
\themecolor{main}
\begin{frame}{目录}
\tableofcontents[sectionstyle=show/shaded,subsectionstyle=show/shaded/hide,subsubsectionstyle=show/shaded/hide]
\end{frame}
\endgroup
}
\AtBeginSubsubsection[]{
\begingroup
\themecolor{main}
\begin{frame}{目录}
\tableofcontents[sectionstyle=show/shaded,subsectionstyle=show/shaded/hide,subsubsectionstyle=show/shaded/hide]
\end{frame}
\endgroup
}
% style of section presented in the table of contents
\setbeamertemplate{section in toc}{$\blacktriangleright$~\inserttocsection}
% automate subtitle of each frame
\makeatletter
\pretocmd\beamer@checkframetitle{\framesubtitle{\thesection \, \secname}}
\makeatother
% avoid numbering of frames that are breaked into multiply slides
\setbeamertemplate{frametitle continuation}{}

10
bibliography.bib Normal file
View File

@@ -0,0 +1,10 @@
@article{bagla2005cosmological,
title={Cosmological N-body simulation: Techniques, scope and status},
author={Bagla, Jasjeet Singh},
journal={Current science},
pages={1088--1100},
year={2005},
publisher={JSTOR}
}

593
presentation_script.md Normal file
View File

@@ -0,0 +1,593 @@
# CIFAR-10图像分类模型横向测评 - 演讲稿
**演讲者**: 李博睿 (55230422)
**时长**: 约15-20分钟
**场合**: 计算智能课程技术报告
---
## 【第1页 - 封面】
大家好我是李博睿学号55230422。
今天我要向大家汇报的题目是《CIFAR-10图像分类模型横向测评》。
在这次研究中我对比了四种不同的深度学习模型在图像分类任务上的表现包括经典的CNN、现代的ResNet-18以及两种加入了注意力机制的ResNet变体。
那么,让我们开始今天的汇报。
---
## 【第2页 - 目录】
今天的汇报主要分为五个部分:
首先,我会介绍**研究背景与动机**,说明为什么要做这个对比实验;
第二部分,我会详细讲解**四个模型的架构**,包括它们的设计原理和关键特点;
第三部分,我会**展示实验结果**,这是我们最关心的部分;
第四部分,我会**深入分析这些结果**,解释为什么会出现这样的现象;
最后,我会进行**反思**,指出实验中存在的问题,并提出改进方向。
---
## 【第3页 - 研究背景】
### CIFAR-10数据集
首先来看研究背景。
我选择的数据集是**CIFAR-10**,这是计算机视觉领域一个非常经典的基准数据集。
它包含**6万张32×32的彩色图像**分为10个类别飞机、汽车、鸟、猫、鹿、狗、青蛙、马、船和卡车。
其中5万张用于训练1万张用于测试。
虽然图像分辨率不高只有32×32像素但正是因为这个"小"CIFAR-10成为了快速验证和对比不同模型架构的理想选择。
### 研究意义
那么,做这个对比研究有什么意义呢?
**第一**,我想系统地评估不同深度学习架构的性能差异;
**第二**,我特别关注注意力机制在图像分类中的作用——理论上它应该能提升性能,但实际效果如何?
**第三**,这个研究可以为实际应用中的模型选择提供参考依据。
---
## 【第4页 - 研究动机与目标】
### 核心研究问题
具体来说,我想回答四个核心问题:
**第一个问题**经典的CNN和现代的ResNet它们的性能差异到底有多大这个差距值得我们花10倍的参数量吗
**第二个问题**ResNet的核心创新——残差连接它对训练深度网络的帮助是否真的如论文所说那么显著
**第三个问题**注意力机制近年来非常火热CBAM和SE这两种注意力模块能否真正提升ResNet的性能
**第四个问题**:性能提升和参数增加之间的权衡如何把握?我们是否应该一味追求更复杂的模型?
### 实验模型
为了回答这些问题,我选择了四个模型:
**CNN**一个3层的卷积神经网络参数量约1.2M,代表经典的浅层架构;
**ResNet-18**18层的残差网络参数量约11M代表现代深度架构
**ResNet-18+CBAM**在ResNet-18基础上加入了通道和空间双重注意力机制
**ResNet-18+SE**在ResNet-18基础上加入了轻量级的通道注意力机制。
---
## 【第5页 - 模型1: CNN架构】
现在进入第二部分,模型架构讲解。
### CNN架构
首先看最简单的CNN模型。
它的结构非常直观输入是3×32×32的RGB图像经过三个卷积块最后接两个全连接层输出10个类别的概率。
**卷积层设计**三层卷积分别将通道数从3增加到64、128、256。每层后面都接BatchNorm做归一化、ReLU做激活、MaxPool做降维。
**全连接层**最后将特征图展平成4096维向量通过一个512维的隐藏层加了50%的Dropout防止过拟合最终输出10维。
**特点**:这个模型的优点是**结构简单、参数少、训练快**。但缺点也很明显:**深度受限,表达能力有限**。如果我们简单地增加卷积层的数量,不仅难以训练,性能反而会下降,这就是所谓的"退化问题"。
---
## 【第6页 - 模型2: ResNet-18架构】
### 残差连接原理
ResNet正是为了解决这个"退化问题"而提出的。
它的核心思想是**残差学习**。看这个公式y = F(x) + x
传统网络学习的是从输入x到输出y的直接映射而ResNet学习的是**残差**——也就是输入和输出的差值F(x)。
为什么这样设计?因为学习一个**"微小的变化"**,比学习一个**"完整的映射"**要容易得多。
### BasicBlock结构
ResNet-18由多个这样的BasicBlock堆叠而成。每个Block包含两个3×3卷积关键是这条**红色的shortcut连接**——它直接把输入加到输出上。
整个网络分为4个Layer每个Layer包含2个BasicBlock总共18层。
### 核心优势
ResNet的核心优势就是**解决了梯度消失问题**。
因为有shortcut的存在梯度可以直接从输出反向传播到输入不会在深层网络中"消失"。这使得训练几百层的深度网络成为可能。
---
## 【第7页 - 模型3: ResNet-18+CBAM】
### CBAM注意力机制
第三个模型在ResNet-18基础上加入了CBAM——Convolutional Block Attention Module。
CBAM的核心理念是让模型学会两件事**"关注什么"**和**"关注哪里"**。
### 通道注意力
**通道注意力**回答"关注什么"。
它通过全局平均池化和最大池化把每个通道压缩成一个数值然后用一个共享的MLP学习每个通道的重要性权重。
比如,对于识别"猫"这个任务,纹理特征的通道可能更重要,而对于识别"飞机",形状特征的通道更重要。
### 空间注意力
**空间注意力**回答"关注哪里"。
它在特征图的每个空间位置生成一个权重,告诉模型应该关注图像的哪个区域。
比如识别猫的时候,应该更关注脸部和耳朵,而不是背景。
### 参数代价
CBAM的一个优点是**非常轻量**。它只增加了约0.2M参数相对于ResNet-18的11M仅增加了1.8%。
理论上,这么小的代价应该能带来可观的性能提升。但实际效果如何呢?我们等会看结果。
---
## 【第8页 - 模型4: ResNet-18+SE】
### SE注意力机制
第四个模型加入的是SE模块——Squeeze-and-Excitation。
SE比CBAM更简单它只做通道注意力不做空间注意力。
### 三步操作
SE的工作流程分为三步
**第一步Squeeze压缩**:用全局平均池化把每个通道压缩成一个标量。这个操作捕获了整个通道的全局信息。
**第二步Excitation激励**通过两层全连接网络学习通道间的依赖关系。第一层降维第二层升维最后用Sigmoid激活得到0到1之间的权重。
**第三步Scale缩放**:把学到的权重乘回原来的特征图,实现通道级的重标定。
### 效率优势
SE的参数更少只增加约0.1M相对ResNet-18仅增加0.9%。
所以从参数效率角度看SE比CBAM更轻量。
---
## 【第9页 - 实验结果展示】
好,现在我们进入最关键的部分——实验结果。
### 图表说明
大家看这张图,它包含三个子图:
**左图**是**训练准确率曲线**。横轴是训练轮数epoch纵轴是准确率。我们可以看到四条不同颜色的曲线代表四个模型。
橙色的ResNet-18上升最快最终达到约85%绿色和红色的CBAM和SE在75-78%左右蓝色的CNN最慢只有约68%。
**中图**是**训练损失曲线**。同样是四条曲线但这次是越低越好。ResNet-18橙色下降到约0.5表现最好其他模型在0.7-0.95之间。
**右图**是**测试准确率的柱状图**。这是最终的性能指标,也是我们最关心的。
ResNet-18最高达到80.68%ResNet-18+SE是74.06%ResNet-18+CBAM是73.56%CNN最低71.95%。
红色虚线是平均值75.06%。
### 初步观察
从这张图,我们可以得出几个初步观察:
**第一**ResNet-18在所有指标上都表现最好
**第二**令人意外的是加了注意力机制的模型反而不如基础的ResNet-18
**第三**所有模型的准确率都不算太高最好的也只有80%多一点。
为什么会这样?我们接下来详细分析。
---
## 【第10页 - 测试准确率对比分析】
### 数据对比
首先看这个详细的对比表格。
**CNN**1.2M参数测试准确率71.95%,作为基线;
**ResNet-18**11M参数80.68%相比CNN提升了8.73个百分点;
**ResNet-18+CBAM**11.2M参数73.56%只比CNN高1.61个百分点;
**ResNet-18+SE**11.1M参数74.06%提升2.11个百分点。
平均准确率是75.06%。
### 关键发现
这里有三个关键发现:
**第一个发现**ResNet-18显著优于CNN。8.73个百分点的提升非常可观,证明了残差连接和深度网络的价值。
**第二个发现**,也是最意外的:**注意力机制的提升远不如预期**。
理论上CBAM和SE应该进一步提升ResNet的性能但实际上它们不仅没有提升反而表现更差。CBAM甚至比基础的CNN都低
**第三个发现**所有模型的绝对准确率都不高。即使是最好的ResNet-18也只有80.68%离CIFAR-10的sota95%+)还有很大差距。
### 原因分析
为什么会这样?我分析有几个可能的原因:
**第一**训练不充分。我只训练了50个epoch从曲线看准确率还在上升损失还在下降说明没有收敛。
**第二**,学习率可能设置不当。注意力机制可能需要不同的学习率策略。
**第三**数据增强不足。标准的RandomCrop和RandomFlip可能不够。
**第四**对于CIFAR-10这种32×32的小图像空间注意力可能难以发挥作用。
---
## 【第11页 - 训练过程分析】
让我们更细致地分析训练过程。
### 训练准确率特征
左边这个block看训练准确率的特征
**CNN**收敛最慢50个epoch后才到68%左右;
**ResNet-18**收敛最快而且最稳定达到了85%
**加了注意力的两个模型**介于两者之间75-78%。
但这里有个**异常现象**需要注意ResNet-18的训练准确率是85%但测试准确率只有80.68%差了4个多百分点。这个gap比其他模型都大说明**ResNet-18可能存在过拟合**。
### 训练损失特征
右边看训练损失:
所有模型在初期都快速下降,这是正常的;
ResNet-18下降到约0.5就稳定了;
其他模型在0.7-0.95之间波动。
损失曲线都比较平滑,说明训练过程是稳定的。
### 收敛性分析
总体来说,**ResNet架构的梯度流动确实更好**,这从它更快的收敛速度就能看出来。
但是,快速收敛不等于最终性能一定最好,还要看是否过拟合。
---
## 【第12页 - 性能-复杂度权衡】
接下来我们从另一个角度看问题:性能和复杂度的权衡。
### 参数效率
我定义了一个简单的指标:**参数效率 = 准确率 / 参数量**。
这个指标越高,说明每个参数的"性价比"越高。
### 数据对比
看这个表格:
CNN的效率是59.96,最高,因为它参数最少;
ResNet-18是7.33
加了注意力的两个模型是6.57和6.67。
虽然CNN的效率最高但它的绝对准确率太低了只有72%,实用价值有限。
### 权衡建议
如果让我给出建议:
**如果资源充足,追求最高准确率**选ResNet-18。虽然它有11M参数但80.68%的准确率在这四个模型中是最高的。
**如果资源非常受限**比如要部署到嵌入式设备那可能不得不选CNN虽然准确率低一些。
**如果想要平衡**ResNet-18+SE可能是个折中选择——它比基础ResNet只多了0.1M参数,准确率虽然低了一些,但参数效率还不错。
但说实话,在当前的训练设置下,这些结论都是初步的,需要更充分的训练来验证。
---
## 【第13页 - 实验中的问题】
现在进入第五部分:反思与改进。
作为一个严谨的研究,我必须承认,这次实验存在一些问题。
### 训练不充分
**最大的问题就是训练不充分**
我只训练了50个epoch这对于CIFAR-10来说远远不够。标准做法是训练200个epoch甚至更多。
从曲线可以看出,准确率还在稳步上升,损失还在下降,说明模型还有学习空间。
如果继续训练我相信准确率还能进一步提升可能会达到90%甚至更高。
### 注意力机制未发挥作用
**第二个问题是注意力机制没有发挥预期作用**
CBAM和SE不仅没有提升性能反而比基础ResNet表现更差。这绝对不正常。
我分析有几个可能的原因:
**原因一**:训练不充分。注意力模块的参数需要更多的迭代才能学到有效的权重;
**原因二**学习率设置可能不合适。注意力模块可能需要不同的学习率或者warmup策略
**原因三**:初始化方法可能有问题。注意力权重的初始化很关键;
**原因四**CIFAR-10的图像太小了只有32×32像素。对于这么小的图像空间注意力可能没有太多发挥空间。如果换成ImageNet那种224×224的图像效果可能会好很多。
### 测试准确率偏低
**第三个问题是整体准确率偏低**
即使是最好的ResNet-1880.68%的准确率也远低于文献中报告的95%+。
这再次说明我的训练策略需要大幅优化。
---
## 【第14页 - 改进方向】
既然发现了这些问题,那么改进方向就很明确了。
### 1. 训练策略优化
**第一组改进是关于训练策略的**
最重要的是**把epochs增加到200**,这是标准做法;
使用**学习率调度**比如MultiStepLR在第60、120、160个epoch降低学习率
添加**学习率预热**在前5个epoch让学习率逐步增加到设定值
使用**更强的数据增强**比如RandomCrop、CutMix、MixUp等。这些技术已经被证明能显著提升性能。
### 2. 超参数调整
**第二组改进是超参数调整**
当前的初始学习率是0.1可能偏大了我会尝试降低到0.05
Batch Size 128是合理的可以保持
但我会增加Weight Decay来加强正则化防止过拟合。
### 3. 模型架构改进
**第三组改进是模型架构方面**
可以尝试更深的ResNet比如ResNet-34或ResNet-50
调整CBAM的位置——也许不应该在每个Block后都加而是只在关键位置加
尝试其他注意力机制比如最近很火的ECA-Net
增加Dropout或者DropBlock来防止过拟合。
---
## 【第15页 - 未来工作展望】
### 短期改进
在**1-2周内**,我计划:
**首先**重新训练所有模型把epochs增加到200
**其次**,优化学习率调度和数据增强策略;
**第三**详细记录训练过程中的每一个指标包括训练loss、验证loss、学习率变化等
**最后**,绘制更完整的可视化,包括训练曲线、混淆矩阵、每个类别的准确率等。
### 中期探索
在**1个月的时间范围内**,我会:
**第一**,实现更多注意力机制的变体,做更系统的对比;
**第二**尝试Transformer架构比如Vision Transformer看看它在CIFAR-10上的表现
**第三**,做详细的消融实验,分析每个组件的贡献;
**第四**把实验扩展到CIFAR-100或者其他数据集验证结论的普适性。
### 长期目标
从长期来看,我对一些前沿方向很感兴趣:
比如**神经架构搜索**,让算法自动找最优的网络结构;
比如**知识蒸馏**,把大模型的知识迁移到小模型;
比如**半监督学习**,利用未标注的数据提升性能。
---
## 【第16页 - 核心结论】
现在让我总结一下本次研究的核心结论。
### 主要发现
**第一个发现**ResNet-18在测试集上表现最优达到80.68%显著优于CNN的71.95%。这验证了残差连接和深度网络的价值。
**第二个发现**:残差连接确实至关重要。它不仅让深层网络能够训练,而且收敛速度更快,性能更好。
**第三个发现**在当前的训练设置下注意力机制没有充分发挥作用。CBAM和SE的表现甚至不如基础ResNet。但这不代表注意力机制无效更可能是训练策略需要优化。
**第四个发现**50个epoch的训练远远不够。从曲线可以看出模型还有很大的提升空间。
### 经验总结
从这次实验中,我总结了几条重要经验:
**第一**,深度学习需要**充分的训练时间**。50个epoch可能在某些任务上够了但对于从零开始训练的CIFAR-10200个epoch才是起点。
**第二****超参数调优和数据增强至关重要**。同样的模型,不同的训练策略可能差距很大。
**第三**,注意力机制不是万能的,它需要**合适的训练策略**才能发挥作用。盲目加上去不一定有效。
**第四****实验设计要系统化、可重复**。要详细记录每个细节,这样才能从失败中学到东西。
### 下一步
基于这些发现,我的下一步计划是:**增加训练轮数到200优化超参数然后重新评估各模型的性能**。
我相信,经过这些改进,注意力机制应该能展现出它应有的价值。
---
## 【第17页 - 致谢页】
好,我的汇报到这里就结束了。
最后这一页列出了我的项目代码和相关文档:
所有代码都在**run_all.py**这个脚本里,可以一键运行所有实验;
实验结果就是刚才展示的**100.png**
详细的分析和讨论写在了**REPORT.md**这个报告文件里。
现在,
# 谢谢大家的聆听!
# 欢迎提问!
---
## 【Q&A环节 - 可能的问题及回答】
### Q1: 为什么只训练50个epoch
**A**: 这其实是我这次实验的一个失误。一开始我以为50个epoch足够了但实际运行后发现曲线还在上升显然没有收敛。正常的CIFAR-10实验应该训练200个epoch以上。这也是为什么我在"反思与改进"部分专门指出了这个问题。下一步我会重新训练更多轮次。
### Q2: 为什么ResNet-18比加了注意力的模型还要好
**A**: 这确实是个意外的结果。我分析有几个原因首先训练不充分注意力模块的参数还没有学到有效的权重其次可能学习率或初始化设置不适合注意力机制第三CIFAR-10图像太小32×32空间注意力可能没有足够的发挥空间。在更大的图像上比如ImageNetCBAM通常能带来1-2%的提升。
### Q3: 你觉得哪个模型最实用?
**A**: 这要看应用场景。如果是在服务器端GPU资源充足我会选ResNet-18因为它准确率最高。如果是在移动端或嵌入式设备上资源受限可能不得不选CNN或者更轻量的MobileNet。ResNet-18+SE是个折中选择——只增加0.1M参数,在优化训练后应该能有不错的性能。
### Q4: 下一步打算做什么改进?
**A**: 最紧迫的是重新训练把epochs增加到200并优化学习率调度和数据增强。我还想尝试更多的注意力机制变体比如ECA-Net、Coordinate Attention等。长远来看我对Transformer架构很感兴趣想看看ViT在CIFAR-10上能达到什么水平。
### Q5: 为什么用SGD而不是Adam
**A**: 这是个很好的问题。在图像分类任务中SGD+Momentum通常比Adam有更好的泛化性能。虽然Adam收敛更快但往往会陷入"尖锐的局部最优"导致测试集表现不如训练集。SGD虽然慢但能找到"平坦的局部最优"泛化性更好。很多SOTA的图像分类工作都用SGD。当然也有人尝试用AdamWAdam的改进版效果介于两者之间。
### Q6: 数据增强用了哪些方法?
**A**: 目前只用了最基础的RandomCrop和RandomHorizontalFlip。这显然不够。下一步我打算加入更强的增强方法比如
- CutMix: 把两张图像裁剪后混合
- MixUp: 把两张图像按比例混合
- AutoAugment: 自动搜索最优的增强策略
- RandomErasing: 随机遮挡一部分区域
这些方法已经被证明能显著提升CIFAR-10的性能。
### Q7: 能达到95%以上的准确率吗?
**A**: 理论上可以。CIFAR-10的SOTAState-of-the-art准确率已经超过99%了。但要达到95%,需要:
1. 充分的训练200+ epochs
2. 更深的网络ResNet-50/101或更先进的架构EfficientNet, Transformer
3. 强大的数据增强
4. 精心调优的超参数
5. 可能还需要一些技巧,比如模型集成、知识蒸馏等
我目前的设置比较基础所以80%是合理的。通过系统优化90-95%是可以达到的目标。
### Q8: 这个项目花了多长时间?
**A**: 从代码实现到实验运行,大概花了一周时间。其中:
- 模型实现2天
- 训练脚本和可视化2天
- 运行实验1天50 epochs还是很快的
- 分析结果和准备汇报2天
如果重新训练200 epochs可能还需要2-3天。
### Q9: 有遇到什么技术难点吗?
**A**: 主要有两个:
1. **CBAM的实现**通道注意力和空间注意力怎么正确地集成到ResNet的BasicBlock中我参考了原论文和一些开源实现才搞清楚。
2. **可视化**怎么把训练过程中的数据保存下来然后生成漂亮的对比图这花了不少时间调matplotlib的参数。
整体来说得益于PyTorch强大的生态大部分实现都比较顺利。
### Q10: 有什么想对后来者说的?
**A**: 几点建议:
1. **从小实验开始**先在小数据集如CIFAR-10上验证想法不要一上来就跑ImageNet。
2. **重视基础**把经典模型CNN、ResNet吃透再去追新方法。
3. **做好记录**:每次实验都要详细记录超参数、结果、遇到的问题。
4. **勇于试错**:我的注意力机制实验"失败"了,但这本身就是一个重要发现。
5. **多看论文**:理解为什么这样设计,而不只是调参。
最重要的是:**享受学习的过程**!深度学习既是科学也是艺术。
---
**【演讲结束】**
再次感谢大家的聆听!如果还有问题,欢迎随时交流。
**谢谢!**

31
sintefcolor.sty Normal file
View File

@@ -0,0 +1,31 @@
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{sintefcolor}[2021/03/04]
\RequirePackage{xcolor}
% Main colour
%\definecolor{maincolor}{RGB/cmyk}{114,37,109/69,99,35,1}
\definecolor{maincolor}{RGB/cmyk}{24,66,153/84,57,0,40}
\definecolor{maincharcolor}{RGB/cmyk}{114,37,109/69,99,35,1}
% "Warm grey"
\definecolor{sintefgrey}{RGB/cmyk}{235,235,230/0,0,0,.1}
\colorlet{sintefgray}{sintefgrey}
\definecolor{JLUblockcolor}{RGB/cmyk}{241,245,255/5,4,0,0}
% Greens
\definecolorset{RGB/cmyk}{sintef}{}{lightgreen, 205,250,225/.23, 0,.20, 0;%
green, 20,185,120/.73, 0,.67, 0;%
darkgreen, 0, 70, 40/.93,.43,.92,.52}
% Additional colours
\definecolorset{RGB/cmyk}{sintef}{}{yellow, 201,165,39/19, 41,89, 0;%
red, 190, 60,55/19, 86,77, 8;%
lilla, 120, 0,80/48,100,27,31}
% Deprecated colours for backward compatibility
\definecolorset{HTML}{sintef}{}{cyan, 22A7E5;%
magenta, EC008C;%
lightgrey, D8D0C7}
\colorlet{sinteflightgray}{sinteflightgrey}