init: 初始化仓库
@ -0,0 +1,14 @@
|
||||
.vscode
|
||||
|
||||
# Pyre type checker
|
||||
.pyre/
|
||||
.idea/'
|
||||
|
||||
.DS_Store
|
||||
|
||||
# Intellij IDEA Files
|
||||
.idea/*
|
||||
!.idea/vcs.xml
|
||||
!.idea/icon.png
|
||||
.ideaDataSources/
|
||||
*.iml
|
||||
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
@ -0,0 +1,19 @@
|
||||
FROM ubuntu:20.04
|
||||
|
||||
WORKDIR /root
|
||||
|
||||
COPY run.sh .
|
||||
|
||||
RUN apt update && apt install -y python3-pip git wget
|
||||
|
||||
RUN pip install --upgrade pip
|
||||
|
||||
RUN git clone --depth 1 https://github.com/naurril/SUSTechPOINTS.git
|
||||
|
||||
RUN cd SUSTechPOINTS && \
|
||||
wget https://github.com/naurril/SUSTechPOINTS/releases/download/0.1/deep_annotation_inference.h5 -P algos/models && \
|
||||
python3 -m pip install -r ./requirement.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
|
||||
|
||||
ENTRYPOINT ["/root/run.sh"]
|
||||
|
||||
EXPOSE 8081
|
||||
@ -0,0 +1,3 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
cd /root/SUSTechPOINTS && python3 ./main.py
|
||||
@ -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>.
|
||||
@ -0,0 +1 @@
|
||||
This folder is used to store models
|
||||
@ -0,0 +1,299 @@
|
||||
|
||||
import os
|
||||
import tensorflow as tf
|
||||
|
||||
|
||||
|
||||
import numpy as np
|
||||
|
||||
from . import util
|
||||
import glob
|
||||
import math
|
||||
import json
|
||||
|
||||
util.config_gpu()
|
||||
|
||||
|
||||
RESAMPLE_NUM = 10
|
||||
|
||||
model_file = "./algos/models/deep_annotation_inference.h5"
|
||||
|
||||
rotation_model = tf.keras.models.load_model(model_file)
|
||||
rotation_model.summary()
|
||||
|
||||
NUM_POINT=512
|
||||
|
||||
def sample_one_obj(points, num):
|
||||
if points.shape[0] < NUM_POINT:
|
||||
return np.concatenate([points, np.zeros((NUM_POINT-points.shape[0], 3), dtype=np.float32)], axis=0)
|
||||
else:
|
||||
idx = np.arange(points.shape[0])
|
||||
np.random.shuffle(idx)
|
||||
return points[idx[0:num]]
|
||||
|
||||
def predict_yaw(points):
|
||||
points = np.array(points).reshape((-1,3))
|
||||
input_data = np.stack([x for x in map(lambda x: sample_one_obj(points, NUM_POINT), range(RESAMPLE_NUM))], axis=0)
|
||||
pred_val = rotation_model.predict(input_data)
|
||||
pred_cls = np.argmax(pred_val, axis=-1)
|
||||
print(pred_cls)
|
||||
|
||||
ret = (pred_cls[0]*3+1.5)*np.pi/180.
|
||||
ret =[0,0,ret]
|
||||
print(ret)
|
||||
|
||||
return ret
|
||||
|
||||
# warmup the model
|
||||
predict_yaw(np.random.random([1000,3]))
|
||||
|
||||
if False:
|
||||
# weights_path = "../DeepAnnotate/da_rp_weights.h5"
|
||||
# #filter_model = tf.keras.filter_models.load_filter_model(filter_model_path)
|
||||
|
||||
# filter_model = M.get_filter_model_rp_discrimination(common.NUM_POINT, 2, False)
|
||||
|
||||
# # filter_model.compile(optimizer=tf.keras.optimizers.Adam(0.0001),
|
||||
# # loss=tf.keras.losses.SparseCategoricalCrossentropy(from_logits=True),
|
||||
# # metrics=[tf.keras.metrics.sparse_categorical_accuracy, tf.keras.metrics.SparseTopKCategoricalAccuracy(k=2)])
|
||||
# #filter_model.summary()
|
||||
|
||||
# filter_model.load_weights(weights_path)
|
||||
# filter_model.summary()
|
||||
|
||||
use_env = False
|
||||
if use_env:
|
||||
filter_model_file = './algos/models/deepannotate_rp_discrimination_env.h5' #"./deepannotate_rp_discrimination.back.h5"
|
||||
else:
|
||||
filter_model_file = './algos/models/deepannotate_rp_discrimination_obj_xyzi.h5' #"./deepannotate_rp_discrimination.back.h5"
|
||||
filter_model = tf.keras.models.load_model(filter_model_file)
|
||||
filter_model.summary()
|
||||
|
||||
|
||||
|
||||
# rotation_model_file = "../SUSTechPoints-be/algos/models/deep_annotation_inference.h5"
|
||||
# rotation_model = tf.keras.models.load_model(rotation_model_file)
|
||||
# rotation_model.summary()
|
||||
|
||||
# #from rotation import model as rotation_model
|
||||
|
||||
# #NUM_POINT = 512
|
||||
|
||||
def cluster_points(pcdfile):
|
||||
def pre_cluster_pcd(file, output_folder):
|
||||
pre_cluster_exe = "/home/lie/code/pcltest/build/cluster"
|
||||
cmd = "{} {} {}".format(pre_cluster_exe, file, output_folder)
|
||||
#print(cmd)
|
||||
os.system(cmd)
|
||||
|
||||
temp_output_folder = "./temppcd"
|
||||
if os.path.exists(temp_output_folder):
|
||||
os.system("rm {}/*".format(temp_output_folder))
|
||||
else:
|
||||
os.mkdir(temp_output_folder)
|
||||
|
||||
pre_cluster_pcd(pcdfile, temp_output_folder)
|
||||
|
||||
obj_files = glob.glob(temp_output_folder+"/*-obj.bin")
|
||||
env_files = glob.glob(temp_output_folder+"/*-env.bin")
|
||||
obj_files.sort()
|
||||
env_files.sort()
|
||||
|
||||
## note these clusters are already sorted by points number
|
||||
objs = [np.fromfile(c, dtype=np.float32).reshape(-1, 4) for c in obj_files]
|
||||
envs = [np.fromfile(c, dtype=np.float32).reshape(-1, 4) for c in env_files]
|
||||
clusters = list(zip(objs, envs))
|
||||
return clusters
|
||||
|
||||
def euler_angle_to_rotate_matrix(eu, t):
|
||||
theta = eu
|
||||
#Calculate rotation about x axis
|
||||
R_x = np.array([
|
||||
[1, 0, 0],
|
||||
[0, math.cos(theta[0]), -math.sin(theta[0])],
|
||||
[0, math.sin(theta[0]), math.cos(theta[0])]
|
||||
])
|
||||
|
||||
#Calculate rotation about y axis
|
||||
R_y = np.array([
|
||||
[math.cos(theta[1]), 0, math.sin(theta[1])],
|
||||
[0, 1, 0],
|
||||
[-math.sin(theta[1]), 0, math.cos(theta[1])]
|
||||
])
|
||||
|
||||
#Calculate rotation about z axis
|
||||
R_z = np.array([
|
||||
[math.cos(theta[2]), -math.sin(theta[2]), 0],
|
||||
[math.sin(theta[2]), math.cos(theta[2]), 0],
|
||||
[0, 0, 1]])
|
||||
|
||||
R = np.matmul(R_x, np.matmul(R_y, R_z))
|
||||
|
||||
t = t.reshape([-1,1])
|
||||
R = np.concatenate([R,t], axis=-1)
|
||||
R = np.concatenate([R, np.array([0,0,0,1]).reshape([1,-1])], axis=0)
|
||||
return R
|
||||
|
||||
|
||||
def sample_one_obj(points, num):
|
||||
centroid = list(np.mean(points[:,:3], axis=0)) # intensity
|
||||
|
||||
if points.shape[1] > 3:
|
||||
centroid = np.append(centroid, np.zeros(points.shape[1]-3))
|
||||
print(centroid)
|
||||
centroid.reshape(1,-1)
|
||||
points = points - centroid
|
||||
|
||||
# padding or sample
|
||||
if points.shape[0]>num:
|
||||
idx = np.arange(points.shape[0])
|
||||
np.random.shuffle(idx)
|
||||
points = points[idx[0:num]]
|
||||
else:
|
||||
sample_idx = np.random.randint(0, high = points.shape[0], size=num - points.shape[0])
|
||||
padding = points[sample_idx]
|
||||
points = np.concatenate([points, padding], axis=0)
|
||||
|
||||
print("input shape", points.shape)
|
||||
return points[:,:3]
|
||||
|
||||
def filter_nearby_objects(clusters):
|
||||
def nearby(c): # c is a pair
|
||||
center = np.mean(c,axis=0)
|
||||
return np.sum((center*center)[0:2]) < 70*70
|
||||
|
||||
ind = [nearby(c[0]) for c in clusters]
|
||||
return np.array(clusters)[ind]
|
||||
|
||||
|
||||
# # return true/false list
|
||||
def filter_candidate_objects(clusters):
|
||||
|
||||
## all clusters stacked into a batch
|
||||
|
||||
objidx = 1 if use_env else 0
|
||||
input_cluster_points = np.stack([sample_one_obj(p[objidx], NUM_POINT) for p in clusters], axis=0) # use env to do filtering
|
||||
|
||||
pred_val = filter_model.predict(input_cluster_points)
|
||||
#print(pred_val)
|
||||
prob = np.exp(pred_val)/np.sum(np.exp(pred_val),axis=1,keepdims=True)
|
||||
|
||||
#print(prob)
|
||||
#pred_cls = np.argmax(prob, axis=1)
|
||||
pred_cls = prob[:,1]>0.5
|
||||
return pred_cls
|
||||
|
||||
def decide_obj_rotation(objs):
|
||||
input_data = np.stack([sample_one_obj(o, NUM_POINT) for o in objs], axis=0)
|
||||
pred_val = rotation_model.predict(input_data)
|
||||
pred_cls = np.argmax(pred_val, axis=-1)
|
||||
|
||||
ret = (pred_cls*3+1.5)*np.pi/180.0 #only z-axis rotation is predicted
|
||||
|
||||
return ret
|
||||
|
||||
def calculate_box_dimension(objs, rotation):
|
||||
|
||||
def calc_one_box(obj, rot):
|
||||
#print(obj.shape, rot)
|
||||
rot = np.array([0,0,rot])
|
||||
centroid = np.mean(obj, axis=0)
|
||||
obj = obj - centroid
|
||||
|
||||
trans_mat = euler_angle_to_rotate_matrix(rot, np.zeros(3))[:3,:3]
|
||||
relative_position = np.matmul(obj, trans_mat)
|
||||
|
||||
pmin = np.min(relative_position, axis=0)
|
||||
pmax = np.max(relative_position, axis=0)
|
||||
pmin[2] = pmin[2] - 0.2 # remember 0.2 was removed, as ground
|
||||
|
||||
box_dim = pmax-pmin
|
||||
box_center_delta = box_dim/2 + pmin
|
||||
#center delta shoulb be translated to global coord
|
||||
box_center_delta = np.matmul(trans_mat, box_center_delta)
|
||||
|
||||
box_center = box_center_delta + centroid
|
||||
|
||||
return np.stack([box_center, box_dim, rot],axis=0)
|
||||
|
||||
|
||||
return [calc_one_box(obj, rot) for obj,rot in zip(objs, rotation)]
|
||||
|
||||
|
||||
|
||||
## main func
|
||||
def pre_annotate(pcdfile):
|
||||
clusters = cluster_points(pcdfile)
|
||||
|
||||
clusters = filter_nearby_objects(clusters)
|
||||
cand_ind = filter_candidate_objects(clusters)
|
||||
|
||||
# positive_files = np.array(cluster_files)[cand_ind]
|
||||
# positive_files = [x for x in map(lambda f: f.replace(".bin",".pcd"), list(positive_files))]
|
||||
|
||||
# outstr = ""
|
||||
# for f in positive_files:
|
||||
# outstr = outstr + " " + f
|
||||
|
||||
# print(outstr)
|
||||
|
||||
|
||||
# calculate box
|
||||
cand_clusters = np.array(clusters)[cand_ind]
|
||||
|
||||
# only objs is needed from now on
|
||||
cand_clusters = [x[0][:,:3] for x in cand_clusters]
|
||||
cand_rotation = decide_obj_rotation(cand_clusters)
|
||||
|
||||
# print(cand_rotation)
|
||||
boxes = calculate_box_dimension(cand_clusters, cand_rotation)
|
||||
#print(boxes)
|
||||
return boxes
|
||||
|
||||
|
||||
def translate_np_to_json(boxes):
|
||||
def trans_one_box(box):
|
||||
return {
|
||||
'obj_type': 'Unknown',
|
||||
'psr': {
|
||||
'position': {
|
||||
'x': box[0,0],
|
||||
'y': box[0,1],
|
||||
'z': box[0,2],
|
||||
},
|
||||
'scale': {
|
||||
'x': box[1,0],
|
||||
'y': box[1,1],
|
||||
'z': box[1,2],
|
||||
},
|
||||
'rotation': {
|
||||
'x': box[2,0],
|
||||
'y': box[2,1],
|
||||
'z': box[2,2],
|
||||
}
|
||||
},
|
||||
'obj_id': '',
|
||||
}
|
||||
|
||||
# return [trans_one_box(b) for b in boxes]
|
||||
|
||||
def annotate_file(input, output=None):
|
||||
boxes = pre_annotate(input)
|
||||
boxes_json = translate_np_to_json(boxes)
|
||||
|
||||
if output:
|
||||
with open(output, 'w') as f:
|
||||
json.dump(boxes_json, f)
|
||||
|
||||
return boxes_json
|
||||
|
||||
# if __name__ == "__main__":
|
||||
# #root_folder = "/home/lie/fast/code/SUSTechPoints-be/data/sustechscapes-mini-dataset-test"
|
||||
# root_folder = "/home/lie/fast/code/SUSTechPoints-be/data/2020-07-12-15-36-24"
|
||||
# files = os.listdir(root_folder + "/lidar")
|
||||
# files.sort()
|
||||
# for pcdfile in files:
|
||||
# print(pcdfile)
|
||||
# jsonfile = pcdfile.replace(".pcd",".json")
|
||||
|
||||
# annotate_file(root_folder + "/lidar/" + pcdfile, root_folder + "/label/" + jsonfile)
|
||||
@ -0,0 +1,43 @@
|
||||
|
||||
|
||||
import numpy as np
|
||||
import tensorflow as tf
|
||||
import util
|
||||
util.config_gpu()
|
||||
|
||||
RESAMPLE_NUM = 10
|
||||
|
||||
model_file = "./algos/models/deep_annotation_inference.h5"
|
||||
|
||||
model = tf.keras.models.load_model(model_file)
|
||||
model.summary()
|
||||
|
||||
NUM_POINT=512
|
||||
|
||||
def sample_one_obj(points, num):
|
||||
if points.shape[0] < NUM_POINT:
|
||||
return np.concatenate([points, np.zeros((NUM_POINT-points.shape[0], 3), dtype=np.float32)], axis=0)
|
||||
else:
|
||||
idx = np.arange(points.shape[0])
|
||||
np.random.shuffle(idx)
|
||||
return points[idx[0:num]]
|
||||
|
||||
def predict_yaw(points):
|
||||
points = np.array(points).reshape((-1,3))
|
||||
input_data = np.stack([x for x in map(lambda x: sample_one_obj(points, NUM_POINT), range(RESAMPLE_NUM))], axis=0)
|
||||
pred_val = model.predict(input_data)
|
||||
pred_cls = np.argmax(pred_val, axis=-1)
|
||||
print(pred_cls)
|
||||
|
||||
ret = (pred_cls[0]*3+1.5)*np.pi/180.
|
||||
ret =[0,0,ret]
|
||||
print(ret)
|
||||
|
||||
return ret
|
||||
|
||||
# warmup the model
|
||||
predict_yaw(np.random.random([1000,3]))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
predict_yaw(np.random.random([1000,3]))
|
||||
@ -0,0 +1,262 @@
|
||||
|
||||
|
||||
# from filterpy.kalman import KalmanFilter
|
||||
import numpy as np
|
||||
|
||||
import sys
|
||||
import os
|
||||
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
|
||||
|
||||
sys.path.append(BASE_DIR)
|
||||
sys.path.append(os.path.join(BASE_DIR, '..'))
|
||||
import scene_reader
|
||||
|
||||
class MAFilter:
|
||||
def __init__(self, init_x):
|
||||
self.x = init_x
|
||||
self.v = np.zeros(9) # position, rotation
|
||||
self.step = 0
|
||||
|
||||
def update(self, x):
|
||||
if self.step == 0:
|
||||
self.v = x-self.x
|
||||
else:
|
||||
self.v = self.v*0.5 + (x-self.x)*0.5
|
||||
|
||||
self.x[0:9] = x
|
||||
self.step += 1
|
||||
|
||||
def predict(self):
|
||||
self.x += self.v
|
||||
self.step += 1
|
||||
return self.x
|
||||
|
||||
|
||||
|
||||
def get_my_filter(init_x):
|
||||
return MAFilter(init_x)
|
||||
|
||||
|
||||
# def get_kalman_filter(init_x):
|
||||
# dim_z = 9
|
||||
# kf = KalmanFilter(dim_x=12, dim_z=dim_z)
|
||||
# kf.F = np.array([ [1,0,0,0,0,0,0,0,0,1,0,0], # state transition matrix
|
||||
# [0,1,0,0,0,0,0,0,0,0,1,0],
|
||||
# [0,0,1,0,0,0,0,0,0,0,0,0],
|
||||
# [0,0,0,1,0,0,0,0,0,0,0,0],
|
||||
# [0,0,0,0,1,0,0,0,0,0,0,0],
|
||||
# [0,0,0,0,0,1,0,0,0,0,0,0],
|
||||
# [0,0,0,0,0,0,1,0,0,0,0,0],
|
||||
# [0,0,0,0,0,0,0,1,0,0,0,0],
|
||||
# [0,0,0,0,0,0,0,0,1,0,0,0],
|
||||
# [0,0,0,0,0,0,0,0,0,1,0,0],
|
||||
# [0,0,0,0,0,0,0,0,1,0,1,0],
|
||||
# [0,0,0,0,0,0,0,0,0,0,0,1],
|
||||
# ])
|
||||
|
||||
# kf.H = np.array([ [1,0,0,0,0,0,0,0,0,0,0,0], # measurement function,
|
||||
# [0,1,0,0,0,0,0,0,0,0,0,0],
|
||||
# [0,0,1,0,0,0,0,0,0,0,0,0],
|
||||
# [0,0,0,1,0,0,0,0,0,0,0,0],
|
||||
# [0,0,0,0,1,0,0,0,0,0,0,0],
|
||||
# [0,0,0,0,0,1,0,0,0,0,0,0],
|
||||
# [0,0,0,0,0,0,1,0,0,0,0,0],
|
||||
# [0,0,0,0,0,0,0,1,0,0,0,0],
|
||||
# [0,0,0,0,0,0,0,0,1,0,0,0],
|
||||
# ])
|
||||
|
||||
# # self.kf.R[0:,0:] *= 10. # measurement uncertainty
|
||||
# #kf.P[dim_z:,dim_z:] *= 1000. #state uncertainty, give high uncertainty to the unobservable initial velocities, covariance matrix
|
||||
# #kf.P *= 10.
|
||||
|
||||
# # self.kf.Q[-1,-1] *= 0.01 # process uncertainty
|
||||
# #kf.Q[dim_z:,dim_z:] *= 0.01
|
||||
# #kf.x = kf.x * 0.0
|
||||
# kf.x[:dim_z] = init_x.reshape((dim_z, 1))
|
||||
|
||||
# print(kf.P)
|
||||
# return kf
|
||||
|
||||
|
||||
def get_obj_ann(scene, frame, id):
|
||||
ann = scene_reader.read_annotations(scene, frame)
|
||||
target_ann = list(filter(lambda a: a["obj_id"]==id, ann))
|
||||
if len(target_ann) == 1:
|
||||
return target_ann[0]
|
||||
elif len(target_ann)> 1:
|
||||
print("Warning: duplicate object id found!")
|
||||
return target_ann[0]
|
||||
else:
|
||||
return None
|
||||
|
||||
# bbox3D measurement state: x,y,z,theta,l,w,h, vx,vy,vz
|
||||
def ann_to_kalman_state(ann):
|
||||
return np.array([
|
||||
ann["psr"]["position"]["x"],
|
||||
ann["psr"]["position"]["y"],
|
||||
ann["psr"]["position"]["z"],
|
||||
|
||||
ann["psr"]["scale"]["x"],
|
||||
ann["psr"]["scale"]["y"],
|
||||
ann["psr"]["scale"]["z"],
|
||||
|
||||
ann["psr"]["rotation"]["x"],
|
||||
ann["psr"]["rotation"]["y"],
|
||||
ann["psr"]["rotation"]["z"],
|
||||
])
|
||||
|
||||
|
||||
def kalman_state_to_ann(proto, state):
|
||||
state = np.reshape(state, -1)
|
||||
return {"psr":{"position":{"x":state[0],
|
||||
"y":state[1],
|
||||
"z":state[2]
|
||||
},
|
||||
"scale": {"x":state[3],
|
||||
"y":state[4],
|
||||
"z":state[5]},
|
||||
"rotation":{"x":state[6],
|
||||
"y":state[7],
|
||||
"z":state[8]
|
||||
},
|
||||
},
|
||||
"obj_type":proto["obj_type"],
|
||||
"obj_id":proto["obj_id"],
|
||||
}
|
||||
|
||||
def interpolate_segment(start_ann, end_ann, insert_number):
|
||||
end = ann_to_kalman_state(end_ann)
|
||||
start = ann_to_kalman_state(start_ann)
|
||||
linear_delta = (end-start)/(insert_number+1)
|
||||
return list(map(lambda i: kalman_state_to_ann(start_ann, start+linear_delta*(i+1)), range(insert_number)))
|
||||
|
||||
def interpolate(annotations):
|
||||
|
||||
# interpolate
|
||||
N = len(annotations)
|
||||
i = 0
|
||||
num_interpolate = 0
|
||||
while i+1<N:
|
||||
#find start
|
||||
start = None
|
||||
end = None
|
||||
while (i+1)<N and not(annotations[i] and (annotations[i+1] is None)):
|
||||
i = i+1
|
||||
|
||||
start = i
|
||||
|
||||
i = i+2
|
||||
while (i < N) and (annotations[i] is None):
|
||||
i = i+1
|
||||
|
||||
if i < len(annotations):
|
||||
end = i
|
||||
|
||||
# do interpolation
|
||||
if start is not None and end is not None:
|
||||
print("interpolate", start, end)
|
||||
predicted = interpolate_segment(annotations[start], annotations[end], end-start-1)
|
||||
for p in predicted:
|
||||
p["annotator"]="I"
|
||||
|
||||
annotations[(start+1):end] = predicted
|
||||
num_interpolate += end-start-1
|
||||
|
||||
# better if we do some automatic annotation adjustments
|
||||
|
||||
else:
|
||||
print(start, end, "not interpolatable")
|
||||
|
||||
return num_interpolate
|
||||
|
||||
def kalmanfilter_pred(annotations):
|
||||
i = 0
|
||||
while annotations[i] is None or annotations[i].get("annotator") == "K":
|
||||
i += 1
|
||||
|
||||
start_ann = None
|
||||
if i < len(annotations):
|
||||
start_ann = annotations[i]
|
||||
else:
|
||||
return 0
|
||||
|
||||
|
||||
state = ann_to_kalman_state(start_ann)
|
||||
ref_ann = start_ann
|
||||
print("init", state)
|
||||
kalmanfilter = get_my_filter(state)
|
||||
i+=1
|
||||
|
||||
print("kalman update")
|
||||
while i < len(annotations) and annotations[i] is not None:
|
||||
state = ann_to_kalman_state(annotations[i])
|
||||
# update velocity
|
||||
print(state)
|
||||
kalmanfilter.predict()
|
||||
kalmanfilter.update(state)
|
||||
|
||||
ref_ann = annotations[i] # record objtype/id ...
|
||||
i += 1
|
||||
|
||||
#predict
|
||||
pred_num = 0
|
||||
while i < len(annotations) and annotations[i] is None:
|
||||
kalmanfilter.predict()
|
||||
pred = kalmanfilter.x
|
||||
ann = kalman_state_to_ann(ref_ann, pred)
|
||||
ann["annotator"]="K"
|
||||
annotations[i] = ann
|
||||
i += 1
|
||||
pred_num += 1
|
||||
|
||||
return pred_num
|
||||
|
||||
|
||||
def predict(scene_id, obj_id, current_frame, predict_frame):
|
||||
print("interpolate", scene_id, obj_id)
|
||||
scene = scene_reader.get_one_scene(scene_id)
|
||||
frames = scene["frames"]
|
||||
print(frames)
|
||||
annotations = list(map(lambda f: get_obj_ann(scene_id, f, obj_id), frames))
|
||||
|
||||
for a in annotations:
|
||||
print(a)
|
||||
|
||||
print("remove M anns")
|
||||
# remove K anns
|
||||
for i,a in enumerate(annotations):
|
||||
if a and a.get("annotator") and (a["annotator"]=="K" or a["annotator"]=="I"):
|
||||
annotations[i]=None
|
||||
|
||||
num_pred = 0
|
||||
num_pred += interpolate(annotations)
|
||||
num_pred += kalmanfilter_pred(annotations)
|
||||
|
||||
annotations.reverse()
|
||||
num_pred += kalmanfilter_pred(annotations)
|
||||
annotations.reverse() #reverse back
|
||||
# now predict
|
||||
|
||||
print("start save ..")
|
||||
updated_frames = []
|
||||
for i,a in enumerate(annotations):
|
||||
print(a.get("annotator"), "\t", a["psr"]["position"])
|
||||
if a and a.get("annotator") and (a["annotator"]=="K" or a["annotator"]=="I"):
|
||||
write_annotation_back(scene_id, frames[i], a)
|
||||
updated_frames.append(frames[i])
|
||||
|
||||
print(len(updated_frames), updated_frames)
|
||||
return updated_frames
|
||||
|
||||
def write_annotation_back(scene_id, frame, new_ann):
|
||||
ann = scene_reader.read_annotations(scene_id, frame)
|
||||
|
||||
ann = list(filter(lambda a: a["obj_id"]!=new_ann["obj_id"], ann))
|
||||
ann.append(new_ann)
|
||||
|
||||
scene_reader.save_annotations(scene_id, frame, ann)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
predict("rider_2hz", "1", None, None)
|
||||
|
||||
@ -0,0 +1,16 @@
|
||||
import tensorflow as tf
|
||||
|
||||
|
||||
|
||||
def config_gpu():
|
||||
gpus = tf.config.experimental.list_physical_devices('GPU')
|
||||
if gpus:
|
||||
try:
|
||||
# Currently, memory growth needs to be the same across GPUs
|
||||
for gpu in gpus:
|
||||
tf.config.experimental.set_memory_growth(gpu, True)
|
||||
logical_gpus = tf.config.experimental.list_logical_devices('GPU')
|
||||
print(len(gpus), "Physical GPUs,", len(logical_gpus), "Logical GPUs")
|
||||
except RuntimeError as e:
|
||||
# Memory growth must be set before GPUs have been initialized
|
||||
print(e)
|
||||
@ -0,0 +1,50 @@
|
||||
import cv2
|
||||
import numpy as np
|
||||
import json
|
||||
|
||||
# Dependencies Ubuntu1804
|
||||
# sudo apt install libsm6 libxrender1
|
||||
# pip3 install opencv-python --user
|
||||
|
||||
# Parameters:
|
||||
# json_name: name of output json file
|
||||
# camera_mat: 3x3 Camera Matrix
|
||||
# dist_coeff: distortion coefficients
|
||||
# lidar_points: Nx3 1-channel 3D points
|
||||
# image_points: Nx2 1-channel 2D points
|
||||
# Return value:
|
||||
# T: 4x4 SE(3) transform matrix
|
||||
def lidar_camera_calib(json_name, camera_mat, dist_coeff, lidar_points, image_points):
|
||||
retval, rvec, tvec, inliers = cv2.solvePnPRansac(lidar_points, image_points, camera_mat, dist_coeff, iterationsCount=5000, reprojectionError=8.0)
|
||||
print("-----")
|
||||
rot_mat, jac = cv2.Rodrigues(rvec)
|
||||
print(rot_mat)
|
||||
print("-----")
|
||||
print(tvec)
|
||||
print("-----")
|
||||
rt = np.hstack((rot_mat, tvec))
|
||||
T = np.vstack((rt, [[0,0,0,1]]))
|
||||
print (T)
|
||||
calib_json = {
|
||||
"extrinsic": T.flatten().tolist(),
|
||||
"intrinsic": camera_mat.flatten().tolist()
|
||||
}
|
||||
json_object = json.dumps(calib_json, indent = 4)
|
||||
# Writing to sample.json
|
||||
with open(json_name, "w") as outfile:
|
||||
outfile.write(json_object)
|
||||
return T
|
||||
|
||||
|
||||
### TEST
|
||||
|
||||
if __name__ == "__main__":
|
||||
fs = cv2.FileStorage("front_config.yaml", cv2.FILE_STORAGE_READ)
|
||||
camera_mat = fs.getNode("CameraMat").mat()
|
||||
dist_coeff = fs.getNode("DistCoeff").mat()
|
||||
image_points = fs.getNode("CameraPoints").mat()
|
||||
print(image_points)
|
||||
lidar_points = fs.getNode("LidarPoints").mat()
|
||||
print(lidar_points)
|
||||
lidar_camera_calib("front.json", camera_mat, dist_coeff, lidar_points, image_points)
|
||||
pass
|
||||
@ -0,0 +1,9 @@
|
||||
{
|
||||
"extrinsic": [-0.9994466143126584, 0.033033376071303994, -0.003906559137689193, 0.20487898588180542,
|
||||
0.0025198193977806005, -0.0419178508124942, -0.9991178830816032, 0.0013696063542738557,
|
||||
-0.033167991334523576, -0.9985748293686324, 0.04181141593201179, -0.10943480581045151,
|
||||
0, 0, 0, 1],
|
||||
"intrinsic": [1.2100629810000000e+03, 0.0, 1.0224299030000000e+03,
|
||||
0.0,1.2058507139999999e+03, 7.9254164400000002e+02,
|
||||
0.0, 0.0, 1.0]
|
||||
}
|
||||
@ -0,0 +1,18 @@
|
||||
{
|
||||
"extrinsic_ok": [0.000795916642330613, -0.9994847331424607, 0.03208792189972302, -0.5,
|
||||
0.05182623470216488, -0.03200358149726322, -0.9981431821977967, 0.0013696063542738557,
|
||||
0.998655800520527, 0.002457434941619845, 0.05177405817794394, -0.10943480581045151,
|
||||
0, 0, 0, 1],
|
||||
"extrinsic": [ -3.9384503688273731e-02, -9.9721160654039998e-01,
|
||||
6.3386691429213382e-02, 1.2484878301620483e-01,
|
||||
5.0218947462187857e-02, -6.5331141114291447e-02,
|
||||
-9.9659916682510530e-01, -1.8440222740173340e-01,
|
||||
9.9796138110901755e-01, -3.6067350634868045e-02,
|
||||
5.2651951845710920e-02, -3.9436036348342896e-01, 0, 0, 0, 1],
|
||||
|
||||
"intrinsic": [1.2100629810000000e+03, 0.0, 1.0224299030000000e+03,
|
||||
0.0,1.2058507139999999e+03, 7.9254164400000002e+02,
|
||||
0.0, 0.0, 1.0]
|
||||
}
|
||||
|
||||
|
||||
@ -0,0 +1,11 @@
|
||||
{
|
||||
"extrinsic": [3.5640002421153172e-02, 9.9786432954622106e-01,
|
||||
-5.4740935749134578e-02, 1.0951525717973709e-01,
|
||||
-9.7262110862409989e-03, -5.4426799113952706e-02,
|
||||
-9.9847039232824297e-01, -3.1793252564966679e-03,
|
||||
-9.9931736252570236e-01, 3.6117909096182677e-02,
|
||||
7.7656678524001821e-03, -3.9152929186820984e-01, 0, 0, 0, 1],
|
||||
"intrinsic": [1.2100629810000000e+03, 0.0, 1.0224299030000000e+03,
|
||||
0.0,1.2058507139999999e+03, 7.9254164400000002e+02,
|
||||
0.0, 0.0, 1.0]
|
||||
}
|
||||
|
After Width: | Height: | Size: 268 KiB |
|
After Width: | Height: | Size: 275 KiB |
|
After Width: | Height: | Size: 275 KiB |
|
After Width: | Height: | Size: 274 KiB |
|
After Width: | Height: | Size: 242 KiB |
|
After Width: | Height: | Size: 213 KiB |
|
After Width: | Height: | Size: 297 KiB |
|
After Width: | Height: | Size: 302 KiB |
|
After Width: | Height: | Size: 262 KiB |
@ -0,0 +1,401 @@
|
||||
[
|
||||
{
|
||||
"obj_id": "1",
|
||||
"obj_type": "Car",
|
||||
"psr": {
|
||||
"position": {
|
||||
"x": 3.529868076024286,
|
||||
"y": -20.977179189290187,
|
||||
"z": 0.2729166298029867
|
||||
},
|
||||
"rotation": {
|
||||
"x": -0.06410093347106911,
|
||||
"y": 0.019216916140136837,
|
||||
"z": -1.4922565104551522
|
||||
},
|
||||
"scale": {
|
||||
"x": 3.9244923848790014,
|
||||
"y": 1.865599097293131,
|
||||
"z": 1.7888008346377304
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"obj_id": "3",
|
||||
"obj_type": "Bus",
|
||||
"psr": {
|
||||
"position": {
|
||||
"x": 8.558005738090287,
|
||||
"y": -43.42623181315385,
|
||||
"z": 2.2127436169999997
|
||||
},
|
||||
"rotation": {
|
||||
"x": -0.05043085100891321,
|
||||
"y": 0.00034744616962805586,
|
||||
"z": 1.4537329581202632
|
||||
},
|
||||
"scale": {
|
||||
"x": 10.607773093776615,
|
||||
"y": 3.2364406462431763,
|
||||
"z": 3.2164060563210306
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"obj_id": "5",
|
||||
"obj_type": "Rider",
|
||||
"psr": {
|
||||
"position": {
|
||||
"x": 2.5209829273189825,
|
||||
"y": -42.68335076021329,
|
||||
"z": 1.584129100000001
|
||||
},
|
||||
"rotation": {
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 4.336244465085028
|
||||
},
|
||||
"scale": {
|
||||
"x": 1.6596497400399342,
|
||||
"y": 0.6739244576664531,
|
||||
"z": 1.7
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"obj_id": "6",
|
||||
"obj_type": "Rider",
|
||||
"psr": {
|
||||
"position": {
|
||||
"x": -10.771864568778255,
|
||||
"y": -15.93655177072094,
|
||||
"z": 0.24457627000000032
|
||||
},
|
||||
"rotation": {
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": -1.9517015556769242
|
||||
},
|
||||
"scale": {
|
||||
"x": 1.6596497400399342,
|
||||
"y": 0.6739244576664531,
|
||||
"z": 1.7
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"obj_id": "8",
|
||||
"obj_type": "Car",
|
||||
"psr": {
|
||||
"position": {
|
||||
"x": 4.1449631260256865,
|
||||
"y": -49.72015370499495,
|
||||
"z": 1.8306930000000008
|
||||
},
|
||||
"rotation": {
|
||||
"x": -0.05381384131006369,
|
||||
"y": 0.0026916304823240986,
|
||||
"z": 1.449489444900611
|
||||
},
|
||||
"scale": {
|
||||
"x": 4.5,
|
||||
"y": 1.6788924984728437,
|
||||
"z": 1.656933188116807
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"obj_id": "13",
|
||||
"obj_type": "Car",
|
||||
"psr": {
|
||||
"position": {
|
||||
"x": 4.782968954281387,
|
||||
"y": -38.264784793961525,
|
||||
"z": 1.2062180000000002
|
||||
},
|
||||
"rotation": {
|
||||
"x": -0.053129458150669544,
|
||||
"y": 0,
|
||||
"z": 1.4605105607601199
|
||||
},
|
||||
"scale": {
|
||||
"x": 4.590450000000001,
|
||||
"y": 1.8,
|
||||
"z": 1.4558852218914666
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"obj_id": "14",
|
||||
"obj_type": "Pedestrian",
|
||||
"psr": {
|
||||
"position": {
|
||||
"x": 21.764847842841846,
|
||||
"y": 19.67531983340936,
|
||||
"z": -2.3684009999999995
|
||||
},
|
||||
"rotation": {
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": -1.4134299092031593
|
||||
},
|
||||
"scale": {
|
||||
"x": 0.941235148478231,
|
||||
"y": 0.8223159109219417,
|
||||
"z": 1.9347585767365922
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"obj_id": "15",
|
||||
"obj_type": "Car",
|
||||
"psr": {
|
||||
"position": {
|
||||
"x": 24.92262785789717,
|
||||
"y": -31.23023375697396,
|
||||
"z": 0.346809
|
||||
},
|
||||
"rotation": {
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": -0.2819996471249957
|
||||
},
|
||||
"scale": {
|
||||
"x": 4.5,
|
||||
"y": 1.6458116836318435,
|
||||
"z": 1.5
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"obj_id": "20",
|
||||
"obj_type": "Car",
|
||||
"psr": {
|
||||
"position": {
|
||||
"x": -2.717663507885487,
|
||||
"y": -28.242388522408124,
|
||||
"z": 0.918762822918971
|
||||
},
|
||||
"rotation": {
|
||||
"x": -0.06517306244786299,
|
||||
"y": 0.00010959092045555565,
|
||||
"z": 4.658312072236952
|
||||
},
|
||||
"scale": {
|
||||
"x": 4.921583727079626,
|
||||
"y": 4.030003022236565,
|
||||
"z": 2.0017558148508505
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"obj_id": "23",
|
||||
"obj_type": "Car",
|
||||
"psr": {
|
||||
"position": {
|
||||
"x": 15.708570068829054,
|
||||
"y": 22.8816763991485,
|
||||
"z": -2.823972376959448
|
||||
},
|
||||
"rotation": {
|
||||
"x": -0.06287060419300494,
|
||||
"y": 0.044058144173183246,
|
||||
"z": 1.5608175536652484
|
||||
},
|
||||
"scale": {
|
||||
"x": 4.723135139885376,
|
||||
"y": 1.6295165184473699,
|
||||
"z": 1.9629544517990642
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"obj_id": "27",
|
||||
"obj_type": "Car",
|
||||
"psr": {
|
||||
"position": {
|
||||
"x": 36.659412470409734,
|
||||
"y": -34.404139500162444,
|
||||
"z": 0.8085990000000003
|
||||
},
|
||||
"rotation": {
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 6.04508466163526
|
||||
},
|
||||
"scale": {
|
||||
"x": 4.5,
|
||||
"y": 1.8,
|
||||
"z": 1.5
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"obj_id": "31",
|
||||
"obj_type": "Pedestrian",
|
||||
"psr": {
|
||||
"position": {
|
||||
"x": -20.783288738584815,
|
||||
"y": -35.12896563418934,
|
||||
"z": 1.858591100000001
|
||||
},
|
||||
"rotation": {
|
||||
"x": -0.005200816595089385,
|
||||
"y": 0,
|
||||
"z": 1.471107993095347
|
||||
},
|
||||
"scale": {
|
||||
"x": 0.5181025259869625,
|
||||
"y": 0.7083013780156343,
|
||||
"z": 1.7341699999999998
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"obj_id": "50",
|
||||
"obj_type": "Rider",
|
||||
"psr": {
|
||||
"position": {
|
||||
"x": 15.9087829430282,
|
||||
"y": -40.12813618888572,
|
||||
"z": 1.2355839999999998
|
||||
},
|
||||
"rotation": {
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 1.3266865299729125
|
||||
},
|
||||
"scale": {
|
||||
"x": 1.797162849996143,
|
||||
"y": 1.3257591556815653,
|
||||
"z": 1.8592649635634135
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"obj_id": "51",
|
||||
"obj_type": "Pedestrian",
|
||||
"psr": {
|
||||
"position": {
|
||||
"x": 22.8371355483323,
|
||||
"y": 4.90188930510908,
|
||||
"z": -1.7500000000000009
|
||||
},
|
||||
"rotation": {
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 4.482388980384684
|
||||
},
|
||||
"scale": {
|
||||
"x": 0.6015009483696415,
|
||||
"y": 0.6285815091742153,
|
||||
"z": 1.7
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"obj_id": "53",
|
||||
"obj_type": "Pedestrian",
|
||||
"psr": {
|
||||
"position": {
|
||||
"x": 19.123480909896898,
|
||||
"y": 1.5139745995868878,
|
||||
"z": -1.3000000000000005
|
||||
},
|
||||
"rotation": {
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 4.71238898038469
|
||||
},
|
||||
"scale": {
|
||||
"x": 0.7412849208820917,
|
||||
"y": 0.6806637022431177,
|
||||
"z": 1.7
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"obj_id": "54",
|
||||
"obj_type": "Motor",
|
||||
"psr": {
|
||||
"position": {
|
||||
"x": 24.253720531058207,
|
||||
"y": 15.162416511901782,
|
||||
"z": -2.4499999999999993
|
||||
},
|
||||
"rotation": {
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 0.047350384707351756
|
||||
},
|
||||
"scale": {
|
||||
"x": 1.7485658990665154,
|
||||
"y": 1.0208318215505217,
|
||||
"z": 1.5
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"obj_id": "81",
|
||||
"obj_type": "Pedestrian",
|
||||
"psr": {
|
||||
"position": {
|
||||
"x": -8.085881877042993,
|
||||
"y": -6.2551993211908155,
|
||||
"z": -0.1914089000000001
|
||||
},
|
||||
"rotation": {
|
||||
"x": -0.005200816595089385,
|
||||
"y": 0,
|
||||
"z": 4.61270064668514
|
||||
},
|
||||
"scale": {
|
||||
"x": 0.6448904310729859,
|
||||
"y": 0.7083013780156343,
|
||||
"z": 1.7341699999999998
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"obj_id": "82",
|
||||
"obj_type": "Pedestrian",
|
||||
"psr": {
|
||||
"position": {
|
||||
"x": -6.645859750894334,
|
||||
"y": -4.976769948383015,
|
||||
"z": 0.7114255483000865
|
||||
},
|
||||
"rotation": {
|
||||
"x": -0.16631359886906968,
|
||||
"y": 0,
|
||||
"z": -1.669189425167795
|
||||
},
|
||||
"scale": {
|
||||
"x": 3.302160998965941,
|
||||
"y": 2.0051437367936247,
|
||||
"z": 1.9156025512243486
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"obj_id": "1001",
|
||||
"obj_type": "Truck",
|
||||
"psr": {
|
||||
"position": {
|
||||
"x": -22.386071618064307,
|
||||
"y": -21.994698203384374,
|
||||
"z": 0.8958240400000002
|
||||
},
|
||||
"rotation": {
|
||||
"x": -0.06061705351581413,
|
||||
"y": 0.0005575736396516535,
|
||||
"z": 3.082377014838373
|
||||
},
|
||||
"scale": {
|
||||
"x": 5.083309851403533,
|
||||
"y": 1.7025087091290587,
|
||||
"z": 2.2705067053039354
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
@ -0,0 +1,443 @@
|
||||
[
|
||||
{
|
||||
"obj_id": "1",
|
||||
"obj_type": "Car",
|
||||
"psr": {
|
||||
"position": {
|
||||
"x": 4.503374840671313,
|
||||
"y": -15.877214498771757,
|
||||
"z": -0.3460004979550271
|
||||
},
|
||||
"rotation": {
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": -1.5446163880149815
|
||||
},
|
||||
"scale": {
|
||||
"x": 4.177141189575195,
|
||||
"y": 1.7932285025511971,
|
||||
"z": 1.678846906459218
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"obj_id": "3",
|
||||
"obj_type": "Bus",
|
||||
"psr": {
|
||||
"position": {
|
||||
"x": 10.521892170327192,
|
||||
"y": -30.12354183191181,
|
||||
"z": 1.0691971370000002
|
||||
},
|
||||
"rotation": {
|
||||
"x": -0.05043085100891321,
|
||||
"y": 0.00034744616962805586,
|
||||
"z": 1.4962921107974831
|
||||
},
|
||||
"scale": {
|
||||
"x": 10.4060401,
|
||||
"y": 2.6116105531799785,
|
||||
"z": 3.2164060563210306
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"obj_id": "4",
|
||||
"obj_type": "Car",
|
||||
"psr": {
|
||||
"position": {
|
||||
"x": 5.585192027760058,
|
||||
"y": -48.75586246676285,
|
||||
"z": 1.4203556999999993
|
||||
},
|
||||
"rotation": {
|
||||
"x": -0.053810528807219656,
|
||||
"y": 0.0053141924483858785,
|
||||
"z": 1.4025025217488531
|
||||
},
|
||||
"scale": {
|
||||
"x": 4.500000000000001,
|
||||
"y": 1.7126382376921478,
|
||||
"z": 1.7071399206499345
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"obj_id": "5",
|
||||
"obj_type": "Rider",
|
||||
"psr": {
|
||||
"position": {
|
||||
"x": 3.635891386798903,
|
||||
"y": -35.527682658837875,
|
||||
"z": 0.8730890000000007
|
||||
},
|
||||
"rotation": {
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 4.166373105671871
|
||||
},
|
||||
"scale": {
|
||||
"x": 1.6596497400399342,
|
||||
"y": 0.6739244576664531,
|
||||
"z": 1.7
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"obj_id": "6",
|
||||
"obj_type": "Rider",
|
||||
"psr": {
|
||||
"position": {
|
||||
"x": -9.92745449121503,
|
||||
"y": -11.280291087150871,
|
||||
"z": -0.3301027299999997
|
||||
},
|
||||
"rotation": {
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 4.8108484679662915
|
||||
},
|
||||
"scale": {
|
||||
"x": 1.6596497400399342,
|
||||
"y": 0.6739244576664531,
|
||||
"z": 1.7
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"obj_id": "8",
|
||||
"obj_type": "Car",
|
||||
"psr": {
|
||||
"position": {
|
||||
"x": 6.345250193364336,
|
||||
"y": -38.390702547377195,
|
||||
"z": 0.938608
|
||||
},
|
||||
"rotation": {
|
||||
"x": -0.05381384131006369,
|
||||
"y": 0.0026916304823240986,
|
||||
"z": 1.4440701421438633
|
||||
},
|
||||
"scale": {
|
||||
"x": 4.5,
|
||||
"y": 1.6788924984728437,
|
||||
"z": 1.656933188116807
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"obj_id": "12",
|
||||
"obj_type": "ScooterRider",
|
||||
"psr": {
|
||||
"position": {
|
||||
"x": 14.820338434030418,
|
||||
"y": 3.435544743843195,
|
||||
"z": -1.6107520845526528
|
||||
},
|
||||
"rotation": {
|
||||
"x": -0.053440348687811355,
|
||||
"y": 0.035967629937501557,
|
||||
"z": 1.6076175054396962
|
||||
},
|
||||
"scale": {
|
||||
"x": 4.379977656992434,
|
||||
"y": 1.8005836314652388,
|
||||
"z": 1.7880874763364236
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"obj_id": "15",
|
||||
"obj_type": "Car",
|
||||
"psr": {
|
||||
"position": {
|
||||
"x": 26.014664657890535,
|
||||
"y": -22.961017751495092,
|
||||
"z": -0.359602
|
||||
},
|
||||
"rotation": {
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": -0.2716148841733539
|
||||
},
|
||||
"scale": {
|
||||
"x": 4.5,
|
||||
"y": 1.6458116836318435,
|
||||
"z": 1.5
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"obj_id": "20",
|
||||
"obj_type": "Car",
|
||||
"psr": {
|
||||
"position": {
|
||||
"x": -0.7670059417760058,
|
||||
"y": -30.939386273400487,
|
||||
"z": 0.7940450000000004
|
||||
},
|
||||
"rotation": {
|
||||
"x": -0.06517306244786299,
|
||||
"y": 0.00010959092045555565,
|
||||
"z": 4.66849627543049
|
||||
},
|
||||
"scale": {
|
||||
"x": 4.921583727079626,
|
||||
"y": 1.6458116836318435,
|
||||
"z": 2.0017558148508505
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"obj_id": "23",
|
||||
"obj_type": "Car",
|
||||
"psr": {
|
||||
"position": {
|
||||
"x": 15.14633855082866,
|
||||
"y": 30.611494570558676,
|
||||
"z": -2.9500175400000015
|
||||
},
|
||||
"rotation": {
|
||||
"x": -0.06287060419300494,
|
||||
"y": 0.044058144173183246,
|
||||
"z": 1.6023625854728965
|
||||
},
|
||||
"scale": {
|
||||
"x": 4.281595594230369,
|
||||
"y": 1.6295165184473699,
|
||||
"z": 1.7242113198564337
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"obj_id": "27",
|
||||
"obj_type": "Car",
|
||||
"psr": {
|
||||
"position": {
|
||||
"x": 36.9113921044227,
|
||||
"y": -25.68832836540986,
|
||||
"z": 0.008700000000000027
|
||||
},
|
||||
"rotation": {
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 6.024547645659967
|
||||
},
|
||||
"scale": {
|
||||
"x": 4.5,
|
||||
"y": 1.8,
|
||||
"z": 1.5
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"obj_id": "31",
|
||||
"obj_type": "Pedestrian",
|
||||
"psr": {
|
||||
"position": {
|
||||
"x": -19.401334152866184,
|
||||
"y": -28.11937218362243,
|
||||
"z": 1.0960769000000004
|
||||
},
|
||||
"rotation": {
|
||||
"x": -0.005200816595089385,
|
||||
"y": 0,
|
||||
"z": 1.6579219608677465
|
||||
},
|
||||
"scale": {
|
||||
"x": 0.5181025259869625,
|
||||
"y": 0.7083013780156343,
|
||||
"z": 1.7341699999999998
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"obj_id": "50",
|
||||
"obj_type": "Rider",
|
||||
"psr": {
|
||||
"position": {
|
||||
"x": 18.173753849361674,
|
||||
"y": -30.367500823003894,
|
||||
"z": 0.2726954
|
||||
},
|
||||
"rotation": {
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 1.3263297456296164
|
||||
},
|
||||
"scale": {
|
||||
"x": 1.797162849996143,
|
||||
"y": 1.3257591556815653,
|
||||
"z": 1.8592649635634135
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"obj_id": "51",
|
||||
"obj_type": "Pedestrian",
|
||||
"psr": {
|
||||
"position": {
|
||||
"x": 22.97686177419746,
|
||||
"y": 11.40824442499958,
|
||||
"z": -1.8135980000000007
|
||||
},
|
||||
"rotation": {
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 4.604303626171054
|
||||
},
|
||||
"scale": {
|
||||
"x": 0.4,
|
||||
"y": 0.5,
|
||||
"z": 1.7
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"obj_id": "53",
|
||||
"obj_type": "Pedestrian",
|
||||
"psr": {
|
||||
"position": {
|
||||
"x": 19.431924798827822,
|
||||
"y": 7.5874583524613115,
|
||||
"z": -1.5661729000000006
|
||||
},
|
||||
"rotation": {
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 4.94889022902884
|
||||
},
|
||||
"scale": {
|
||||
"x": 0.7412849208820917,
|
||||
"y": 0.6806637022431177,
|
||||
"z": 1.7
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"obj_id": "54",
|
||||
"obj_type": "Motor",
|
||||
"psr": {
|
||||
"position": {
|
||||
"x": 23.871463015599147,
|
||||
"y": 23.441630667210575,
|
||||
"z": -2.7554859999999994
|
||||
},
|
||||
"rotation": {
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 0.022992675932349105
|
||||
},
|
||||
"scale": {
|
||||
"x": 1.7485658990665154,
|
||||
"y": 1.0208318215505217,
|
||||
"z": 1.5
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"obj_id": "55",
|
||||
"obj_type": "Pedestrian",
|
||||
"psr": {
|
||||
"position": {
|
||||
"x": 31.439284482588846,
|
||||
"y": -4.193343996232173,
|
||||
"z": -0.9135979999999999
|
||||
},
|
||||
"rotation": {
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 4.604303626171054
|
||||
},
|
||||
"scale": {
|
||||
"x": 0.5285163867593005,
|
||||
"y": 0.4571699121199565,
|
||||
"z": 1.7515116999999998
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"obj_id": "56",
|
||||
"obj_type": "Pedestrian",
|
||||
"psr": {
|
||||
"position": {
|
||||
"x": 31.391454285232612,
|
||||
"y": -9.776642501469652,
|
||||
"z": -0.6135979999999996
|
||||
},
|
||||
"rotation": {
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 4.604303626171054
|
||||
},
|
||||
"scale": {
|
||||
"x": 0.4,
|
||||
"y": 0.5,
|
||||
"z": 1.7
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"obj_id": "81",
|
||||
"obj_type": "Pedestrian",
|
||||
"psr": {
|
||||
"position": {
|
||||
"x": -8.238199666011496,
|
||||
"y": -1.2778094076889062,
|
||||
"z": -0.5347769000000001
|
||||
},
|
||||
"rotation": {
|
||||
"x": -0.005200816595089385,
|
||||
"y": 0,
|
||||
"z": 4.42995090230805
|
||||
},
|
||||
"scale": {
|
||||
"x": 0.6448904310729859,
|
||||
"y": 0.7083013780156343,
|
||||
"z": 1.7341699999999998
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"obj_id": "82",
|
||||
"obj_type": "Pedestrian",
|
||||
"psr": {
|
||||
"position": {
|
||||
"x": -8.833678431936278,
|
||||
"y": -0.8071350377079227,
|
||||
"z": -0.3652358000000001
|
||||
},
|
||||
"rotation": {
|
||||
"x": -0.005200816595089385,
|
||||
"y": 0,
|
||||
"z": 4.364731468834899
|
||||
},
|
||||
"scale": {
|
||||
"x": 1.693008699814737,
|
||||
"y": 0.7746587857577377,
|
||||
"z": 1.9156025512243486
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"obj_id": "1001",
|
||||
"obj_type": "Truck",
|
||||
"psr": {
|
||||
"position": {
|
||||
"x": -21.54366493847192,
|
||||
"y": -15.28593041581101,
|
||||
"z": 0.31162861999999997
|
||||
},
|
||||
"rotation": {
|
||||
"x": -0.06061705351581413,
|
||||
"y": 0.0005575736396516535,
|
||||
"z": 3.1487339004759765
|
||||
},
|
||||
"scale": {
|
||||
"x": 5.083309851403533,
|
||||
"y": 1.7025087091290587,
|
||||
"z": 2.2705067053039354
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
@ -0,0 +1,485 @@
|
||||
[
|
||||
{
|
||||
"obj_id": "1",
|
||||
"obj_type": "Car",
|
||||
"psr": {
|
||||
"position": {
|
||||
"x": 4.784003790176939,
|
||||
"y": -13.454661395730007,
|
||||
"z": -0.5538587820529938
|
||||
},
|
||||
"rotation": {
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": -1.5446163880149815
|
||||
},
|
||||
"scale": {
|
||||
"x": 4.167753219604492,
|
||||
"y": 1.9812848567962646,
|
||||
"z": 1.858795166015625
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"obj_id": "2",
|
||||
"obj_type": "Car",
|
||||
"psr": {
|
||||
"position": {
|
||||
"x": 3.586074486432309,
|
||||
"y": -2.372378855929234,
|
||||
"z": -1.0705697530267009
|
||||
},
|
||||
"rotation": {
|
||||
"x": -0.06819227924229494,
|
||||
"y": 0.002044793837571052,
|
||||
"z": 4.740576049921166
|
||||
},
|
||||
"scale": {
|
||||
"x": 5.076940947017958,
|
||||
"y": 1.9168826499425866,
|
||||
"z": 1.5
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"obj_id": "4",
|
||||
"obj_type": "Car",
|
||||
"psr": {
|
||||
"position": {
|
||||
"x": 6.165892665278079,
|
||||
"y": -44.80607990532485,
|
||||
"z": 1.132732699999999
|
||||
},
|
||||
"rotation": {
|
||||
"x": -0.053810528807219656,
|
||||
"y": 0.0053141924483858785,
|
||||
"z": 1.4369887449182623
|
||||
},
|
||||
"scale": {
|
||||
"x": 4.500000000000001,
|
||||
"y": 1.7126382376921478,
|
||||
"z": 1.7071399206499345
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"obj_id": "5",
|
||||
"obj_type": "Rider",
|
||||
"psr": {
|
||||
"position": {
|
||||
"x": 3.770858943291387,
|
||||
"y": -32.91325129317749,
|
||||
"z": 0.6915870000000004
|
||||
},
|
||||
"rotation": {
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 4.005606121419104
|
||||
},
|
||||
"scale": {
|
||||
"x": 1.6596497400399342,
|
||||
"y": 0.6739244576664531,
|
||||
"z": 1.7
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"obj_id": "6",
|
||||
"obj_type": "Rider",
|
||||
"psr": {
|
||||
"position": {
|
||||
"x": -9.866532331438066,
|
||||
"y": -9.670873180843602,
|
||||
"z": -0.46593372999999966
|
||||
},
|
||||
"rotation": {
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 4.638826826395679
|
||||
},
|
||||
"scale": {
|
||||
"x": 1.6596497400399342,
|
||||
"y": 0.6739244576664531,
|
||||
"z": 1.7
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"obj_id": "8",
|
||||
"obj_type": "Car",
|
||||
"psr": {
|
||||
"position": {
|
||||
"x": 7.053143610148254,
|
||||
"y": -33.90999396215142,
|
||||
"z": 0.603445
|
||||
},
|
||||
"rotation": {
|
||||
"x": -0.05381384131006369,
|
||||
"y": 0.0026916304823240986,
|
||||
"z": 1.4802022338780045
|
||||
},
|
||||
"scale": {
|
||||
"x": 4.5,
|
||||
"y": 1.6788924984728437,
|
||||
"z": 1.656933188116807
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"obj_id": "11",
|
||||
"obj_type": "Rider",
|
||||
"psr": {
|
||||
"position": {
|
||||
"x": 11.308020884323923,
|
||||
"y": -38.0037315949891,
|
||||
"z": 0.6589369999999996
|
||||
},
|
||||
"rotation": {
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 1.6856137335188808
|
||||
},
|
||||
"scale": {
|
||||
"x": 2.02508808259896,
|
||||
"y": 0.6606454834491257,
|
||||
"z": 1.7
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"obj_id": "12",
|
||||
"obj_type": "ScooterRider",
|
||||
"psr": {
|
||||
"position": {
|
||||
"x": 14.859489880080266,
|
||||
"y": 6.447929590857548,
|
||||
"z": -1.5666677722506137
|
||||
},
|
||||
"rotation": {
|
||||
"x": -0.05336847556558379,
|
||||
"y": 0.0310775824138393,
|
||||
"z": 1.5861208514888574
|
||||
},
|
||||
"scale": {
|
||||
"x": 4.399971022524501,
|
||||
"y": 1.7647274273743618,
|
||||
"z": 2.3011966721519643
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"obj_id": "13",
|
||||
"obj_type": "Car",
|
||||
"psr": {
|
||||
"position": {
|
||||
"x": 7.384257014309696,
|
||||
"y": -17.53127955603184,
|
||||
"z": -0.4020345000000003
|
||||
},
|
||||
"rotation": {
|
||||
"x": -0.053129458150669544,
|
||||
"y": 0,
|
||||
"z": 1.561265466896798
|
||||
},
|
||||
"scale": {
|
||||
"x": 4.590450000000001,
|
||||
"y": 1.8,
|
||||
"z": 1.4558852218914666
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"obj_id": "15",
|
||||
"obj_type": "Car",
|
||||
"psr": {
|
||||
"position": {
|
||||
"x": 26.501654719824728,
|
||||
"y": -20.017881528365823,
|
||||
"z": -0.483382
|
||||
},
|
||||
"rotation": {
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": -0.2570466758939278
|
||||
},
|
||||
"scale": {
|
||||
"x": 4.5,
|
||||
"y": 1.6458116836318435,
|
||||
"z": 1.5
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"obj_id": "20",
|
||||
"obj_type": "Car",
|
||||
"psr": {
|
||||
"position": {
|
||||
"x": -0.4221746774346684,
|
||||
"y": -31.822508595860747,
|
||||
"z": 0.8377380100000005
|
||||
},
|
||||
"rotation": {
|
||||
"x": -0.06517306244786299,
|
||||
"y": 0.00010959092045555565,
|
||||
"z": 4.6871396826216944
|
||||
},
|
||||
"scale": {
|
||||
"x": 4.921583727079626,
|
||||
"y": 1.6458116836318435,
|
||||
"z": 2.0017558148508505
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"obj_id": "23",
|
||||
"obj_type": "Car",
|
||||
"psr": {
|
||||
"position": {
|
||||
"x": 14.86459317241679,
|
||||
"y": 33.555465961537415,
|
||||
"z": -3.1861439999999983
|
||||
},
|
||||
"rotation": {
|
||||
"x": -0.06287060419300494,
|
||||
"y": 0.044058144173183246,
|
||||
"z": 1.6095676840298194
|
||||
},
|
||||
"scale": {
|
||||
"x": 4.281595594230369,
|
||||
"y": 1.6295165184473699,
|
||||
"z": 1.7242113198564337
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"obj_id": "27",
|
||||
"obj_type": "Car",
|
||||
"psr": {
|
||||
"position": {
|
||||
"x": 36.97714857076062,
|
||||
"y": -22.4487879566715,
|
||||
"z": -0.18954880000000002
|
||||
},
|
||||
"rotation": {
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 6.0389682435723016
|
||||
},
|
||||
"scale": {
|
||||
"x": 4.5,
|
||||
"y": 1.8,
|
||||
"z": 1.5
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"obj_id": "31",
|
||||
"obj_type": "Pedestrian",
|
||||
"psr": {
|
||||
"position": {
|
||||
"x": -18.973385988607333,
|
||||
"y": -25.573029990466267,
|
||||
"z": 0.9052889000000002
|
||||
},
|
||||
"rotation": {
|
||||
"x": -0.005200816595089385,
|
||||
"y": 0,
|
||||
"z": 1.6649168109660173
|
||||
},
|
||||
"scale": {
|
||||
"x": 0.5129727980068935,
|
||||
"y": 0.5634125150659849,
|
||||
"z": 1.7
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"obj_id": "50",
|
||||
"obj_type": "Rider",
|
||||
"psr": {
|
||||
"position": {
|
||||
"x": 18.940376259623008,
|
||||
"y": -25.913100597094086,
|
||||
"z": -0.064444
|
||||
},
|
||||
"rotation": {
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 1.45273445713904
|
||||
},
|
||||
"scale": {
|
||||
"x": 1.797162849996143,
|
||||
"y": 1.3257591556815653,
|
||||
"z": 1.8592649635634135
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"obj_id": "51",
|
||||
"obj_type": "Pedestrian",
|
||||
"psr": {
|
||||
"position": {
|
||||
"x": 23.136293201736407,
|
||||
"y": 13.815515606019003,
|
||||
"z": -1.9757900000000008
|
||||
},
|
||||
"rotation": {
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 4.42358809379019
|
||||
},
|
||||
"scale": {
|
||||
"x": 0.5285163867593005,
|
||||
"y": 0.4571699121199565,
|
||||
"z": 1.7515116999999998
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"obj_id": "53",
|
||||
"obj_type": "Pedestrian",
|
||||
"psr": {
|
||||
"position": {
|
||||
"x": 19.483984140064422,
|
||||
"y": 9.991123444156456,
|
||||
"z": -1.680906800000001
|
||||
},
|
||||
"rotation": {
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 4.653458477625549
|
||||
},
|
||||
"scale": {
|
||||
"x": 0.7412849208820917,
|
||||
"y": 0.6806637022431177,
|
||||
"z": 1.7
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"obj_id": "54",
|
||||
"obj_type": "Motor",
|
||||
"psr": {
|
||||
"position": {
|
||||
"x": 23.854108593626734,
|
||||
"y": 26.472013961329335,
|
||||
"z": -2.765640999999999
|
||||
},
|
||||
"rotation": {
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": -0.037857281871391146
|
||||
},
|
||||
"scale": {
|
||||
"x": 1.7485658990665154,
|
||||
"y": 1.0208318215505217,
|
||||
"z": 1.5
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"obj_id": "55",
|
||||
"obj_type": "Pedestrian",
|
||||
"psr": {
|
||||
"position": {
|
||||
"x": 31.86102411918546,
|
||||
"y": -1.7469702631273432,
|
||||
"z": -0.9479467999999999
|
||||
},
|
||||
"rotation": {
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 4.6225851649863845
|
||||
},
|
||||
"scale": {
|
||||
"x": 0.5285163867593005,
|
||||
"y": 0.4571699121199565,
|
||||
"z": 1.7515116999999998
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"obj_id": "56",
|
||||
"obj_type": "Pedestrian",
|
||||
"psr": {
|
||||
"position": {
|
||||
"x": 31.376673016919085,
|
||||
"y": -6.1856712753724,
|
||||
"z": -0.8114728499999998
|
||||
},
|
||||
"rotation": {
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 4.644110482942937
|
||||
},
|
||||
"scale": {
|
||||
"x": 0.4,
|
||||
"y": 0.5,
|
||||
"z": 1.7
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"obj_id": "81",
|
||||
"obj_type": "Pedestrian",
|
||||
"psr": {
|
||||
"position": {
|
||||
"x": -8.48876171313168,
|
||||
"y": 0.6505407628575157,
|
||||
"z": -0.6298729000000001
|
||||
},
|
||||
"rotation": {
|
||||
"x": -0.005200816595089385,
|
||||
"y": 0,
|
||||
"z": 4.201519019875148
|
||||
},
|
||||
"scale": {
|
||||
"x": 0.8668083543246112,
|
||||
"y": 0.711262079972739,
|
||||
"z": 1.7341699999999998
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"obj_id": "82",
|
||||
"obj_type": "Pedestrian",
|
||||
"psr": {
|
||||
"position": {
|
||||
"x": -9.083890529840573,
|
||||
"y": 1.1163202105149936,
|
||||
"z": -0.5397099000000001
|
||||
},
|
||||
"rotation": {
|
||||
"x": -0.005200816595089385,
|
||||
"y": 0,
|
||||
"z": 4.348478208149016
|
||||
},
|
||||
"scale": {
|
||||
"x": 1.693008699814737,
|
||||
"y": 0.7746587857577377,
|
||||
"z": 1.9156025512243486
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"obj_id": "1001",
|
||||
"obj_type": "Truck",
|
||||
"psr": {
|
||||
"position": {
|
||||
"x": -21.140372247155955,
|
||||
"y": -12.74937781725756,
|
||||
"z": 0.172017060029561
|
||||
},
|
||||
"rotation": {
|
||||
"x": -0.06061705351581413,
|
||||
"y": 0.0005575736396516535,
|
||||
"z": 3.099867333931262
|
||||
},
|
||||
"scale": {
|
||||
"x": 4.773545657333631,
|
||||
"y": 1.7025087091290587,
|
||||
"z": 2.2705067053039354
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
@ -0,0 +1,506 @@
|
||||
[
|
||||
{
|
||||
"obj_id": "1",
|
||||
"obj_type": "Van",
|
||||
"psr": {
|
||||
"position": {
|
||||
"x": 4.850941318672994,
|
||||
"y": -10.956022473988245,
|
||||
"z": -0.48761864042484254
|
||||
},
|
||||
"rotation": {
|
||||
"x": -0.002674811961455094,
|
||||
"y": 0.10965160628151722,
|
||||
"z": -1.544461511948178
|
||||
},
|
||||
"scale": {
|
||||
"x": 4.13408170964613,
|
||||
"y": 1.8086255198874306,
|
||||
"z": 1.8003957009824072
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"obj_id": "2",
|
||||
"obj_type": "Car",
|
||||
"psr": {
|
||||
"position": {
|
||||
"x": 3.88139926311851,
|
||||
"y": -0.39950599842594453,
|
||||
"z": -1.1686621480000001
|
||||
},
|
||||
"rotation": {
|
||||
"x": -0.06819227924229494,
|
||||
"y": 0.002044793837571052,
|
||||
"z": 4.725015963715173
|
||||
},
|
||||
"scale": {
|
||||
"x": 4.23920355864393,
|
||||
"y": 1.7529416688834956,
|
||||
"z": 1.5
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"obj_id": "3",
|
||||
"obj_type": "Bus",
|
||||
"psr": {
|
||||
"position": {
|
||||
"x": 11.301814142992953,
|
||||
"y": -20.922855153597094,
|
||||
"z": 0.546278617
|
||||
},
|
||||
"rotation": {
|
||||
"x": 0,
|
||||
"y": 0.040543441913022456,
|
||||
"z": 1.5018046754088288
|
||||
},
|
||||
"scale": {
|
||||
"x": 10.4060401,
|
||||
"y": 2.6116105531799785,
|
||||
"z": 3.2164060563210306
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"obj_id": "4",
|
||||
"obj_type": "Car",
|
||||
"psr": {
|
||||
"position": {
|
||||
"x": 6.557943947489548,
|
||||
"y": -40.68523378018685,
|
||||
"z": 1.0285126999999994
|
||||
},
|
||||
"rotation": {
|
||||
"x": -0.053810528807219656,
|
||||
"y": 0.0053141924483858785,
|
||||
"z": 1.441521147905804
|
||||
},
|
||||
"scale": {
|
||||
"x": 4.500000000000001,
|
||||
"y": 1.7126382376921478,
|
||||
"z": 1.7071399206499345
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"obj_id": "5",
|
||||
"obj_type": "Rider",
|
||||
"psr": {
|
||||
"position": {
|
||||
"x": 3.3830302707647206,
|
||||
"y": -30.362142126316222,
|
||||
"z": 0.5857520000000003
|
||||
},
|
||||
"rotation": {
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 3.681492040356453
|
||||
},
|
||||
"scale": {
|
||||
"x": 1.6596497400399342,
|
||||
"y": 0.6739244576664531,
|
||||
"z": 1.7
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"obj_id": "6",
|
||||
"obj_type": "Rider",
|
||||
"psr": {
|
||||
"position": {
|
||||
"x": -9.976679027386126,
|
||||
"y": -8.148731228418796,
|
||||
"z": -0.5460304529047654
|
||||
},
|
||||
"rotation": {
|
||||
"x": -0.06317162162260596,
|
||||
"y": 0.015318565742633352,
|
||||
"z": 4.474803464032996
|
||||
},
|
||||
"scale": {
|
||||
"x": 1.5452174321894951,
|
||||
"y": 0.5578088167506243,
|
||||
"z": 1.5933563922247365
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"obj_id": "8",
|
||||
"obj_type": "Car",
|
||||
"psr": {
|
||||
"position": {
|
||||
"x": 7.373873177974019,
|
||||
"y": -29.272960420773632,
|
||||
"z": 0.432106
|
||||
},
|
||||
"rotation": {
|
||||
"x": -0.05381384131006369,
|
||||
"y": 0.0026916304823240986,
|
||||
"z": 1.5055063419654435
|
||||
},
|
||||
"scale": {
|
||||
"x": 4.5,
|
||||
"y": 1.6788924984728437,
|
||||
"z": 1.656933188116807
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"obj_id": "11",
|
||||
"obj_type": "Rider",
|
||||
"psr": {
|
||||
"position": {
|
||||
"x": 11.466985368202586,
|
||||
"y": -33.377379928349065,
|
||||
"z": 0.4561529999999994
|
||||
},
|
||||
"rotation": {
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 1.357548794704233
|
||||
},
|
||||
"scale": {
|
||||
"x": 2.02508808259896,
|
||||
"y": 0.6606454834491257,
|
||||
"z": 1.7
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"obj_id": "12",
|
||||
"obj_type": "ScooterRider",
|
||||
"psr": {
|
||||
"position": {
|
||||
"x": 15.002234320061689,
|
||||
"y": 9.128632504918388,
|
||||
"z": -2.0087403000000004
|
||||
},
|
||||
"rotation": {
|
||||
"x": -0.05336847556558379,
|
||||
"y": 0.0310775824138393,
|
||||
"z": 1.5905931753624516
|
||||
},
|
||||
"scale": {
|
||||
"x": 4.3676556656744,
|
||||
"y": 1.6295165184473699,
|
||||
"z": 1.7942212135299977
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"obj_id": "13",
|
||||
"obj_type": "Car",
|
||||
"psr": {
|
||||
"position": {
|
||||
"x": 7.788851466328197,
|
||||
"y": -10.98265509509204,
|
||||
"z": -0.7437820000000004
|
||||
},
|
||||
"rotation": {
|
||||
"x": -0.053129458150669544,
|
||||
"y": 0,
|
||||
"z": 1.56051056076012
|
||||
},
|
||||
"scale": {
|
||||
"x": 4.590450000000001,
|
||||
"y": 1.8,
|
||||
"z": 1.4558852218914666
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"obj_id": "15",
|
||||
"obj_type": "Car",
|
||||
"psr": {
|
||||
"position": {
|
||||
"x": 26.57291603721751,
|
||||
"y": -17.15000239835484,
|
||||
"z": -0.6
|
||||
},
|
||||
"rotation": {
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": -0.22920367320510482
|
||||
},
|
||||
"scale": {
|
||||
"x": 4.5,
|
||||
"y": 1.6458116836318435,
|
||||
"z": 1.5
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"obj_id": "20",
|
||||
"obj_type": "Car",
|
||||
"psr": {
|
||||
"position": {
|
||||
"x": -0.4326601345492236,
|
||||
"y": -32.81936725268655,
|
||||
"z": 0.9197633000000003
|
||||
},
|
||||
"rotation": {
|
||||
"x": -0.06517306244786299,
|
||||
"y": 0.00010959092045555565,
|
||||
"z": 4.668461499912884
|
||||
},
|
||||
"scale": {
|
||||
"x": 4.921583727079626,
|
||||
"y": 1.6458116836318435,
|
||||
"z": 2.0017558148508505
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"obj_id": "23",
|
||||
"obj_type": "Car",
|
||||
"psr": {
|
||||
"position": {
|
||||
"x": 14.854084900533053,
|
||||
"y": 36.31688425244575,
|
||||
"z": -3.494144999999998
|
||||
},
|
||||
"rotation": {
|
||||
"x": -0.06287060419300494,
|
||||
"y": 0.044058144173183246,
|
||||
"z": 1.6017988530736593
|
||||
},
|
||||
"scale": {
|
||||
"x": 4.281595594230369,
|
||||
"y": 1.6295165184473699,
|
||||
"z": 1.7242113198564337
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"obj_id": "27",
|
||||
"obj_type": "Car",
|
||||
"psr": {
|
||||
"position": {
|
||||
"x": 36.95999624850447,
|
||||
"y": -19.576731641457386,
|
||||
"z": -0.39999999999999997
|
||||
},
|
||||
"rotation": {
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 6.052388980384655
|
||||
},
|
||||
"scale": {
|
||||
"x": 4.5,
|
||||
"y": 1.8,
|
||||
"z": 1.5
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"obj_id": "31",
|
||||
"obj_type": "Pedestrian",
|
||||
"psr": {
|
||||
"position": {
|
||||
"x": -18.866816697627655,
|
||||
"y": -22.86282125027274,
|
||||
"z": 0.8500000000000002
|
||||
},
|
||||
"rotation": {
|
||||
"x": -0.005200816595089385,
|
||||
"y": 0,
|
||||
"z": 1.5907963267948966
|
||||
},
|
||||
"scale": {
|
||||
"x": 0.5129727980068935,
|
||||
"y": 0.5634125150659849,
|
||||
"z": 1.7
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"obj_id": "50",
|
||||
"obj_type": "Rider",
|
||||
"psr": {
|
||||
"position": {
|
||||
"x": 19.040406728319795,
|
||||
"y": -21.31166831033424,
|
||||
"z": -0.1791146
|
||||
},
|
||||
"rotation": {
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 1.6039243132190473
|
||||
},
|
||||
"scale": {
|
||||
"x": 1.797162849996143,
|
||||
"y": 1.3257591556815653,
|
||||
"z": 1.8592649635634135
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"obj_id": "51",
|
||||
"obj_type": "Pedestrian",
|
||||
"psr": {
|
||||
"position": {
|
||||
"x": 23.278827197860664,
|
||||
"y": 16.02511764426481,
|
||||
"z": -2.1734700000000005
|
||||
},
|
||||
"rotation": {
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 4.882149425192646
|
||||
},
|
||||
"scale": {
|
||||
"x": 0.4,
|
||||
"y": 0.5,
|
||||
"z": 1.7
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"obj_id": "53",
|
||||
"obj_type": "Pedestrian",
|
||||
"psr": {
|
||||
"position": {
|
||||
"x": 19.721963692594727,
|
||||
"y": 12.073706740754263,
|
||||
"z": -1.957951600000001
|
||||
},
|
||||
"rotation": {
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 4.550175243538672
|
||||
},
|
||||
"scale": {
|
||||
"x": 0.7412849208820917,
|
||||
"y": 0.6806637022431177,
|
||||
"z": 1.7
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"obj_id": "54",
|
||||
"obj_type": "Motor",
|
||||
"psr": {
|
||||
"position": {
|
||||
"x": 23.91011734575295,
|
||||
"y": 29.285895469113342,
|
||||
"z": -3.1570029999999982
|
||||
},
|
||||
"rotation": {
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 0.11633170712167873
|
||||
},
|
||||
"scale": {
|
||||
"x": 1.7485658990665154,
|
||||
"y": 1.0208318215505217,
|
||||
"z": 1.5
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"obj_id": "55",
|
||||
"obj_type": "Pedestrian",
|
||||
"psr": {
|
||||
"position": {
|
||||
"x": 32.297311349146185,
|
||||
"y": 0.47968242174995096,
|
||||
"z": -0.9565367999999999
|
||||
},
|
||||
"rotation": {
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 4.37493354637721
|
||||
},
|
||||
"scale": {
|
||||
"x": 0.5285163867593005,
|
||||
"y": 0.4571699121199565,
|
||||
"z": 1.7515116999999998
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"obj_id": "56",
|
||||
"obj_type": "Pedestrian",
|
||||
"psr": {
|
||||
"position": {
|
||||
"x": 31.34751781797604,
|
||||
"y": -2.787654273957376,
|
||||
"z": -0.9473519999999997
|
||||
},
|
||||
"rotation": {
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 1.2405159345228731
|
||||
},
|
||||
"scale": {
|
||||
"x": 0.4,
|
||||
"y": 0.5,
|
||||
"z": 1.7
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"obj_id": "81",
|
||||
"obj_type": "Pedestrian",
|
||||
"psr": {
|
||||
"position": {
|
||||
"x": -8.663487089328555,
|
||||
"y": 2.770711530826073,
|
||||
"z": -0.7839459000000002
|
||||
},
|
||||
"rotation": {
|
||||
"x": -0.005200816595089385,
|
||||
"y": 0,
|
||||
"z": 4.300758489293951
|
||||
},
|
||||
"scale": {
|
||||
"x": 0.76374659526974,
|
||||
"y": 0.7083013780156343,
|
||||
"z": 1.7341699999999998
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"obj_id": "82",
|
||||
"obj_type": "Pedestrian",
|
||||
"psr": {
|
||||
"position": {
|
||||
"x": -9.424296512588144,
|
||||
"y": 2.881378801540134,
|
||||
"z": -0.6853220949094945
|
||||
},
|
||||
"rotation": {
|
||||
"x": -0.005200816595089385,
|
||||
"y": 0,
|
||||
"z": 4.370040436014779
|
||||
},
|
||||
"scale": {
|
||||
"x": 2.377152468109147,
|
||||
"y": 0.7746587857577377,
|
||||
"z": 1.9156025512243486
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"obj_id": "1001",
|
||||
"obj_type": "Truck",
|
||||
"psr": {
|
||||
"position": {
|
||||
"x": -21.12969353464381,
|
||||
"y": -9.232904261081396,
|
||||
"z": -0.37339159297459545
|
||||
},
|
||||
"rotation": {
|
||||
"x": 0.025047730911594995,
|
||||
"y": -0.0015804909276805725,
|
||||
"z": 3.1166765109083716
|
||||
},
|
||||
"scale": {
|
||||
"x": 5.083309851403533,
|
||||
"y": 1.7025087091290587,
|
||||
"z": 2.2705067053039354
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
|
After Width: | Height: | Size: 2.1 MiB |
|
After Width: | Height: | Size: 2.0 MiB |
|
After Width: | Height: | Size: 2.7 MiB |
|
After Width: | Height: | Size: 721 KiB |
|
After Width: | Height: | Size: 543 KiB |
|
After Width: | Height: | Size: 1.1 MiB |
|
After Width: | Height: | Size: 19 KiB |
|
After Width: | Height: | Size: 1017 B |
|
After Width: | Height: | Size: 6.4 KiB |
|
After Width: | Height: | Size: 53 KiB |
|
After Width: | Height: | Size: 14 KiB |
@ -0,0 +1,36 @@
|
||||
# Introduction
|
||||
|
||||
[uWSGI](https://uwsgi-docs.readthedocs.io/)
|
||||
|
||||
You can run it with `python ./main.py` or `uwsgi --ini uwsgi.ini`
|
||||
|
||||
|
||||
# Requirements
|
||||
|
||||
```
|
||||
pip install uwsgi
|
||||
```
|
||||
|
||||
# Config
|
||||
```
|
||||
--- file: uwsgi.ini ---
|
||||
|
||||
[uwsgi]
|
||||
# Set the IP and Port.
|
||||
http = 0.0.0.0:8092
|
||||
|
||||
# **Importance**: Need rewrite the value of chdir key
|
||||
chdir = /root/SUSTechPOINTS
|
||||
|
||||
module = main:application
|
||||
master = true
|
||||
buffer-size = 65536
|
||||
processes = 4
|
||||
threads = 2
|
||||
```
|
||||
|
||||
# Run
|
||||
|
||||
```
|
||||
uwsgi --ini uwsgi.ini
|
||||
```
|
||||
@ -0,0 +1,30 @@
|
||||
### Docker
|
||||
|
||||
#### Install Docker(安装Docker)
|
||||
|
||||
```
|
||||
sudo apt install -y docker docker.io docker-registry
|
||||
```
|
||||
|
||||
#### Build Image yourself(自行创建镜像, 较为繁琐)
|
||||
```
|
||||
cd Docker
|
||||
|
||||
# Build docker image (构建镜像)
|
||||
|
||||
sudo docker build -t sustechpoints:v1.0.0 .
|
||||
|
||||
# Create container of server ,Please replace ${YourDataPath} with the path where you put data on (创建容器, 请将用你的数据存储路径将变量${YourDataPath}替换, 注意数据要符合data/example中的组织方式)
|
||||
|
||||
sudo docker run -it -d --restart=always --name STPointsSServer -p 8081:8081 -v ${YourDataPath}:/root/SUSTechPOINTS/data sustechpoints:v1.0.0 bash
|
||||
|
||||
```
|
||||
|
||||
#### Use docker image of dockerhub(使用现有镜像, 不保证代码为最新)
|
||||
|
||||
```
|
||||
sudo docker run -it -d --restart=always -p 8081:8081 juhaoming/sustechpoints:v1.0.0 bash
|
||||
|
||||
sudo docker run -it -d --restart=always -p 8081:8081 -v ${YourDataPath}:/root/SUSTechPOINTS/data juhaoming/sustechpoints:v1.0.0 bash
|
||||
|
||||
```
|
||||
|
After Width: | Height: | Size: 6.7 KiB |
|
After Width: | Height: | Size: 8.7 KiB |
@ -0,0 +1,73 @@
|
||||
|
||||
### Install
|
||||
|
||||
0. clone the project
|
||||
```
|
||||
git clone https://github.com/naurril/SUSTechPOINTS
|
||||
```
|
||||
1. Install packages
|
||||
```
|
||||
pip install -r requirement.txt
|
||||
```
|
||||
2. Download model
|
||||
|
||||
download pretrained model file [deep_annotation_inference.h5](https://github.com/naurril/SUSTechPOINTS/releases/download/0.1/deep_annotation_inference.h5), put it into `./algos/models`
|
||||
```
|
||||
wget https://github.com/naurril/SUSTechPOINTS/releases/download/0.1/deep_annotation_inference.h5 -P algos/models
|
||||
```
|
||||
|
||||
### Start
|
||||
Run the following command in shell, then go to http://127.0.0.1:8081
|
||||
```
|
||||
python main.py
|
||||
```
|
||||
|
||||
## Object type configuration
|
||||
|
||||
Default object configuration is in [obj_cfg.js](src/public/js/../../../public/js/obj_cfg.js)
|
||||
|
||||
Adjust the contents to customize.
|
||||
|
||||
## Data preparation
|
||||
|
||||
````
|
||||
+- data
|
||||
+- scene1
|
||||
+- lidar
|
||||
+- 0000.pcd
|
||||
+- 0001.pcd
|
||||
+- camera
|
||||
+- front
|
||||
+- 0000.jpg
|
||||
+- 0001.jpg
|
||||
+- left
|
||||
+- ...
|
||||
+- aux_lidar
|
||||
+- front
|
||||
+- 0000.pcd
|
||||
+- 0001.pcd
|
||||
+- radar
|
||||
+- front_points
|
||||
+- 0000.pcd
|
||||
+- 0001.pcd
|
||||
+- front_tracks
|
||||
+- ...
|
||||
+- calib
|
||||
+- camera
|
||||
+- front.json
|
||||
+- left.json
|
||||
+- radar
|
||||
+- front_points.json
|
||||
+- front_tracks.json
|
||||
+- label
|
||||
+- 0000.json
|
||||
+- 0001.json
|
||||
+- scene2
|
||||
|
||||
````
|
||||
|
||||
label is the directory to save the annotation result.
|
||||
|
||||
calib is the calibration matrix from point cloud to image. it's optional, but if provided, the box is projected on the image so as to assist the annotation.
|
||||
|
||||
check examples in `./data/example`
|
||||
|
After Width: | Height: | Size: 994 KiB |
|
After Width: | Height: | Size: 86 KiB |
|
After Width: | Height: | Size: 26 KiB |
|
After Width: | Height: | Size: 24 KiB |
|
After Width: | Height: | Size: 60 KiB |
|
After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 47 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 57 KiB |
|
After Width: | Height: | Size: 21 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 51 KiB |
|
After Width: | Height: | Size: 19 KiB |
|
After Width: | Height: | Size: 29 KiB |
|
After Width: | Height: | Size: 13 KiB |
|
After Width: | Height: | Size: 21 KiB |
|
After Width: | Height: | Size: 22 KiB |
|
After Width: | Height: | Size: 24 KiB |
@ -0,0 +1,93 @@
|
||||
|
||||
### Add a new box
|
||||
|
||||
You have 2 ways to add a new box:
|
||||
1. Right click on an object, choose object type in popup context menu
|
||||
1. Holding Ctrl, draw a rectangle enclosing the object.
|
||||
|
||||
Hint:
|
||||
1. Adjust the main view so that the objects (e.g. cars) are heading upward or downward along the screen, use 'g' if the direction need to be reversed, use 'r' or 'f' to adjust the yaw angle (z-axis rotation)
|
||||
1. Adjust the main view so it's almost in bird's eye view. (direct bird's eye view support is not complete yet)
|
||||
|
||||
|
||||
|
||||
### Main View
|
||||
```
|
||||
mouse scroll up/down: zoom in/out
|
||||
mouse left key hold/move: rotate (change main view)
|
||||
mouse right key hold/move: pan
|
||||
|
||||
left click on a box: select
|
||||
left click on a selected box: show transform control
|
||||
left click on non-box area: hide transform control if present, or unselect box
|
||||
|
||||
Ctrl+mouse drag: add a new box
|
||||
Shift+mouse drag: add a new box, w/o automatic box fitting
|
||||
|
||||
Right click to show popup menu.
|
||||
|
||||
-/=: adjust point size
|
||||
|
||||
When transform control is enabled:
|
||||
v: switch transform modes among resize/translate/rotate
|
||||
z/x/c: turan on/off x/y/z axis
|
||||
use mouse to adjust the box.
|
||||
|
||||
del/ctrl+d remove selected box
|
||||
|
||||
1,2 select previous/next box
|
||||
3,4, or pageup/pagedown show previous/next frame in current scene
|
||||
5,6,7 show camera helper box of sideviews.
|
||||
|
||||
space: pause/continue stream play
|
||||
|
||||
when a box is selected:
|
||||
t: show object trajectory
|
||||
del: delete the box
|
||||
ctrl+d: delete the box
|
||||
a,s,d,w,r,f,g: save as operations in top-view.
|
||||
v: enter batch-edit mode
|
||||
|
||||
when transform control in perspective view is active:
|
||||
z/x/c: toggle x/y/z asix handle
|
||||
v: switch among dimension/rotation/position
|
||||
```
|
||||
|
||||
### sub-view (projective view)
|
||||
```
|
||||
note:
|
||||
- in perspective view, all keyboard operations are same as operating in top-view
|
||||
- these shortcuts are applicable when a subview is activated by placing the mouse over it.
|
||||
|
||||
a: move box left
|
||||
s: move box down
|
||||
d: move box right
|
||||
w: move box up
|
||||
q: rotate box counterclockwise
|
||||
e: rotate box clockwise
|
||||
r: rotate box counterclockwise, with box auto-fitting
|
||||
f: rotate box clockwise, with box auto-fitting
|
||||
g: reverse heading direction (rotate by PI)
|
||||
|
||||
double click on center: auto-shrink box by adjusting all borders to nearest innner point.
|
||||
double click on border: auto-shrink box by adjusting the border to nearest innner point.
|
||||
double click on corner: auto-shrink box by adjusting the corresponding borders to nearest innner point.
|
||||
|
||||
drag border/corner/center: move border/corner/box.
|
||||
ctrl + drag border/corner: move border/corner/box with box auto-fitting
|
||||
Shft + drag border/corner: move border/corner/box with box auto-fitting while keeping the box size
|
||||
|
||||
mouse scroll up/down: zoom in/out the view
|
||||
```
|
||||
|
||||
|
||||
### batch-editing mode
|
||||
```
|
||||
t: show object trajectory
|
||||
3/pageup: prev batch, or prev object (if one batch shows the whole scene)
|
||||
4/pagedown: nex batch, or next object (if one batch shows the whole scene)
|
||||
v/Escape: exit batch mode
|
||||
+/=/-: increase/decrease point size
|
||||
|
||||
when context menu shown, the underscored char is the corresponding key shortcut.
|
||||
```
|
||||
|
After Width: | Height: | Size: 39 KiB |
|
After Width: | Height: | Size: 834 KiB |
|
After Width: | Height: | Size: 761 KiB |
|
After Width: | Height: | Size: 15 KiB |
@ -0,0 +1,16 @@
|
||||
|
||||
```
|
||||
globle_scene
|
||||
cameraHelper
|
||||
world: webgl-group
|
||||
+ lidar
|
||||
+ annotations: group
|
||||
+ box
|
||||
+ box
|
||||
+ boxeditor.boxView.view: cameraContainer
|
||||
+ camera
|
||||
+ auxlidar
|
||||
+ radar
|
||||
world
|
||||
world
|
||||
```
|
||||
@ -0,0 +1,35 @@
|
||||
# Config file for GO-ICP
|
||||
|
||||
# Mean Squared Error (MSE) convergence threshold
|
||||
mse_thresh: 0.001
|
||||
|
||||
# Smallest rotation value along dimension X/Y/Z of rotation cube (radians)
|
||||
rot_min_x: 3.1416
|
||||
rot_min_y: 3.1416
|
||||
rot_min_z: 3.1416
|
||||
|
||||
# Side length of each dimension of rotation cube (radians)
|
||||
rot_width: 6.2832
|
||||
|
||||
# Smallest translation value along dimension X/Y/Z of translation cube
|
||||
trans_min_x: -0.5
|
||||
trans_min_y: -0.5
|
||||
trans_min_z: -0.5
|
||||
|
||||
# Side length of each dimension of translation cube
|
||||
trnas_min_width: 1.0
|
||||
|
||||
# Set to 0.0 for no trimming
|
||||
trim_fraction: 0.0
|
||||
|
||||
# Nodes per dimension of distance transform
|
||||
dist_trans_size: 100
|
||||
|
||||
# DistanceTransformWidth = ExpandFactor x WidthLargestDimension
|
||||
dist_trans_expand_factor: 2.0
|
||||
|
||||
#target_pcd_filename: "1563421456.330479000.pcd"
|
||||
#source_pcd_filename: "1563421457.741678000.pcd"
|
||||
|
||||
target_pcd_filename: "out551.pcd"
|
||||
source_pcd_filename: "out557.pcd"
|
||||
@ -0,0 +1,238 @@
|
||||
import random
|
||||
import string
|
||||
|
||||
import cherrypy
|
||||
import os
|
||||
import json
|
||||
from jinja2 import Environment, FileSystemLoader
|
||||
env = Environment(loader=FileSystemLoader('./'))
|
||||
|
||||
import os
|
||||
import sys
|
||||
import scene_reader
|
||||
from tools import check_labels as check
|
||||
|
||||
|
||||
# BASE_DIR = os.path.dirname(os.path.abspath(__file__))
|
||||
# sys.path.append(BASE_DIR)
|
||||
|
||||
#sys.path.append(os.path.join(BASE_DIR, './algos'))
|
||||
#import algos.rotation as rotation
|
||||
from algos import pre_annotate
|
||||
|
||||
|
||||
#sys.path.append(os.path.join(BASE_DIR, '../tracking'))
|
||||
#import algos.trajectory as trajectory
|
||||
|
||||
# extract_object_exe = "~/code/pcltest/build/extract_object"
|
||||
# registration_exe = "~/code/go_icp_pcl/build/test_go_icp"
|
||||
|
||||
# sys.path.append(os.path.join(BASE_DIR, './tools'))
|
||||
# import tools.dataset_preprocess.crop_scene as crop_scene
|
||||
|
||||
class Root(object):
|
||||
@cherrypy.expose
|
||||
def index(self, scene="", frame=""):
|
||||
tmpl = env.get_template('index.html')
|
||||
return tmpl.render()
|
||||
|
||||
@cherrypy.expose
|
||||
def icon(self):
|
||||
tmpl = env.get_template('test_icon.html')
|
||||
return tmpl.render()
|
||||
|
||||
@cherrypy.expose
|
||||
def ml(self):
|
||||
tmpl = env.get_template('test_ml.html')
|
||||
return tmpl.render()
|
||||
|
||||
@cherrypy.expose
|
||||
def reg(self):
|
||||
tmpl = env.get_template('registration_demo.html')
|
||||
return tmpl.render()
|
||||
|
||||
@cherrypy.expose
|
||||
def view(self, file):
|
||||
tmpl = env.get_template('view.html')
|
||||
return tmpl.render()
|
||||
|
||||
# @cherrypy.expose
|
||||
# def saveworld(self, scene, frame):
|
||||
|
||||
# # cl = cherrypy.request.headers['Content-Length']
|
||||
# rawbody = cherrypy.request.body.readline().decode('UTF-8')
|
||||
|
||||
# with open("./data/"+scene +"/label/"+frame+".json",'w') as f:
|
||||
# f.write(rawbody)
|
||||
|
||||
# return "ok"
|
||||
|
||||
@cherrypy.expose
|
||||
def saveworldlist(self):
|
||||
|
||||
# cl = cherrypy.request.headers['Content-Length']
|
||||
rawbody = cherrypy.request.body.readline().decode('UTF-8')
|
||||
data = json.loads(rawbody)
|
||||
|
||||
for d in data:
|
||||
scene = d["scene"]
|
||||
frame = d["frame"]
|
||||
ann = d["annotation"]
|
||||
with open("./data/"+scene +"/label/"+frame+".json",'w') as f:
|
||||
json.dump(ann, f, indent=2, sort_keys=True)
|
||||
|
||||
return "ok"
|
||||
|
||||
|
||||
@cherrypy.expose
|
||||
@cherrypy.tools.json_out()
|
||||
def cropscene(self):
|
||||
rawbody = cherrypy.request.body.readline().decode('UTF-8')
|
||||
data = json.loads(rawbody)
|
||||
|
||||
rawdata = data["rawSceneId"]
|
||||
|
||||
timestamp = rawdata.split("_")[0]
|
||||
|
||||
print("generate scene")
|
||||
log_file = "temp/crop-scene-"+timestamp+".log"
|
||||
|
||||
cmd = "python ./tools/dataset_preprocess/crop_scene.py generate "+ \
|
||||
rawdata[0:10]+"/"+timestamp + "_preprocessed/dataset_2hz " + \
|
||||
"- " +\
|
||||
data["startTime"] + " " +\
|
||||
data["seconds"] + " " +\
|
||||
"\""+ data["desc"] + "\"" +\
|
||||
"> " + log_file + " 2>&1"
|
||||
print(cmd)
|
||||
|
||||
code = os.system(cmd)
|
||||
|
||||
with open(log_file) as f:
|
||||
log = list(map(lambda s: s.strip(), f.readlines()))
|
||||
|
||||
os.system("rm "+log_file)
|
||||
|
||||
return {"code": code,
|
||||
"log": log
|
||||
}
|
||||
|
||||
|
||||
@cherrypy.expose
|
||||
@cherrypy.tools.json_out()
|
||||
def checkscene(self, scene):
|
||||
ck = check.LabelChecker(os.path.join("./data", scene))
|
||||
ck.check()
|
||||
print(ck.messages)
|
||||
return ck.messages
|
||||
|
||||
|
||||
# data N*3 numpy array
|
||||
@cherrypy.expose
|
||||
@cherrypy.tools.json_out()
|
||||
def predict_rotation(self):
|
||||
cl = cherrypy.request.headers['Content-Length']
|
||||
rawbody = cherrypy.request.body.readline().decode('UTF-8')
|
||||
|
||||
data = json.loads(rawbody)
|
||||
|
||||
return {"angle": pre_annotate.predict_yaw(data["points"])}
|
||||
#return {}
|
||||
|
||||
|
||||
@cherrypy.expose
|
||||
@cherrypy.tools.json_out()
|
||||
def auto_annotate(self, scene, frame):
|
||||
print("auto annotate ", scene, frame)
|
||||
return pre_annotate.annotate_file('./data/{}/lidar/{}.pcd'.format(scene,frame))
|
||||
|
||||
|
||||
|
||||
@cherrypy.expose
|
||||
@cherrypy.tools.json_out()
|
||||
def load_annotation(self, scene, frame):
|
||||
return scene_reader.read_annotations(scene, frame)
|
||||
|
||||
|
||||
@cherrypy.expose
|
||||
@cherrypy.tools.json_out()
|
||||
def load_ego_pose(self, scene, frame):
|
||||
return scene_reader.read_ego_pose(scene, frame)
|
||||
|
||||
|
||||
@cherrypy.expose
|
||||
@cherrypy.tools.json_out()
|
||||
def loadworldlist(self):
|
||||
rawbody = cherrypy.request.body.readline().decode('UTF-8')
|
||||
worldlist = json.loads(rawbody)
|
||||
|
||||
anns = list(map(lambda w:{
|
||||
"scene": w["scene"],
|
||||
"frame": w["frame"],
|
||||
"annotation":scene_reader.read_annotations(w["scene"], w["frame"])},
|
||||
worldlist))
|
||||
|
||||
return anns
|
||||
|
||||
|
||||
@cherrypy.expose
|
||||
@cherrypy.tools.json_out()
|
||||
def datameta(self):
|
||||
return scene_reader.get_all_scenes()
|
||||
|
||||
|
||||
@cherrypy.expose
|
||||
@cherrypy.tools.json_out()
|
||||
def scenemeta(self, scene):
|
||||
return scene_reader.get_one_scene(scene)
|
||||
|
||||
@cherrypy.expose
|
||||
@cherrypy.tools.json_out()
|
||||
def get_all_scene_desc(self):
|
||||
return scene_reader.get_all_scene_desc()
|
||||
|
||||
@cherrypy.expose
|
||||
@cherrypy.tools.json_out()
|
||||
def objs_of_scene(self, scene):
|
||||
return self.get_all_objs(os.path.join("./data",scene))
|
||||
|
||||
def get_all_objs(self, path):
|
||||
label_folder = os.path.join(path, "label")
|
||||
if not os.path.isdir(label_folder):
|
||||
return []
|
||||
|
||||
files = os.listdir(label_folder)
|
||||
|
||||
files = filter(lambda x: x.split(".")[-1]=="json", files)
|
||||
|
||||
|
||||
def file_2_objs(f):
|
||||
with open(f) as fd:
|
||||
boxes = json.load(fd)
|
||||
objs = [x for x in map(lambda b: {"category":b["obj_type"], "id": b["obj_id"]}, boxes)]
|
||||
return objs
|
||||
|
||||
boxes = map(lambda f: file_2_objs(os.path.join(path, "label", f)), files)
|
||||
|
||||
# the following map makes the category-id pairs unique in scene
|
||||
all_objs={}
|
||||
for x in boxes:
|
||||
for o in x:
|
||||
|
||||
k = str(o["category"])+"-"+str(o["id"])
|
||||
|
||||
if all_objs.get(k):
|
||||
all_objs[k]['count']= all_objs[k]['count']+1
|
||||
else:
|
||||
all_objs[k]= {
|
||||
"category": o["category"],
|
||||
"id": o["id"],
|
||||
"count": 1
|
||||
}
|
||||
|
||||
return [x for x in all_objs.values()]
|
||||
|
||||
if __name__ == '__main__':
|
||||
cherrypy.quickstart(Root(), '/', config="server.conf")
|
||||
else:
|
||||
application = cherrypy.Application(Root(), '/', config="server.conf")
|
||||
@ -0,0 +1,79 @@
|
||||
from fastapi import FastAPI, Request
|
||||
from fastapi.staticfiles import StaticFiles
|
||||
from fastapi.templating import Jinja2Templates
|
||||
|
||||
from router import router
|
||||
|
||||
# 1. 创建 FastAPI 应用实例
|
||||
app = FastAPI(
|
||||
title="Annotation Tool API",
|
||||
description="从 CherryPy 转换而来的标注工具 API",
|
||||
version="2.0.0"
|
||||
)
|
||||
|
||||
# 2. 设置 Jinja2 模板
|
||||
# CherryPy 的 FileSystemLoader('./') 对应 FastAPI 的 directory="."
|
||||
templates = Jinja2Templates(directory=".")
|
||||
|
||||
# 3. 挂载静态文件 (对应 server.conf)
|
||||
# app.mount("路径", StaticFiles(directory="本地目录"), name="唯一名称")
|
||||
app.mount("/static", StaticFiles(directory="public"), name="public")
|
||||
app.mount("/data", StaticFiles(directory="data"), name="data")
|
||||
app.mount("/temp", StaticFiles(directory="temp"), name="temp")
|
||||
app.mount("/views", StaticFiles(directory="views"), name="views")
|
||||
app.mount("/assets", StaticFiles(directory="assets"), name="assets")
|
||||
|
||||
|
||||
# 4. 定义 Pydantic 模型用于请求体验证
|
||||
# 这比直接解析 JSON 更安全、更清晰
|
||||
|
||||
# 5. 将 CherryPy 的类方法转换为 FastAPI 路由函数
|
||||
|
||||
# --- HTML 页面路由 ---
|
||||
|
||||
@app.get("/icon")
|
||||
def icon(request: Request):
|
||||
"""渲染测试图标页"""
|
||||
return templates.TemplateResponse("test_icon.html", {"request": request})
|
||||
|
||||
|
||||
@app.get("/ml")
|
||||
def ml(request: Request):
|
||||
"""渲染测试 ML 页"""
|
||||
return templates.TemplateResponse("test_ml.html", {"request": request})
|
||||
|
||||
|
||||
@app.get("/reg")
|
||||
def reg(request: Request):
|
||||
"""渲染注册演示页"""
|
||||
return templates.TemplateResponse("registration_demo.html", {"request": request})
|
||||
|
||||
|
||||
@app.get("/view/{file_path:path}")
|
||||
def view(request: Request, file_path: str):
|
||||
"""渲染查看页,:path 允许路径中包含斜杠"""
|
||||
# 原始代码没有使用 file 参数,这里保持一致
|
||||
return templates.TemplateResponse("view.html", {"request": request})
|
||||
|
||||
|
||||
# --- API 接口路由 ---
|
||||
|
||||
@app.get("/")
|
||||
def index(request: Request, scene: str = "", frame: str = ""):
|
||||
"""渲染主页"""
|
||||
return templates.TemplateResponse("index.html", {"request": request})
|
||||
|
||||
|
||||
app.include_router(router)
|
||||
# 6. 启动服务器 (对应 if __name__ == '__main__')
|
||||
# 在命令行运行: uvicorn main:app --host 0.0.0.0 --port 8081 --reload
|
||||
if __name__ == "__main__":
|
||||
import uvicorn
|
||||
|
||||
print("Starting FastAPI server...")
|
||||
# server.conf 中的 host 和 port 在这里配置
|
||||
uvicorn.run(
|
||||
app,
|
||||
host="0.0.0.0",
|
||||
port=8081
|
||||
)
|
||||
@ -0,0 +1,9 @@
|
||||
1. the views on the left are 3 orthographical cameras installed in the scene according to the selected box. keys 5/6/7 to show/hide the installed camera frames.
|
||||
|
||||
2. we use rear-view, other than front-view, so that when we adjust the position of box, this view moves
|
||||
in the same direction as the top-down view, otherwise it would be very confusing (imagine the box in the
|
||||
first view moves right but in the second view moves left.)
|
||||
|
||||
2. the main view is a perspective camera by default.
|
||||
|
||||
|
||||
@ -0,0 +1,61 @@
|
||||
.docIcon
|
||||
{
|
||||
background:#eee;
|
||||
background: linear-gradient(top, #ddd 0, #eee 15%, #fff 40%, #fff 70%, #eee 100%);
|
||||
border:1px solid #ccc;
|
||||
display:block;
|
||||
width:40px;
|
||||
height:56px;
|
||||
position:relative;
|
||||
margin:0px auto;
|
||||
box-shadow:inset rgba(255,255,255,0.8) 0 1px 1px;
|
||||
|
||||
text-indent:-9999em;
|
||||
|
||||
border-radius:0px 15px 8px 3px;
|
||||
}
|
||||
.docIcon:before {
|
||||
content: "";
|
||||
display: block;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
width: 15px;
|
||||
height: 15px;
|
||||
background: #ccc;
|
||||
|
||||
background: -webkit-linear-gradient(45deg, #fff 0, #eee 50%, #ccc 100%);
|
||||
background: -moz-linear-gradient(45deg, #fff 0, #eee 50%, #ccc 100%);
|
||||
background: -o-linear-gradient(45deg, #fff 0, #eee 50%, #ccc 100%);
|
||||
background: -ms-linear-gradient(45deg, #fff 0, #eee 50%, #ccc 100%);
|
||||
background: linear-gradient(45deg, #fff 0, #eee 50%, #ccc 100%);
|
||||
|
||||
-webkit-box-shadow: rgba(0,0,0,0.05) -1px 1px 1px, inset white 0 0 1px;
|
||||
-moz-box-shadow: rgba(0,0,0,0.05) -1px 1px 1px, inset white 0 0 1px;
|
||||
box-shadow: rgba(0,0,0,0.05) -1px 1px 1px, inset white 0 0 1px;
|
||||
|
||||
border-bottom: 1px solid #ccc;
|
||||
border-left: 1px solid #ccc;
|
||||
-webkit-border-radius:3px 15px 3px 3px;
|
||||
-moz-border-radius:3px 15px 3px 3px;
|
||||
border-radius:3px 15px 3px 3px;
|
||||
}
|
||||
|
||||
.docIcon:after
|
||||
{
|
||||
content:"";
|
||||
display:block;
|
||||
position:absolute;
|
||||
left:0;
|
||||
top:0;
|
||||
width:60%;
|
||||
margin:22px 20% 0;
|
||||
height:15px;
|
||||
|
||||
background:#ccc;
|
||||
background: -webkit-linear-gradient(top, #ccc 0, #ccc 20%, #fff 20%, #fff 40%, #ccc 40%, #ccc 60%, #fff 60%, #fff 80%, #ccc 80%, #ccc 100%);
|
||||
background: -moz-linear-gradient(top, #ccc 0, #ccc 20%, #fff 20%, #fff 40%, #ccc 40%, #ccc 60%, #fff 60%, #fff 80%, #ccc 80%, #ccc 100%);
|
||||
background: -o-linear-gradient(top, #ccc 0, #ccc 20%, #fff 20%, #fff 40%, #ccc 40%, #ccc 60%, #fff 60%, #fff 80%, #ccc 80%, #ccc 100%);
|
||||
background: -ms-linear-gradient(top, #ccc 0, #ccc 20%, #fff 20%, #fff 40%, #ccc 40%, #ccc 60%, #fff 60%, #fff 80%, #ccc 80%, #ccc 100%);
|
||||
background:linear-gradient(top, #ccc 0, #ccc 20%, #fff 20%, #fff 40%, #ccc 40%, #ccc 60%, #fff 60%, #fff 80%, #ccc 80%, #ccc 100%);
|
||||
}
|
||||
@ -0,0 +1,29 @@
|
||||
body {
|
||||
margin: 0;
|
||||
background-color: #000;
|
||||
color: #fff;
|
||||
font-family: Monospace;
|
||||
font-size: 13px;
|
||||
line-height: 24px;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#info {
|
||||
position: absolute;
|
||||
top: 0px;
|
||||
color: #ffff00;
|
||||
font-size: 10px;
|
||||
text-align: left;
|
||||
z-index: 1; /* TODO Solve this in HTML */
|
||||
}
|
||||
|
||||
td {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.selectBox {
|
||||
border: 1px solid #55aaff;
|
||||
background-color: rgba(75, 160, 255, 0.3);
|
||||
position: fixed;
|
||||
}
|
||||
@ -0,0 +1,48 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||
width="972px" height="972px" viewBox="0 0 972 972" style="enable-background:new 0 0 972 972;" xml:space="preserve">
|
||||
<g>
|
||||
<path d="M894.2,832.662v-57.6H747.9v57.6C748.3,934.562,894.2,935.763,894.2,832.662z"/>
|
||||
<path d="M223.4,832.662v-57.6H77.7v57.6C77.5,935.763,223.4,934.562,223.4,832.662z"/>
|
||||
<path d="M972,655.062v-202c-0.2-70.4-56.3-107.6-88.2-111.7l-79.7-205.7c-14.899-39.4-47.5-72.9-109.1-73.2H582.7h-192H276.3
|
||||
c-61.3,0.3-93.9,33.8-109.1,73.2l-79.7,205.7c-31.6,4.1-87.6,41.3-87.5,111.7v202c0,33.1,26.9,60,60,60h852
|
||||
C945.1,715.062,972,688.263,972,655.062z M163,566.962c-0.1,0-0.1,0-0.2,0c-0.1,0-0.1,0-0.2,0c-37.2,0-67.2-31-67.1-69.199
|
||||
c-0.2-38.301,29.7-69.301,66.7-69.301c0.2,0,0.4,0,0.6,0c0.2,0,0.4,0,0.6,0c36.9,0,66.8,31,66.7,69.301
|
||||
C230.2,535.962,200.1,566.962,163,566.962z M486,339.462h-0.7H235.9c-22,0-36.9-22.4-28.3-42.7l42-99.3
|
||||
c6.3-15.7,18.5-39.5,45.1-39.9h381.7c26.199,0.4,32.8,15.1,45.1,39.9l42,99.3c8.6,20.3-6.3,42.7-28.3,42.7H486L486,339.462z
|
||||
M804.3,571.962c-0.1,0-0.1,0-0.2,0c-0.1,0-0.1,0-0.199,0c-37.4,0-67.5-31-67.7-69.199c0.2-38.301,30.1-69.301,67.399-69.301
|
||||
c0.2,0,0.4,0,0.601,0s0.399,0,0.6,0c36.601,0,66.5,31,66.7,69.301C871.2,540.962,841.1,571.962,804.3,571.962z"/>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 43 KiB |
@ -0,0 +1,591 @@
|
||||
|
||||
|
||||
import * as THREE from './lib/three.module.js';
|
||||
import {globalObjectCategory} from './obj_cfg.js';
|
||||
import {saveWorldList} from "./save.js"
|
||||
import { intersect } from './util.js';
|
||||
|
||||
|
||||
function Annotation(sceneMeta, world, frameInfo){
|
||||
this.world = world;
|
||||
this.data = this.world.data;
|
||||
//this.coordinatesOffset = this.world.coordinatesOffset;
|
||||
this.boxes_load_time = 0;
|
||||
this.frameInfo = frameInfo;
|
||||
|
||||
|
||||
this.modified = false;
|
||||
this.setModified = function(){
|
||||
this.modified=true;
|
||||
|
||||
if (pointsGlobalConfig.autoSave)
|
||||
{
|
||||
saveWorldList([this.world]);
|
||||
}
|
||||
};
|
||||
this.resetModified = function(){this.modified=false;};
|
||||
|
||||
|
||||
this.sort_boxes = function(){
|
||||
this.boxes = this.boxes.sort(function(x,y){
|
||||
return x.position.y - y.position.y;
|
||||
});
|
||||
};
|
||||
this.findBoxByTrackId = function(id){
|
||||
if (this.boxes){
|
||||
let box = this.boxes.find(function(x){
|
||||
return x.obj_track_id == id;
|
||||
});
|
||||
return box;
|
||||
}
|
||||
|
||||
return null;
|
||||
};
|
||||
|
||||
this.findIntersectedBoxes = function(box){
|
||||
return this.boxes.filter(b=>b!=box).filter(b=>intersect(box, b));
|
||||
};
|
||||
|
||||
this.preload = function(on_preload_finished){
|
||||
this.on_preload_finished = on_preload_finished;
|
||||
this.load_annotation((boxes)=>this.proc_annotation(boxes));
|
||||
};
|
||||
|
||||
|
||||
|
||||
this.go_cmd_received = false;
|
||||
this.webglScene = null;
|
||||
this.on_go_finished = null;
|
||||
this.go = function(webglScene, on_go_finished){
|
||||
this.webglScene = webglScene;
|
||||
|
||||
if (this.preloaded){
|
||||
|
||||
//this.boxes.forEach(b=>this.webglScene.add(b));
|
||||
if (this.data.cfg.color_obj != "no"){
|
||||
this.color_boxes();
|
||||
}
|
||||
|
||||
if (on_go_finished)
|
||||
on_go_finished();
|
||||
} else {
|
||||
this.go_cmd_received = true;
|
||||
this.on_go_finished = on_go_finished;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// internal funcs below
|
||||
this._afterPreload = function(){
|
||||
this.preloaded = true;
|
||||
console.log("annotation preloaded");
|
||||
|
||||
if (this.on_preload_finished){
|
||||
this.on_preload_finished();
|
||||
}
|
||||
if (this.go_cmd_received){
|
||||
this.go(this.webglScene, this.on_go_finished);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
this.unload = function(){
|
||||
if (this.boxes){
|
||||
this.boxes.forEach((b)=>{
|
||||
//this.webglGroup.remove(b);
|
||||
|
||||
if (b.boxEditor)
|
||||
b.boxEditor.detach();
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
this.deleteAll = function(){
|
||||
this.remove_all_boxes();
|
||||
};
|
||||
this.boxToAnn = function(box){
|
||||
let ann = {
|
||||
psr: {
|
||||
position:{
|
||||
x: box.position.x,
|
||||
y: box.position.y,
|
||||
z: box.position.z,
|
||||
},
|
||||
scale:{
|
||||
x: box.scale.x,
|
||||
y: box.scale.y,
|
||||
z: box.scale.z,
|
||||
},
|
||||
rotation:{
|
||||
x:box.rotation.x,
|
||||
y:box.rotation.y,
|
||||
z:box.rotation.z,
|
||||
},
|
||||
},
|
||||
obj_type: box.obj_type,
|
||||
obj_id: String(box.obj_track_id),
|
||||
obj_attr: box.obj_attr,
|
||||
//vertices: vertices,
|
||||
};
|
||||
return ann;
|
||||
};
|
||||
|
||||
this.toBoxAnnotations = function(){
|
||||
let anns = this.boxes.map((b)=>{
|
||||
//var vertices = psr_to_xyz(b.position, b.scale, b.rotation);
|
||||
let ann = this.boxToAnn(b);
|
||||
|
||||
if (b.annotator)
|
||||
ann.annotator = b.annotator;
|
||||
|
||||
if (b.follows)
|
||||
ann.follows = b.follows;
|
||||
return ann;
|
||||
});
|
||||
|
||||
anns.sort((a,b)=>a.obj_id- b.obj_id);
|
||||
|
||||
return anns;
|
||||
};
|
||||
|
||||
|
||||
|
||||
// to real-world position (no offset)
|
||||
this.ann_to_vector_global = function(box) {
|
||||
let posG = this.world.lidarPosToScene(box.position);
|
||||
let rotG = this.world.lidarRotToScene(box.rotation);
|
||||
|
||||
return [
|
||||
posG.x - this.world.coordinatesOffset[0], posG.y-this.world.coordinatesOffset[1], posG.z-this.world.coordinatesOffset[2],
|
||||
rotG.x, rotG.y, rotG.z,
|
||||
box.scale.x, box.scale.y, box.scale.z,
|
||||
];
|
||||
|
||||
};
|
||||
|
||||
// real-world position to ann
|
||||
this.vector_global_to_ann = function(v)
|
||||
{
|
||||
let posG = new THREE.Vector3(v[0]+this.world.coordinatesOffset[0],
|
||||
v[1]+this.world.coordinatesOffset[1],
|
||||
v[2]+this.world.coordinatesOffset[2]);
|
||||
let rotG = new THREE.Euler(v[3],v[4],v[5]);
|
||||
|
||||
let rotL = this.world.sceneRotToLidar(rotG);
|
||||
let posL = this.world.scenePosToLidar(posG);
|
||||
|
||||
return {
|
||||
position: {x: posL.x, y: posL.y, z: posL.z},
|
||||
rotation: {x: rotL.x, y: rotL.y, z: rotL.z},
|
||||
scale: {x: v[6], y: v[7], z: v[8]}
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
|
||||
// this.vector_to_ann = function(v){
|
||||
// return {
|
||||
// position:{
|
||||
// x:v[0],// + this.coordinatesOffset[0],
|
||||
// y:v[1],// + this.coordinatesOffset[1],
|
||||
// z:v[2],// + this.coordinatesOffset[2],
|
||||
// },
|
||||
|
||||
|
||||
// rotation:{
|
||||
// x:v[3],
|
||||
// y:v[4],
|
||||
// z:v[5],
|
||||
// },
|
||||
|
||||
// scale:{
|
||||
// x:v[6],
|
||||
// y:v[7],
|
||||
// z:v[8],
|
||||
// },
|
||||
|
||||
// };
|
||||
// };
|
||||
|
||||
this.remove_all_boxes = function(){
|
||||
if (this.boxes){
|
||||
this.boxes.forEach((b)=>{
|
||||
this.webglGroup.remove(b);
|
||||
this.world.data.dbg.free();
|
||||
b.geometry.dispose();
|
||||
b.material.dispose();
|
||||
b.world = null;
|
||||
b.boxEditor = null;
|
||||
});
|
||||
|
||||
this.boxes = [];
|
||||
}
|
||||
else{
|
||||
console.error("destroy empty world!")
|
||||
}
|
||||
};
|
||||
|
||||
this.new_bbox_cube=function(color){
|
||||
|
||||
var h = 0.5;
|
||||
|
||||
var body = [
|
||||
//top
|
||||
-h,h,h, h,h,h,
|
||||
h,h,h, h,-h,h,
|
||||
h,-h,h, -h,-h,h,
|
||||
-h,-h,h, -h, h, h,
|
||||
|
||||
//botom
|
||||
-h,h,-h, h,h,-h,
|
||||
h,h,-h, h,-h,-h,
|
||||
h,-h,-h, -h,-h,-h,
|
||||
-h,-h,-h, -h, h, -h,
|
||||
|
||||
// vertical lines
|
||||
-h,h,h, -h,h,-h,
|
||||
h,h,h, h,h,-h,
|
||||
h,-h,h, h,-h,-h,
|
||||
-h,-h,h, -h,-h,-h,
|
||||
|
||||
//direction
|
||||
h, 0, h, 1.5*h, 0, h,
|
||||
//h/2, -h, h+0.1, h, 0, h+0.1,
|
||||
//h/2, h, h+0.1, h, 0, h+0.1,
|
||||
|
||||
//side direction
|
||||
// h, h/2, h, h, h, 0,
|
||||
// h, h/2, -h, h, h, 0,
|
||||
// h, 0, 0, h, h, 0,
|
||||
|
||||
];
|
||||
|
||||
|
||||
this.world.data.dbg.alloc();
|
||||
|
||||
var bbox = new THREE.BufferGeometry();
|
||||
bbox.setAttribute( 'position', new THREE.Float32BufferAttribute(body, 3 ) );
|
||||
|
||||
if (!color){
|
||||
color = 0x00ff00;
|
||||
}
|
||||
|
||||
/*
|
||||
https://threejs.org/docs/index.html#api/en/materials/LineBasicMaterial
|
||||
linewidth is 1, regardless of set value.
|
||||
*/
|
||||
|
||||
|
||||
var material = new THREE.LineBasicMaterial( { color: color, linewidth: 1, opacity: this.data.cfg.box_opacity, transparent: true } );
|
||||
var box = new THREE.LineSegments( bbox, material );
|
||||
|
||||
box.scale.x=1.8;
|
||||
box.scale.y=4.5;
|
||||
box.scale.z=1.5;
|
||||
box.name="bbox";
|
||||
box.obj_type="car";
|
||||
|
||||
//box.computeLineDistances();
|
||||
|
||||
|
||||
|
||||
return box;
|
||||
};
|
||||
|
||||
this.createCuboid = function(pos, scale, rotation, obj_type, track_id, obj_attr){
|
||||
let mesh = this.new_bbox_cube(parseInt("0x"+globalObjectCategory.get_obj_cfg_by_type(obj_type).color.slice(1)));
|
||||
mesh.position.x = pos.x;
|
||||
mesh.position.y = pos.y;
|
||||
mesh.position.z = pos.z;
|
||||
|
||||
mesh.scale.x = scale.x;
|
||||
mesh.scale.y = scale.y;
|
||||
mesh.scale.z = scale.z;
|
||||
|
||||
mesh.rotation.x = rotation.x;
|
||||
mesh.rotation.y = rotation.y;
|
||||
mesh.rotation.z = rotation.z;
|
||||
|
||||
mesh.obj_track_id = track_id; //tracking id
|
||||
mesh.obj_type = obj_type;
|
||||
mesh.obj_attr = obj_attr;
|
||||
mesh.obj_local_id = this.get_new_box_local_id();
|
||||
|
||||
mesh.world = this.world;
|
||||
|
||||
return mesh;
|
||||
};
|
||||
/*
|
||||
pos: offset position, after transformed
|
||||
*/
|
||||
|
||||
this.add_box=function(pos, scale, rotation, obj_type, track_id, obj_attr){
|
||||
|
||||
let mesh = this.createCuboid(pos, scale, rotation, obj_type, track_id, obj_attr)
|
||||
|
||||
this.boxes.push(mesh);
|
||||
this.sort_boxes();
|
||||
|
||||
this.webglGroup.add(mesh);
|
||||
|
||||
return mesh;
|
||||
};
|
||||
|
||||
this.load_box = function(box){
|
||||
|
||||
this.webglGroup.add(box);
|
||||
};
|
||||
|
||||
this.unload_box = function(box){
|
||||
|
||||
this.webglGroup.remove(box);
|
||||
};
|
||||
|
||||
this.remove_box=function(box){
|
||||
this.world.data.dbg.free();
|
||||
box.geometry.dispose();
|
||||
box.material.dispose();
|
||||
//selected_box.dispose();
|
||||
this.boxes = this.boxes.filter(function(x){return x !=box;});
|
||||
};
|
||||
|
||||
this.set_box_opacity=function(box_opacity){
|
||||
this.boxes.forEach(function(x){
|
||||
x.material.opacity = box_opacity;
|
||||
});
|
||||
};
|
||||
|
||||
this.translate_box_position=function(pos, theta, axis, delta){
|
||||
switch (axis){
|
||||
case 'x':
|
||||
pos.x += delta*Math.cos(theta);
|
||||
pos.y += delta*Math.sin(theta);
|
||||
break;
|
||||
case 'y':
|
||||
pos.x += delta*Math.cos(Math.PI/2 + theta);
|
||||
pos.y += delta*Math.sin(Math.PI/2 + theta);
|
||||
break;
|
||||
case 'z':
|
||||
pos.z += delta;
|
||||
break;
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
this.find_boxes_inside_rect = function(x,y,w,h, camera){
|
||||
|
||||
let selected_boxes_by_rect = [];
|
||||
|
||||
if (!this.boxes)
|
||||
return selected_boxes_by_rect;
|
||||
|
||||
|
||||
var p = new THREE.Vector3();
|
||||
|
||||
for (var i=0; i< this.boxes.length; i++){
|
||||
let box_center = this.boxes[i].position;
|
||||
|
||||
let pw = this.world.lidarPosToScene(box_center);
|
||||
p.set(pw.x, pw.y, pw.z);
|
||||
p.project(camera);
|
||||
p.x = p.x/p.z;
|
||||
p.y = p.y/p.z;
|
||||
//console.log(p);
|
||||
if ((p.x > x) && (p.x < x+w) && (p.y>y) && (p.y<y+h)){
|
||||
selected_boxes_by_rect.push(this.boxes[i]);
|
||||
}
|
||||
}
|
||||
|
||||
console.log("select boxes", selected_boxes_by_rect.length);
|
||||
return selected_boxes_by_rect;
|
||||
},
|
||||
|
||||
|
||||
this.proc_annotation = function(boxes){
|
||||
|
||||
// boxes = this.transformBoxesByEgoPose(boxes);
|
||||
// boxes = this.transformBoxesByOffset(boxes);
|
||||
|
||||
// //var boxes = JSON.parse(this.responseText);
|
||||
//console.log(ret);
|
||||
this.boxes = this.createBoxes(boxes); //create in future world
|
||||
|
||||
this.webglGroup = new THREE.Group();
|
||||
this.webglGroup.name = "annotations";
|
||||
this.boxes.forEach(b=>this.webglGroup.add(b));
|
||||
|
||||
this.world.webglGroup.add(this.webglGroup);
|
||||
|
||||
this.boxes_load_time = new Date().getTime();
|
||||
console.log(this.boxes_load_time, this.frameInfo.scene, this.frameInfo.frame, "loaded boxes ", this.boxes_load_time - this.create_time, "ms");
|
||||
|
||||
this.sort_boxes();
|
||||
|
||||
this._afterPreload();
|
||||
};
|
||||
|
||||
this.load_annotation=function(on_load){
|
||||
if (this.data.cfg.disableLabels){
|
||||
on_load([]);
|
||||
}else {
|
||||
var xhr = new XMLHttpRequest();
|
||||
// we defined the xhr
|
||||
var _self = this;
|
||||
xhr.onreadystatechange = function () {
|
||||
if (this.readyState != 4) return;
|
||||
|
||||
if (this.status == 200) {
|
||||
let ann = _self.frameInfo.anno_to_boxes(this.responseText);
|
||||
on_load(ann);
|
||||
}
|
||||
|
||||
// end of state change: it can be after some time (async)
|
||||
};
|
||||
|
||||
xhr.open('GET', "/load_annotation"+"?scene="+this.frameInfo.scene+"&frame="+this.frameInfo.frame, true);
|
||||
xhr.send();
|
||||
}
|
||||
};
|
||||
|
||||
this.reloadAnnotation=function(done){
|
||||
this.load_annotation(ann=>{
|
||||
this.reapplyAnnotation(ann, done);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
this.reapplyAnnotation = function(boxes, done){
|
||||
// these boxes haven't attached a world
|
||||
//boxes = this.transformBoxesByOffset(boxes);
|
||||
|
||||
// mark all old boxes
|
||||
this.boxes.forEach(b=>{b.delete=true;});
|
||||
|
||||
let pendingBoxList=[];
|
||||
|
||||
boxes.forEach(nb=>{ // nb is annotation format, not a true box
|
||||
let old_box = this.boxes.find(function(x){
|
||||
return x.obj_track_id == nb.obj_id && x.obj_track_id != "" && nb.obj_id != "" && x.obj_type == nb.obj_type;;
|
||||
});
|
||||
|
||||
if (old_box){
|
||||
// found
|
||||
// update psr
|
||||
delete old_box.delete; // unmark delete flag
|
||||
old_box.position.set(nb.psr.position.x, nb.psr.position.y, nb.psr.position.z);
|
||||
old_box.scale.set(nb.psr.scale.x, nb.psr.scale.y, nb.psr.scale.z);
|
||||
old_box.rotation.set(nb.psr.rotation.x, nb.psr.rotation.y, nb.psr.rotation.z);
|
||||
old_box.obj_attr = nb.obj_attr;
|
||||
old_box.annotator = nb.annotator;
|
||||
old_box.changed=false; // clear changed flag.
|
||||
|
||||
}else{
|
||||
// not found
|
||||
let box=this.createOneBoxByAnn(nb);
|
||||
pendingBoxList.push(box);
|
||||
}
|
||||
});
|
||||
|
||||
// delete removed
|
||||
let toBeDelBoxes = this.boxes.filter(b=>b.delete);
|
||||
toBeDelBoxes.forEach(b=>{
|
||||
if (b.boxEditor){
|
||||
|
||||
b.boxEditor.detach("donthide");
|
||||
}
|
||||
|
||||
this.webglGroup.remove(b);
|
||||
|
||||
this.remove_box(b);
|
||||
})
|
||||
|
||||
pendingBoxList.forEach(b=>{
|
||||
this.boxes.push(b);
|
||||
})
|
||||
|
||||
|
||||
//todo, restore point color
|
||||
//todo, update imagecontext, selected box, ...
|
||||
//refer to normal delete operation
|
||||
// re-color again
|
||||
this.world.lidar.recolor_all_points();
|
||||
|
||||
this.color_boxes();
|
||||
|
||||
// add new boxes
|
||||
pendingBoxList.forEach(b=>{
|
||||
this.webglGroup.add(b);
|
||||
})
|
||||
|
||||
|
||||
this.resetModified();
|
||||
|
||||
if (done)
|
||||
done();
|
||||
|
||||
}
|
||||
|
||||
this.createOneBoxByAnn = function(annotation){
|
||||
let b = annotation;
|
||||
|
||||
let mesh = this.createCuboid(b.psr.position,
|
||||
b.psr.scale,
|
||||
b.psr.rotation,
|
||||
b.obj_type,
|
||||
b.obj_id,
|
||||
b.obj_attr);
|
||||
|
||||
if (b.annotator){
|
||||
mesh.annotator = b.annotator;
|
||||
}
|
||||
|
||||
if (b.follows)
|
||||
mesh.follows = b.follows;
|
||||
|
||||
return mesh;
|
||||
};
|
||||
|
||||
this.createBoxes = function(annotations){
|
||||
return annotations.map((b)=>{
|
||||
return this.createOneBoxByAnn(b);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
this.box_local_id = 0;
|
||||
this.get_new_box_local_id=function(){
|
||||
var ret = this.box_local_id;
|
||||
this.box_local_id+=1;
|
||||
return ret;
|
||||
};
|
||||
|
||||
|
||||
this.color_box = function(box)
|
||||
{
|
||||
if (this.data.cfg.color_obj == "category" || this.data.cfg.color_obj == "no")
|
||||
{
|
||||
let color = globalObjectCategory.get_color_by_category(box.obj_type);
|
||||
box.material.color.r=color.x;
|
||||
box.material.color.g=color.y;
|
||||
box.material.color.b=color.z;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
let color = globalObjectCategory.get_color_by_id(box.obj_track_id);
|
||||
box.material.color.r=color.x;
|
||||
box.material.color.g=color.y;
|
||||
box.material.color.b=color.z;
|
||||
}
|
||||
}
|
||||
|
||||
this.color_boxes = function()
|
||||
{
|
||||
this.boxes.forEach(box=>{
|
||||
this.color_box(box);
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
export{Annotation}
|
||||
@ -0,0 +1,463 @@
|
||||
|
||||
import {transpose, matmul2, euler_angle_to_rotate_matrix_3by3,normalizeAngle } from "./util.js";
|
||||
import { logger } from "./log.js";
|
||||
|
||||
// todo: this module needs a proper name
|
||||
|
||||
function AutoAdjust(boxOp, mouse, header){
|
||||
this.boxOp = boxOp,
|
||||
this.mouse = mouse;
|
||||
this.header = header;
|
||||
var marked_object = null;
|
||||
|
||||
// mark bbox, which will be used as reference-bbox of an object.
|
||||
this.mark_bbox=function(box){
|
||||
if (box){
|
||||
this.marked_object = {
|
||||
frame: box.world.frameInfo.frame,
|
||||
scene: box.world.frameInfo.scene,
|
||||
ann: box.world.annotation.boxToAnn(box),
|
||||
}
|
||||
|
||||
logger.log(`selected reference objcet ${this.marked_object}`);
|
||||
|
||||
this.header.set_ref_obj(this.marked_object);
|
||||
}
|
||||
};
|
||||
|
||||
this.followStaticObjects = function(box) {
|
||||
let world = box.world;
|
||||
let staticObjects = world.annotation.boxes.
|
||||
filter(b=>b!=box && b.obj_attr && b.obj_attr.search('static')>=0).
|
||||
map(refObj=>{
|
||||
let coord = euler_angle_to_rotate_matrix_3by3(refObj.rotation);
|
||||
let trans = transpose(coord, 3);
|
||||
let p = [box.position.x - refObj.position.x,
|
||||
box.position.y - refObj.position.y,
|
||||
box.position.z - refObj.position.z];
|
||||
let relativePos = matmul2(trans, p, 3);
|
||||
let relativeRot = {
|
||||
x: normalizeAngle(box.rotation.x - refObj.rotation.x),
|
||||
y: normalizeAngle(box.rotation.y - refObj.rotation.y),
|
||||
z: normalizeAngle(box.rotation.z - refObj.rotation.z),
|
||||
};
|
||||
|
||||
|
||||
let distance = Math.sqrt(relativePos[0]*relativePos[0] + relativePos[1]*relativePos[1] + relativePos[2]*relativePos[2]);
|
||||
return {
|
||||
obj_track_id: refObj.obj_track_id,
|
||||
relativePos,
|
||||
relativeRot,
|
||||
distance
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
let worldList = box.world.data.worldList;
|
||||
//let saveList = [];
|
||||
worldList.forEach(w=>{
|
||||
if (w === box.world){
|
||||
//current frame
|
||||
return;
|
||||
}
|
||||
|
||||
let existedBox = w.annotation.boxes.find(b=>b.obj_track_id == box.obj_track_id);
|
||||
if (existedBox && !existedBox.annotator)
|
||||
{
|
||||
// have same objects annotated.
|
||||
// if its generated by machine, lets overwrite it
|
||||
return;
|
||||
}
|
||||
|
||||
let candPoseSets = staticObjects.map(refObj=>{
|
||||
|
||||
let refObjInW = w.annotation.boxes.find(b=>b.obj_track_id == refObj.obj_track_id);
|
||||
if (!refObjInW){
|
||||
// not found refobj in this world, give up
|
||||
return null;
|
||||
}
|
||||
|
||||
let relativePos = refObj.relativePos;
|
||||
let relativeRot = refObj.relativeRot;
|
||||
|
||||
let coord = euler_angle_to_rotate_matrix_3by3(refObjInW.rotation);
|
||||
|
||||
let rp = matmul2(coord, relativePos, 3);
|
||||
let newObjPos = {
|
||||
x: refObjInW.position.x + rp[0],
|
||||
y: refObjInW.position.y + rp[1],
|
||||
z: refObjInW.position.z + rp[2],
|
||||
};
|
||||
|
||||
let newObjRot = {
|
||||
x: normalizeAngle(refObjInW.rotation.x + relativeRot.x),
|
||||
y: normalizeAngle(refObjInW.rotation.y + relativeRot.y),
|
||||
z: normalizeAngle(refObjInW.rotation.z + relativeRot.z)
|
||||
};
|
||||
|
||||
|
||||
|
||||
return {
|
||||
distance: refObj.distance,
|
||||
weight: Math.exp(-refObj.distance * (refObjInW.annotator?1:0.1)),
|
||||
position: newObjPos,
|
||||
rotation: newObjRot,
|
||||
};
|
||||
});
|
||||
|
||||
candPoseSets = candPoseSets.filter(p=>!!p);
|
||||
|
||||
|
||||
if (candPoseSets.length == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
// calculate mean pos/rot
|
||||
let denorm = candPoseSets.reduce((a,b)=>a+b.weight, 0);
|
||||
|
||||
let newObjPos = {x:0, y:0, z:0};
|
||||
let newObjRot = {x:0, y:0, z:0, cosZ: 0, sinZ:0};
|
||||
candPoseSets.forEach(p=>{
|
||||
newObjPos.x += p.position.x * p.weight;
|
||||
newObjPos.y += p.position.y * p.weight;
|
||||
newObjPos.z += p.position.z * p.weight;
|
||||
|
||||
newObjRot.x += p.rotation.x * p.weight;
|
||||
newObjRot.y += p.rotation.y * p.weight;
|
||||
//newObjRot.z += p.rotation.z * p.weight;
|
||||
newObjRot.cosZ += Math.cos(p.rotation.z) * p.weight;
|
||||
newObjRot.sinZ += Math.sin(p.rotation.z) * p.weight;
|
||||
});
|
||||
|
||||
newObjPos.x /= denorm;
|
||||
newObjPos.y /= denorm;
|
||||
newObjPos.z /= denorm;
|
||||
newObjRot.x /= denorm;
|
||||
newObjRot.y /= denorm;
|
||||
newObjRot.cosZ /= denorm;
|
||||
newObjRot.sinZ /= denorm;
|
||||
newObjRot.z = Math.atan2(newObjRot.sinZ, newObjRot.cosZ);
|
||||
|
||||
|
||||
// ignor distant objects
|
||||
|
||||
if (pointsGlobalConfig.ignoreDistantObject){
|
||||
let objDistance = Math.sqrt(newObjPos.x * newObjPos.x + newObjPos.y * newObjPos.y + newObjPos.z * newObjPos.z);
|
||||
|
||||
if ((box.scale.z < 2 && objDistance > 100) || objDistance > 150)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// apply
|
||||
if (existedBox){
|
||||
existedBox.position.x = newObjPos.x;
|
||||
existedBox.position.y = newObjPos.y;
|
||||
existedBox.position.z = newObjPos.z;
|
||||
|
||||
existedBox.rotation.x = newObjRot.x;
|
||||
existedBox.rotation.y = newObjRot.y;
|
||||
existedBox.rotation.z = newObjRot.z;
|
||||
|
||||
existedBox.scale.x = box.scale.x;
|
||||
existedBox.scale.y = box.scale.y;
|
||||
existedBox.scale.z = box.scale.z;
|
||||
|
||||
existedBox.annotator="S";
|
||||
|
||||
|
||||
logger.log(`modified box in ${w}`);
|
||||
} else{
|
||||
let newBox = w.annotation.add_box(newObjPos,
|
||||
box.scale,
|
||||
newObjRot,
|
||||
box.obj_type,
|
||||
box.obj_track_id,
|
||||
box.obj_attr);
|
||||
newBox.annotator="S";
|
||||
|
||||
w.annotation.load_box(newBox);
|
||||
logger.log(`inserted box in ${w}`);
|
||||
}
|
||||
|
||||
console.log("added box in ", w.frameInfo.frame);
|
||||
//saveList.push(w);
|
||||
w.annotation.setModified();
|
||||
|
||||
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
this.followsRef = function(box){
|
||||
//find ref object in current frame
|
||||
let world = box.world;
|
||||
let refObj = world.annotation.boxes.find(b=>b.obj_track_id == this.marked_object.ann.obj_id);
|
||||
if (refObj){
|
||||
console.log("found ref obj in current frame");
|
||||
world.annotation.setModified()
|
||||
|
||||
//compute relative position
|
||||
// represent obj in coordinate system of refobj
|
||||
|
||||
let coord = euler_angle_to_rotate_matrix_3by3(refObj.rotation);
|
||||
let trans = transpose(coord, 3);
|
||||
let p = [box.position.x - refObj.position.x,
|
||||
box.position.y - refObj.position.y,
|
||||
box.position.z - refObj.position.z];
|
||||
const relativePos = matmul2(trans, p, 3);
|
||||
const relativeRot = {
|
||||
x: box.rotation.x - refObj.rotation.x,
|
||||
y: box.rotation.y - refObj.rotation.y,
|
||||
z: box.rotation.z - refObj.rotation.z,
|
||||
};
|
||||
|
||||
let worldList = box.world.data.worldList;
|
||||
//let saveList = [];
|
||||
worldList.forEach(w=>{
|
||||
if (w === box.world){
|
||||
//current frame
|
||||
return;
|
||||
}
|
||||
|
||||
let existedBox = w.annotation.boxes.find(b=>b.obj_track_id == box.obj_track_id);
|
||||
|
||||
if (existedBox && !existedBox.annotator)
|
||||
{
|
||||
// have same objects annotated.
|
||||
// if its generated by machine, lets overwrite it
|
||||
return;
|
||||
}
|
||||
|
||||
let refObjInW = w.annotation.boxes.find(b=>b.obj_track_id == refObj.obj_track_id);
|
||||
if (!refObjInW){
|
||||
// not found refobj in this world, give up
|
||||
return;
|
||||
}
|
||||
|
||||
let coord = euler_angle_to_rotate_matrix_3by3(refObjInW.rotation);
|
||||
|
||||
let rp = matmul2(coord, relativePos, 3);
|
||||
let newObjPos = {
|
||||
x: refObjInW.position.x + rp[0],
|
||||
y: refObjInW.position.y + rp[1],
|
||||
z: refObjInW.position.z + rp[2],
|
||||
};
|
||||
|
||||
let newObjRot = {
|
||||
x: refObjInW.rotation.x + relativeRot.x,
|
||||
y: refObjInW.rotation.y + relativeRot.y,
|
||||
z: refObjInW.rotation.z + relativeRot.z
|
||||
};
|
||||
|
||||
if (existedBox){
|
||||
existedBox.position.x = newObjPos.x;
|
||||
existedBox.position.y = newObjPos.y;
|
||||
existedBox.position.z = newObjPos.z;
|
||||
|
||||
existedBox.rotation.x = newObjRot.x;
|
||||
existedBox.rotation.y = newObjRot.y;
|
||||
existedBox.rotation.z = newObjRot.z;
|
||||
|
||||
existedBox.scale.x = box.scale.x;
|
||||
existedBox.scale.y = box.scale.y;
|
||||
existedBox.scale.z = box.scale.z;
|
||||
|
||||
existedBox.annotator="F";
|
||||
existedBox.follows = {
|
||||
obj_track_id: refObj.obj_track_id,
|
||||
relative_position: {
|
||||
x: relativePos[0],
|
||||
y: relativePos[1],
|
||||
z: relativePos[2],
|
||||
},
|
||||
relative_rotation: relativeRot,
|
||||
};
|
||||
|
||||
logger.log(`modified box in ${w}`);
|
||||
} else{
|
||||
let newBox = w.annotation.add_box(newObjPos,
|
||||
box.scale,
|
||||
newObjRot,
|
||||
box.obj_type,
|
||||
box.obj_track_id,
|
||||
box.obj_attr);
|
||||
newBox.annotator="F";
|
||||
newBox.follows = {
|
||||
obj_track_id: refObj.obj_track_id,
|
||||
relative_position: {
|
||||
x: relativePos[0],
|
||||
y: relativePos[1],
|
||||
z: relativePos[2],
|
||||
},
|
||||
relative_rotation: relativeRot,
|
||||
};
|
||||
|
||||
w.annotation.load_box(newBox);
|
||||
logger.log(`inserted box in ${w}`);
|
||||
}
|
||||
|
||||
console.log("added box in ", w.frameInfo.frame);
|
||||
//saveList.push(w);
|
||||
w.annotation.setModified();
|
||||
});
|
||||
|
||||
//saveWorldList(saveList);
|
||||
}
|
||||
};
|
||||
|
||||
this.syncFollowers = function(box){
|
||||
let world = box.world;
|
||||
let allFollowers = world.annotation.boxes.filter(b=>b.follows && b.follows.obj_track_id === box.obj_track_id);
|
||||
|
||||
if (allFollowers.length == 0){
|
||||
console.log("no followers");
|
||||
return;
|
||||
}
|
||||
|
||||
let refObj = box;
|
||||
let coord = euler_angle_to_rotate_matrix_3by3(refObj.rotation);
|
||||
|
||||
|
||||
allFollowers.forEach(fb=>{
|
||||
let relpos = [fb.follows.relative_position.x,
|
||||
fb.follows.relative_position.y,
|
||||
fb.follows.relative_position.z,
|
||||
];
|
||||
|
||||
let rp = matmul2(coord, relpos, 3);
|
||||
|
||||
fb.position.x = refObj.position.x + rp[0];
|
||||
fb.position.y = refObj.position.y + rp[1];
|
||||
fb.position.z = refObj.position.z + rp[2];
|
||||
|
||||
fb.rotation.x = refObj.rotation.x + fb.follows.relative_rotation.x;
|
||||
fb.rotation.y = refObj.rotation.y + fb.follows.relative_rotation.y;
|
||||
fb.rotation.z = refObj.rotation.z + fb.follows.relative_rotation.z;
|
||||
});
|
||||
};
|
||||
|
||||
this.paste_bbox=function(pos, add_box){
|
||||
|
||||
if (!pos)
|
||||
pos = this.marked_object.ann.psr.position;
|
||||
else
|
||||
pos.z = this.marked_object.ann.psr.position.z;
|
||||
|
||||
return add_box(pos, this.marked_object.ann.psr.scale, this.marked_object.ann.psr.rotation,
|
||||
this.marked_object.ann.obj_type, this.marked_object.ann.obj_id, this.marked_object.ann.obj_attr);
|
||||
};
|
||||
|
||||
|
||||
// this.auto_adjust_bbox=function(box, done, on_box_changed){
|
||||
|
||||
// saveWorld(function(){
|
||||
// do_adjust(box, on_box_changed);
|
||||
// });
|
||||
// let _self =this;
|
||||
// function do_adjust(box, on_box_changed){
|
||||
// console.log("auto adjust highlighted bbox");
|
||||
|
||||
// var xhr = new XMLHttpRequest();
|
||||
// // we defined the xhr
|
||||
|
||||
// xhr.onreadystatechange = function () {
|
||||
// if (this.readyState != 4) return;
|
||||
|
||||
// if (this.status == 200) {
|
||||
// console.log(this.responseText)
|
||||
// console.log(box.position);
|
||||
// console.log(box.rotation);
|
||||
|
||||
|
||||
// var trans_mat = JSON.parse(this.responseText);
|
||||
|
||||
// var rotation = Math.atan2(trans_mat[4], trans_mat[0]) + box.rotation.z;
|
||||
// var transform = {
|
||||
// x: -trans_mat[3],
|
||||
// y: -trans_mat[7],
|
||||
// z: -trans_mat[11],
|
||||
// }
|
||||
|
||||
|
||||
|
||||
// /*
|
||||
// cos sin x
|
||||
// -sin cos y
|
||||
// */
|
||||
// var new_pos = {
|
||||
// x: Math.cos(-rotation) * transform.x + Math.sin(-rotation) * transform.y,
|
||||
// y: -Math.sin(-rotation) * transform.x + Math.cos(-rotation) * transform.y,
|
||||
// z: transform.z,
|
||||
// };
|
||||
|
||||
|
||||
// box.position.x += new_pos.x;
|
||||
// box.position.y += new_pos.y;
|
||||
// box.position.z += new_pos.z;
|
||||
|
||||
|
||||
|
||||
// box.scale.x = marked_object.scale.x;
|
||||
// box.scale.y = marked_object.scale.y;
|
||||
// box.scale.z = marked_object.scale.z;
|
||||
|
||||
// box.rotation.z -= Math.atan2(trans_mat[4], trans_mat[0]);
|
||||
|
||||
// console.log(box.position);
|
||||
// console.log(box.rotation);
|
||||
|
||||
// on_box_changed(box);
|
||||
|
||||
// _self.header.mark_changed_flag();
|
||||
|
||||
// if (done){
|
||||
// done();
|
||||
// }
|
||||
// }
|
||||
|
||||
// // end of state change: it can be after some time (async)
|
||||
// };
|
||||
|
||||
// xhr.open('GET',
|
||||
// "/auto_adjust"+"?scene="+marked_object.scene + "&"+
|
||||
// "ref_frame=" + marked_object.frame + "&" +
|
||||
// "object_id=" + marked_object.obj_track_id + "&" +
|
||||
// "adj_frame=" + data.world.frameInfo.frame,
|
||||
// true);
|
||||
// xhr.send();
|
||||
// }
|
||||
// };
|
||||
|
||||
this.smart_paste=function(selected_box, add_box, on_box_changed){
|
||||
var box = selected_box;
|
||||
if (!box){
|
||||
let sceneP = this.mouse.get_mouse_location_in_world()
|
||||
// trans pos to world local pos
|
||||
//let pos = this.data.world.scenePosToLidar(sceneP);
|
||||
box = this.paste_bbox(pos, add_box);
|
||||
}
|
||||
else if (this.marked_object){
|
||||
box.scale.x = this.marked_object.ann.psr.scale.x;
|
||||
box.scale.y = this.marked_object.ann.psr.scale.y;
|
||||
box.scale.z = this.marked_object.ann.psr.scale.z;
|
||||
}
|
||||
|
||||
// this.auto_adjust_bbox(box,
|
||||
// function(){saveWorld();},
|
||||
// on_box_changed);
|
||||
|
||||
// this.header.mark_changed_flag();
|
||||
|
||||
|
||||
|
||||
this.boxOp.auto_rotate_xyz(box, null, null,
|
||||
on_box_changed,
|
||||
"noscaling");
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
export {AutoAdjust}
|
||||
@ -0,0 +1,30 @@
|
||||
import { globalObjectCategory } from "./obj_cfg.js";
|
||||
|
||||
|
||||
|
||||
function autoAnnotate(world, done, alg){
|
||||
var xhr = new XMLHttpRequest();
|
||||
// we defined the xhr
|
||||
xhr.onreadystatechange = function () {
|
||||
if (this.readyState != 4) return;
|
||||
|
||||
if (this.status == 200) {
|
||||
let anns = JSON.parse(this.responseText);
|
||||
|
||||
anns.map(a=>a.obj_type = globalObjectCategory.guess_obj_type_by_dimension(a.psr.scale));
|
||||
|
||||
// load annotations
|
||||
world.annotation.reapplyAnnotation(anns);
|
||||
|
||||
if (done)
|
||||
done();
|
||||
}
|
||||
};
|
||||
|
||||
xhr.open('GET', "/auto_annotate?"+"scene="+world.frameInfo.scene+"&frame="+world.frameInfo.frame, true);
|
||||
|
||||
xhr.send();
|
||||
}
|
||||
|
||||
|
||||
export {autoAnnotate}
|
||||
@ -0,0 +1,403 @@
|
||||
import * as THREE from './lib/three.module.js';
|
||||
import { PCDLoader } from './lib/PCDLoader.js';
|
||||
import { matmul, euler_angle_to_rotate_matrix_3by3} from "./util.js"
|
||||
|
||||
|
||||
//todo: clean arrows
|
||||
|
||||
function AuxLidar(sceneMeta, world, frameInfo, auxLidarName){
|
||||
this.world = world;
|
||||
this.frameInfo = frameInfo;
|
||||
this.name = auxLidarName;
|
||||
this.sceneMeta = sceneMeta;
|
||||
this.coordinatesOffset = world.coordinatesOffset;
|
||||
|
||||
this.showPointsOnly = true;
|
||||
this.showCalibBox = false;
|
||||
//this.cssStyleSelector = this.sceneMeta.calib.aux_lidar[this.name].cssstyleselector;
|
||||
this.color = this.sceneMeta.calib.aux_lidar[this.name].color;
|
||||
|
||||
|
||||
if (!this.color)
|
||||
{
|
||||
this.color = [
|
||||
this.world.data.cfg.point_brightness,
|
||||
this.world.data.cfg.point_brightness,
|
||||
this.world.data.cfg.point_brightness,
|
||||
];
|
||||
}
|
||||
|
||||
this.lidar_points = null; // read from file, centered at 0
|
||||
this.elements = null; // geometry points
|
||||
|
||||
this.preloaded = false;
|
||||
this.loaded = false;
|
||||
|
||||
|
||||
this.go_cmd_received = false;
|
||||
this.webglScene = null;
|
||||
this.on_go_finished = null;
|
||||
this.go = function(webglScene, on_go_finished){
|
||||
this.webglScene = webglScene;
|
||||
|
||||
if (this.preloaded){
|
||||
if (this.elements){
|
||||
this.webglScene.add(this.elements.points);
|
||||
|
||||
|
||||
|
||||
if (this.showCalibBox)
|
||||
this.webglScene.add(this.calib_box);
|
||||
}
|
||||
|
||||
this.loaded = true;
|
||||
if (on_go_finished)
|
||||
on_go_finished();
|
||||
}
|
||||
|
||||
//anyway we save go cmd
|
||||
{
|
||||
this.go_cmd_received = true;
|
||||
this.on_go_finished = on_go_finished;
|
||||
}
|
||||
};
|
||||
|
||||
this.showCalibBox = function(){
|
||||
this.showCalibBox = true;
|
||||
this.webglScene.add(this.calib_box);
|
||||
};
|
||||
|
||||
this.hideCalibBox = function(){
|
||||
this.showCalibBox = false;
|
||||
this.webglScene.remove(this.calib_box);
|
||||
};
|
||||
|
||||
this.get_unoffset_lidar_points = function(){
|
||||
if (this.elements){
|
||||
let pts = this.elements.points.geometry.getAttribute("position").array;
|
||||
return pts.map((p,i)=>p-this.world.coordinatesOffset[i %3]);
|
||||
}
|
||||
else{
|
||||
return [];
|
||||
}
|
||||
};
|
||||
|
||||
// todo: what if it's not preloaded yet
|
||||
this.unload = function(keep_box){
|
||||
if (this.elements){
|
||||
this.webglScene.remove(this.elements.points);
|
||||
if (!this.showPointsOnly)
|
||||
this.elements.arrows.forEach(a=>this.webglScene.remove(a));
|
||||
|
||||
if (!keep_box)
|
||||
this.webglScene.remove(this.calib_box);
|
||||
}
|
||||
this.loaded = false;
|
||||
};
|
||||
|
||||
// todo: its possible to remove points before preloading,
|
||||
this.deleteAll = function(keep_box){
|
||||
if (this.loaded){
|
||||
this.unload();
|
||||
}
|
||||
|
||||
if (this.elements){
|
||||
//this.scene.remove(this.points);
|
||||
this.world.data.dbg.free();
|
||||
|
||||
if (this.elements.points)
|
||||
{
|
||||
this.elements.points.geometry.dispose();
|
||||
this.elements.points.material.dispose();
|
||||
}
|
||||
|
||||
if (this.elements.arrows)
|
||||
{
|
||||
this.elements.arrows.forEach(a=>{
|
||||
this.world.data.dbg.free();
|
||||
a.geometry.dispose();
|
||||
a.material.dispose();
|
||||
})
|
||||
}
|
||||
|
||||
this.elements = null;
|
||||
}
|
||||
|
||||
if (!keep_box && this.calib_box){
|
||||
this.world.data.dbg.free();
|
||||
this.calib_box.geometry.dispose();
|
||||
this.calib_box.material.dispose();
|
||||
this.calib_box = null;
|
||||
}
|
||||
};
|
||||
|
||||
this.filterPoints = function(position){
|
||||
let filtered_position = [];
|
||||
|
||||
if (pointsGlobalConfig.enableFilterPoints)
|
||||
{
|
||||
for(let i = 0; i <= position.length; i+=3)
|
||||
{
|
||||
if (position[i+2] <= pointsGlobalConfig.filterPointsZ)
|
||||
{
|
||||
filtered_position.push(position[i]);
|
||||
filtered_position.push(position[i+1]);
|
||||
filtered_position.push(position[i+2]);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return filtered_position;
|
||||
};
|
||||
|
||||
this.preload = function(on_preload_finished){
|
||||
|
||||
this.on_preload_finished = on_preload_finished;
|
||||
|
||||
var loader = new PCDLoader();
|
||||
|
||||
var _self = this;
|
||||
loader.load( this.frameInfo.get_aux_lidar_path(this.name),
|
||||
//ok
|
||||
function ( pcd ) {
|
||||
var position = pcd.position;
|
||||
|
||||
|
||||
//_self.points_parse_time = new Date().getTime();
|
||||
//console.log(_self.points_load_time, _self.frameInfo.scene, _self.frameInfo.frame, "parse pionts ", _self.points_parse_time - _self.create_time, "ms");
|
||||
_self.lidar_points = position;
|
||||
|
||||
// add one box to calibrate lidar with lidar
|
||||
_self.calib_box = _self.createCalibBox();
|
||||
|
||||
// install callback for box changing
|
||||
_self.calib_box.on_box_changed = ()=>{
|
||||
_self.move_lidar(_self.calib_box);
|
||||
};
|
||||
|
||||
//position = _self.transformPointsByOffset(position);
|
||||
position = _self.move_points(_self.calib_box);
|
||||
|
||||
|
||||
|
||||
let elements = _self.buildGeometry(position);
|
||||
|
||||
_self.elements = elements;
|
||||
//_self.points_backup = mesh;
|
||||
|
||||
_self._afterPreload();
|
||||
|
||||
},
|
||||
|
||||
// on progress,
|
||||
function(){},
|
||||
|
||||
// on error
|
||||
function(){
|
||||
//error
|
||||
console.log("load lidar failed.");
|
||||
_self._afterPreload();
|
||||
},
|
||||
|
||||
// on file loaded
|
||||
function(){
|
||||
//_self.points_readfile_time = new Date().getTime();
|
||||
//console.log(_self.points_load_time, _self.frameInfo.scene, _self.frameInfo.frame, "read file ", _self.points_readfile_time - _self.create_time, "ms");
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
// internal funcs below
|
||||
this._afterPreload = function(){
|
||||
this.preloaded = true;
|
||||
console.log(`lidar ${this.auxLidarName} preloaded`);
|
||||
if (this.on_preload_finished){
|
||||
this.on_preload_finished();
|
||||
}
|
||||
if (this.go_cmd_received){
|
||||
this.go(this.webglScene, this.on_go_finished);
|
||||
}
|
||||
};
|
||||
|
||||
this.createCalibBox = function(){
|
||||
if (this.sceneMeta.calib.aux_lidar && this.sceneMeta.calib.aux_lidar[this.name]){
|
||||
return this.world.annotation.createCuboid(
|
||||
{
|
||||
x: this.sceneMeta.calib.aux_lidar[this.name].translation[0] + this.coordinatesOffset[0],
|
||||
y: this.sceneMeta.calib.aux_lidar[this.name].translation[1] + this.coordinatesOffset[1],
|
||||
z: this.sceneMeta.calib.aux_lidar[this.name].translation[2] + this.coordinatesOffset[2],
|
||||
},
|
||||
{x:0.5, y:0.5, z:0.5},
|
||||
{
|
||||
x: this.sceneMeta.calib.aux_lidar[this.name].rotation[0],
|
||||
y: this.sceneMeta.calib.aux_lidar[this.name].rotation[1],
|
||||
z: this.sceneMeta.calib.aux_lidar[this.name].rotation[2],
|
||||
},
|
||||
"lidar",
|
||||
this.name);
|
||||
|
||||
}else {
|
||||
return this.world.annotation.createCuboid(
|
||||
{x: this.coordinatesOffset[0],
|
||||
y: this.coordinatesOffset[1],
|
||||
z: this.coordinatesOffset[2]},
|
||||
{x:0.5, y:0.5, z:0.5},
|
||||
{x:0,y:0,z:0},
|
||||
"lidar",
|
||||
this.name);
|
||||
}
|
||||
};
|
||||
|
||||
this.buildPoints = function(position){
|
||||
// build geometry
|
||||
this.world.data.dbg.alloc();
|
||||
let geometry = new THREE.BufferGeometry();
|
||||
if ( position.length > 0 )
|
||||
geometry.addAttribute( 'position', new THREE.Float32BufferAttribute( position, 3 ) );
|
||||
|
||||
|
||||
let pointColor = this.color;
|
||||
let color=[];
|
||||
for (var i =0; i< position.length; i+=3){
|
||||
|
||||
color.push(pointColor[0]);
|
||||
color.push(pointColor[1]);
|
||||
color.push(pointColor[2]);
|
||||
}
|
||||
|
||||
geometry.addAttribute( 'color', new THREE.Float32BufferAttribute(color, 3 ) );
|
||||
|
||||
geometry.computeBoundingSphere();
|
||||
|
||||
// build material
|
||||
let pointSize = this.sceneMeta.calib.aux_lidar[this.name].point_size;
|
||||
if (!pointSize)
|
||||
pointSize = 1;
|
||||
|
||||
let material = new THREE.PointsMaterial( { size: pointSize, vertexColors: THREE.VertexColors } );
|
||||
//material.size = 2;
|
||||
material.sizeAttenuation = false;
|
||||
|
||||
// build mesh
|
||||
let mesh = new THREE.Points( geometry, material );
|
||||
mesh.name = "lidar";
|
||||
|
||||
return mesh;
|
||||
};
|
||||
|
||||
|
||||
this.buildGeometry = function(position){
|
||||
let points = this.buildPoints(position);
|
||||
|
||||
return {
|
||||
points: points,
|
||||
};
|
||||
};
|
||||
|
||||
this.move_points = function(box){
|
||||
let points = this.lidar_points;
|
||||
let trans = euler_angle_to_rotate_matrix_3by3(box.rotation);
|
||||
let rotated_points = matmul(trans, points, 3);
|
||||
let translation=[box.position.x, box.position.y, box.position.z];
|
||||
let translated_points = rotated_points.map((p,i)=>{
|
||||
return p + translation[i % 3];
|
||||
});
|
||||
|
||||
let filtered_position = this.filterPoints(translated_points);
|
||||
return filtered_position;
|
||||
};
|
||||
|
||||
|
||||
|
||||
this.move_lidar= function(box){
|
||||
|
||||
let translated_points = this.move_points(box);
|
||||
|
||||
let elements = this.buildGeometry(translated_points);
|
||||
|
||||
// remove old points
|
||||
this.unload(true);
|
||||
this.deleteAll(true);
|
||||
|
||||
this.elements = elements;
|
||||
//_self.points_backup = mesh;
|
||||
if (this.go_cmd_received) // this should be always true
|
||||
{
|
||||
this.webglScene.add(this.elements.points);
|
||||
if (!this.showPointsOnly)
|
||||
this.elements.arrows.forEach(a=>this.webglScene.add(a));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
function AuxLidarManager(sceneMeta, world, frameInfo){
|
||||
this.lidarList = [];
|
||||
|
||||
if (world.data.cfg.enableAuxLidar && sceneMeta.aux_lidar){
|
||||
let lidars = [];
|
||||
|
||||
for (let r in sceneMeta.calib.aux_lidar){
|
||||
if (!sceneMeta.calib.aux_lidar[r].disable)
|
||||
lidars.push(r);
|
||||
}
|
||||
|
||||
this.lidarList = lidars.map(name=>{
|
||||
return new AuxLidar(sceneMeta, world, frameInfo, name);
|
||||
});
|
||||
}
|
||||
|
||||
this.getAllBoxes = function()
|
||||
{
|
||||
if (this.showCalibBox)
|
||||
{
|
||||
return this.lidarList.map(r=>r.calib_box);
|
||||
}
|
||||
else
|
||||
{
|
||||
return [];
|
||||
}
|
||||
};
|
||||
|
||||
this.preloaded = function(){
|
||||
for (let r in this.lidarList){
|
||||
if (!this.lidarList[r].preloaded)
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
this.go = function(webglScene, on_go_finished){
|
||||
this.lidarList.forEach(r=>r.go(webglScene, on_go_finished));
|
||||
};
|
||||
|
||||
this.preload = function(on_preload_finished){
|
||||
this.lidarList.forEach(r=>r.preload(on_preload_finished));
|
||||
};
|
||||
|
||||
this.unload = function(){
|
||||
this.lidarList.forEach(r=>r.unload());
|
||||
};
|
||||
|
||||
this.deleteAll = function(){
|
||||
this.lidarList.forEach(r=>r.deleteAll());
|
||||
};
|
||||
|
||||
this.getOperableObjects = function(){
|
||||
return this.lidarList.flatMap(r=>r.getOperableObjects());
|
||||
};
|
||||
|
||||
this.showCalibBox = false;
|
||||
this.showCalibBox = function(){
|
||||
this.showCalibBox = true;
|
||||
this.lidarList.forEach(r=>r.showCalibBox());
|
||||
};
|
||||
|
||||
this.hideCalibBox = function(){
|
||||
this.showCalibBox = false;
|
||||
this.lidarList.forEach(r=>r.hideCalibBox());
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
export {AuxLidarManager}
|
||||
@ -0,0 +1,844 @@
|
||||
import * as THREE from './lib/three.module.js';
|
||||
|
||||
import {logger} from "./log.js"
|
||||
import {
|
||||
Quaternion,
|
||||
Vector3
|
||||
} from "./lib/three.module.js";
|
||||
|
||||
import{ml} from "./ml.js";
|
||||
import {dotproduct, transpose, matmul, euler_angle_to_rotate_matrix_3by3} from "./util.js"
|
||||
|
||||
|
||||
function BoxOp(){
|
||||
console.log("BoxOp called");
|
||||
this.grow_box_distance_threshold = 0.3;
|
||||
this.init_scale_ratio = {x:2, y:2, z:3};
|
||||
|
||||
this.fit_bottom = function(box)
|
||||
{
|
||||
let bottom = box.world.lidar.findBottom(box, {x:2, y:2, z:3});
|
||||
this.translate_box(box, 'z', bottom + box.scale.z/2);
|
||||
}
|
||||
|
||||
this.fit_top = function(box)
|
||||
{
|
||||
let top = box.world.lidar.findTop(box, {x:1.2, y:1.2, z:2});
|
||||
this.translate_box(box, 'z', top - box.scale.z/2);
|
||||
}
|
||||
|
||||
this.fit_left = function(box)
|
||||
{
|
||||
var extreme = box.world.lidar.grow_box(box, this.grow_box_distance_threshold, this.init_scale_ratio);
|
||||
|
||||
if (extreme){
|
||||
this.translate_box(box, 'y', extreme.max.y - box.scale.y/2);
|
||||
}
|
||||
}
|
||||
|
||||
this.fit_right = function(box)
|
||||
{
|
||||
var extreme = box.world.lidar.grow_box(box, this.grow_box_distance_threshold, this.init_scale_ratio);
|
||||
|
||||
if (extreme){
|
||||
this.translate_box(box, 'y', extreme.min.y + box.scale.y/2);
|
||||
}
|
||||
}
|
||||
|
||||
this.fit_front = function(box)
|
||||
{
|
||||
var extreme = box.world.lidar.grow_box(box, this.grow_box_distance_threshold, this.init_scale_ratio);
|
||||
|
||||
if (extreme){
|
||||
this.translate_box(box, 'x', extreme.max.x - box.scale.x/2);
|
||||
}
|
||||
}
|
||||
|
||||
this.fit_rear = function(box)
|
||||
{
|
||||
var extreme = box.world.lidar.grow_box(box, this.grow_box_distance_threshold, this.init_scale_ratio);
|
||||
|
||||
if (extreme){
|
||||
this.translate_box(box, 'x', extreme.min.x + box.scale.x/2);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
this.fit_size = function(box,axies)
|
||||
{
|
||||
this.grow_box(box, this.grow_box_distance_threshold, {x:2, y:2, z:3}, axies);
|
||||
}
|
||||
|
||||
|
||||
|
||||
this.justifyAutoAdjResult = function(orgBox, box)
|
||||
{
|
||||
let distance = Math.sqrt((box.position.x-orgBox.position.x)*(box.position.x-orgBox.position.x) +
|
||||
(box.position.y-orgBox.position.y)*(box.position.y-orgBox.position.y) +
|
||||
(box.position.z-orgBox.position.z)*(box.position.z-orgBox.position.z));
|
||||
|
||||
if (distance > Math.sqrt(box.scale.x*box.scale.x + box.scale.y*box.scale.y + box.scale.z*box.scale.z))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// if (Math.abs(box.rotation.z - orgBox.rotation.z) > Math.PI/4)
|
||||
// {
|
||||
// return false;
|
||||
// }
|
||||
|
||||
if (box.scale.x > orgBox.scale.x*3 ||
|
||||
box.scale.y > orgBox.scale.y*3 ||
|
||||
box.scale.z > orgBox.scale.z*3)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
this.auto_rotate_xyz= async function(box, callback, apply_mask, on_box_changed, noscaling, rotate_method){
|
||||
|
||||
let orgBox = box;
|
||||
box = {
|
||||
position: {x: box.position.x, y: box.position.y, z: box.position.z},
|
||||
rotation: {x: box.rotation.x, y: box.rotation.y, z: box.rotation.z},
|
||||
scale: {x: box.scale.x, y: box.scale.y, z: box.scale.z},
|
||||
world: box.world,
|
||||
};
|
||||
|
||||
// auto grow
|
||||
// save scale
|
||||
let grow = (box)=>{
|
||||
let org_scale = {
|
||||
x: box.scale.x,
|
||||
y: box.scale.y,
|
||||
z: box.scale.z,
|
||||
};
|
||||
this.grow_box(box, this.grow_box_distance_threshold, {x:2, y:2, z:3});
|
||||
this.auto_shrink_box(box);
|
||||
// now box has been centered.
|
||||
|
||||
let points_indices = box.world.lidar.get_points_of_box(box,1.0).index;
|
||||
let extreme = box.world.lidar.get_dimension_of_points(points_indices, box);
|
||||
// restore scale
|
||||
if (noscaling){
|
||||
box.scale.x = org_scale.x;
|
||||
box.scale.y = org_scale.y;
|
||||
box.scale.z = org_scale.z;
|
||||
}
|
||||
//
|
||||
return extreme;
|
||||
};
|
||||
|
||||
//points is N*3 shape
|
||||
|
||||
let applyRotation = (ret, extreme_after_grow)=>{
|
||||
|
||||
let angle = ret.angle;
|
||||
if (!angle){
|
||||
console.log("prediction not implemented?");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//var points_indices = box.world.get_points_indices_of_box(box);
|
||||
let points_indices = box.world.lidar.get_points_of_box(box,1.0).index;
|
||||
|
||||
var euler_delta = {
|
||||
x: angle[0],
|
||||
y: angle[1],
|
||||
z: angle[2]
|
||||
};
|
||||
|
||||
if (euler_delta.z > Math.PI){
|
||||
euler_delta.z -= Math.PI*2;
|
||||
};
|
||||
|
||||
/*
|
||||
var composite_angel = linalg_std.euler_angle_composite(box.rotation, euler_delta);
|
||||
|
||||
console.log("orig ", box.rotation.x, box.rotation.y, box.rotation.z);
|
||||
console.log("delt ", euler_delta.x, euler_delta.y, euler_delta.z);
|
||||
console.log("comp ", composite_angel.x, composite_angel.y, composite_angel.z);
|
||||
|
||||
box.rotation.x = composite_angel.x;
|
||||
box.rotation.y = composite_angel.y;
|
||||
box.rotation.z = composite_angel.z;
|
||||
*/
|
||||
|
||||
if (apply_mask){
|
||||
if (apply_mask.x)
|
||||
box.rotation.x = euler_delta.x;
|
||||
if (apply_mask.y)
|
||||
box.rotation.y = euler_delta.y;
|
||||
if (apply_mask.z)
|
||||
box.rotation.z = euler_delta.z;
|
||||
}
|
||||
else{
|
||||
box.rotation.x = euler_delta.x;
|
||||
box.rotation.y = euler_delta.y;
|
||||
box.rotation.z = euler_delta.z;
|
||||
}
|
||||
|
||||
|
||||
// rotation set, now rescaling the box
|
||||
// important: should use original points before rotation set
|
||||
var extreme = box.world.lidar.get_dimension_of_points(points_indices, box);
|
||||
|
||||
let auto_adj_dimension = [];
|
||||
|
||||
if (apply_mask){
|
||||
if (apply_mask.x || apply_mask.y)
|
||||
auto_adj_dimension.push('z');
|
||||
|
||||
if (apply_mask.x || apply_mask.z)
|
||||
auto_adj_dimension.push('y');
|
||||
|
||||
if (apply_mask.y || apply_mask.z)
|
||||
auto_adj_dimension.push('x');
|
||||
}
|
||||
else{
|
||||
auto_adj_dimension = ['x','y','z'];
|
||||
}
|
||||
|
||||
if (!noscaling){
|
||||
auto_adj_dimension.forEach((axis)=>{
|
||||
this.translate_box(box, axis, (extreme.max[axis] + extreme.min[axis])/2);
|
||||
box.scale[axis] = extreme.max[axis] - extreme.min[axis];
|
||||
})
|
||||
}else {
|
||||
//anyway, we move the box in a way
|
||||
let trans = euler_angle_to_rotate_matrix_3by3(box.rotation);
|
||||
trans = transpose(trans, 3);
|
||||
|
||||
// compute the relative position of the origin point,that is, the lidar's position
|
||||
// note the origin point is offseted, we need to restore first.
|
||||
let boxpos = box.position;
|
||||
let orgPoint = [
|
||||
- boxpos.x,
|
||||
- boxpos.y,
|
||||
- boxpos.z,
|
||||
];
|
||||
let orgPointInBoxCoord = matmul(trans, orgPoint, 3);
|
||||
let relativePosition = {
|
||||
x: orgPointInBoxCoord[0],
|
||||
y: orgPointInBoxCoord[1],
|
||||
z: 1, //orgPointInBoxCoord[2],
|
||||
}
|
||||
|
||||
if (extreme_after_grow)
|
||||
extreme = extreme_after_grow;
|
||||
|
||||
auto_adj_dimension.forEach((axis)=>{
|
||||
if (relativePosition[axis]>0){
|
||||
//stick to max
|
||||
this.translate_box(box, axis, extreme.max[axis] - box.scale[axis]/2);
|
||||
}else{
|
||||
//stick to min
|
||||
this.translate_box(box, axis, extreme.min[axis] + box.scale[axis]/2);
|
||||
}
|
||||
|
||||
|
||||
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
return box;
|
||||
};
|
||||
|
||||
|
||||
|
||||
let postProc = (box)=>{
|
||||
|
||||
if (this.justifyAutoAdjResult(orgBox, box))
|
||||
{
|
||||
// copy back
|
||||
orgBox.position.x = box.position.x;
|
||||
orgBox.position.y = box.position.y;
|
||||
orgBox.position.z = box.position.z;
|
||||
|
||||
orgBox.rotation.x = box.rotation.x;
|
||||
orgBox.rotation.y = box.rotation.y;
|
||||
orgBox.rotation.z = box.rotation.z;
|
||||
|
||||
orgBox.scale.x = box.scale.x;
|
||||
orgBox.scale.y = box.scale.y;
|
||||
orgBox.scale.z = box.scale.z;
|
||||
}
|
||||
|
||||
if (on_box_changed)
|
||||
on_box_changed(orgBox);
|
||||
|
||||
if (callback){
|
||||
callback();
|
||||
}
|
||||
return orgBox;
|
||||
};
|
||||
|
||||
let extreme_after_grow = grow(box);
|
||||
|
||||
if (!rotate_method){
|
||||
let points = box.world.lidar.get_points_relative_coordinates_of_box_wo_rotation(box, 1);
|
||||
//let points = box.world.get_points_relative_coordinates_of_box(box, 1.0);
|
||||
|
||||
points = points.filter(function(p){
|
||||
return p[2] > - box.scale.z/2 + 0.3;
|
||||
})
|
||||
|
||||
let retBox = await ml.predict_rotation(points)
|
||||
.then(applyRotation)
|
||||
.then(postProc);
|
||||
|
||||
return retBox;
|
||||
}
|
||||
if (rotate_method == "moving-direction")
|
||||
{
|
||||
let estimatedRot = this.estimate_rotation_by_moving_direciton(box);
|
||||
|
||||
applyRotation({
|
||||
angle:[
|
||||
box.rotation.x, // use original rotation
|
||||
box.rotation.y, // use original rotation
|
||||
estimatedRot? estimatedRot.z : box.rotation.z, // use original rotation
|
||||
]
|
||||
},
|
||||
extreme_after_grow);
|
||||
|
||||
postProc(box);
|
||||
return box;
|
||||
}
|
||||
else{ //dont rotate, or null
|
||||
applyRotation({
|
||||
angle:[
|
||||
box.rotation.x, // use original rotation
|
||||
box.rotation.y, // use original rotation
|
||||
box.rotation.z, // use original rotation
|
||||
]
|
||||
},
|
||||
extreme_after_grow);
|
||||
|
||||
postProc(box);
|
||||
return box;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
this.auto_shrink_box= function(box){
|
||||
var extreme = box.world.lidar.get_points_dimmension_of_box(box);
|
||||
|
||||
['x', 'y','z'].forEach((axis)=>{
|
||||
|
||||
this.translate_box(box, axis, (extreme.max[axis] + extreme.min[axis])/2);
|
||||
box.scale[axis] = extreme.max[axis]-extreme.min[axis];
|
||||
})
|
||||
|
||||
};
|
||||
|
||||
|
||||
this.estimate_rotation_by_moving_direciton = function(box)
|
||||
{
|
||||
let prevWorld = box.world.data.findWorld(box.world.frameInfo.scene,
|
||||
box.world.frameInfo.frame_index-1);
|
||||
|
||||
let nextWorld = box.world.data.findWorld(box.world.frameInfo.scene,
|
||||
box.world.frameInfo.frame_index+1);
|
||||
|
||||
let prevBox = prevWorld?prevWorld.annotation.findBoxByTrackId(box.obj_track_id): null;
|
||||
let nextBox = nextWorld?nextWorld.annotation.findBoxByTrackId(box.obj_track_id): null;
|
||||
|
||||
if (prevBox && nextBox)
|
||||
{
|
||||
if ((prevBox.annotator && nextBox.annotator) || (!prevBox.annotator && !nextBox.annotator))
|
||||
{
|
||||
// all annotated by machine or man, it's ok
|
||||
}
|
||||
else
|
||||
{
|
||||
// only one is manually annotated, use this one.
|
||||
if (prevBox.annotator)
|
||||
prevBox = null;
|
||||
|
||||
if (nextBox.annotator)
|
||||
nextBox = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!nextBox && !prevBox){
|
||||
logger.logcolor("red", "Cannot estimate direction: neither previous nor next frame/box loaded/annotated.")
|
||||
return null;
|
||||
}
|
||||
|
||||
let currentP = box.world.lidarPosToUtm(box.position);
|
||||
let nextP = nextBox?nextBox.world.lidarPosToUtm(nextBox.position) : null;
|
||||
let prevP = prevBox?prevBox.world.lidarPosToUtm(prevBox.position) : null;
|
||||
|
||||
if (!prevP)
|
||||
prevP = currentP;
|
||||
|
||||
if (!nextP)
|
||||
nextP = currentP;
|
||||
|
||||
let azimuth = Math.atan2(nextP.y-prevP.y, nextP.x-prevP.x)
|
||||
|
||||
let estimatedRot = box.world.utmRotToLidar(new THREE.Euler(0,0,azimuth, "XYZ"));
|
||||
|
||||
return estimatedRot;
|
||||
};
|
||||
|
||||
this.grow_box= function(box, min_distance, init_scale_ratio, axies){
|
||||
|
||||
if (!axies)
|
||||
{
|
||||
axies = ['x','y','z'];
|
||||
}
|
||||
|
||||
|
||||
var extreme = box.world.lidar.grow_box(box, min_distance, init_scale_ratio);
|
||||
|
||||
if (extreme){
|
||||
|
||||
axies.forEach((axis)=>{
|
||||
this.translate_box(box, axis, (extreme.max[axis] + extreme.min[axis])/2);
|
||||
box.scale[axis] = extreme.max[axis] - extreme.min[axis];
|
||||
})
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
this.change_rotation_y = function(box, theta, sticky, on_box_changed){
|
||||
//box.rotation.x += theta;
|
||||
//on_box_changed(box);
|
||||
|
||||
var points_indices = box.world.lidar.get_points_indices_of_box(box);
|
||||
|
||||
var _tempQuaternion = new Quaternion();
|
||||
var rotationAxis = new Vector3(0, 1, 0);
|
||||
|
||||
// NOTE: the front/end subview is different from top/side view, that we look at the reverse direction of y-axis
|
||||
// it's end view acturally.
|
||||
// we could project front-view, but the translation (left, right) will be in reverse direction of top view.
|
||||
/// that would be frustrating.
|
||||
box.quaternion.multiply( _tempQuaternion.setFromAxisAngle( rotationAxis, -theta ) ).normalize();
|
||||
|
||||
if (sticky){
|
||||
var extreme = box.world.lidar.get_dimension_of_points(points_indices, box);
|
||||
|
||||
['x','z'].forEach((axis)=>{
|
||||
|
||||
this.translate_box(box, axis, (extreme.max[axis] + extreme.min[axis])/2);
|
||||
box.scale[axis] = extreme.max[axis] - extreme.min[axis];
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
if (on_box_changed)
|
||||
on_box_changed(box);
|
||||
}
|
||||
|
||||
|
||||
this.auto_rotate_y=function(box, on_box_changed){
|
||||
let points = box.world.lidar.get_points_of_box(box, 2.0);
|
||||
|
||||
// 1. find surounding points
|
||||
var side_indices = []
|
||||
var side_points = []
|
||||
points.position.forEach(function(p, i){
|
||||
if ((p[0] > box.scale.x/2 || p[0] < -box.scale.x/2) && (p[1] < box.scale.y/2 && p[1] > -box.scale.y/2)){
|
||||
side_indices.push(points.index[i]);
|
||||
side_points.push(points.position[i]);
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
var end_indices = []
|
||||
var end_points = []
|
||||
points.position.forEach(function(p, i){
|
||||
if ((p[0] < box.scale.x/2 && p[0] > -box.scale.x/2) && (p[1] > box.scale.y/2 || p[1] < -box.scale.y/2)){
|
||||
end_indices.push(points.index[i]);
|
||||
end_points.push(points.position[i]);
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
// 2. grid by 0.3 by 0.3
|
||||
|
||||
// compute slope (derivative)
|
||||
// for side part (pitch/tilt), use y,z axis
|
||||
// for end part (row), use x, z axis
|
||||
|
||||
|
||||
|
||||
// box.world.lidar.set_spec_points_color(side_indices, {x:1,y:0,z:0});
|
||||
// box.world.lidar.set_spec_points_color(end_indices, {x:0,y:0,z:1});
|
||||
// box.world.lidar.update_points_color();
|
||||
|
||||
var x = end_points.map(function(x){return x[0]});
|
||||
//var y = side_points.map(function(x){return x[1]});
|
||||
var z = end_points.map(function(x){return x[2]});
|
||||
var z_mean = z.reduce(function(x,y){return x+y;}, 0)/z.length;
|
||||
var z = z.map(function(x){return x-z_mean;});
|
||||
var theta = Math.atan2(dotproduct(x,z), dotproduct(x,x));
|
||||
console.log(theta);
|
||||
|
||||
this.change_rotation_y(box, theta, false, on_box_changed);
|
||||
}
|
||||
|
||||
|
||||
|
||||
this.change_rotation_x=function(box, theta, sticky, on_box_changed){
|
||||
var points_indices = box.world.lidar.get_points_indices_of_box(box);
|
||||
|
||||
//box.rotation.x += theta;
|
||||
//on_box_changed(box);
|
||||
var _tempQuaternion = new Quaternion();
|
||||
var rotationAxis = new Vector3(1,0,0);
|
||||
box.quaternion.multiply( _tempQuaternion.setFromAxisAngle( rotationAxis, theta ) ).normalize();
|
||||
|
||||
if (sticky){
|
||||
var extreme = box.world.lidar.get_dimension_of_points(points_indices, box);
|
||||
|
||||
['y','z'].forEach((axis)=>{
|
||||
|
||||
this.translate_box(box, axis, (extreme.max[axis] + extreme.min[axis])/2);
|
||||
box.scale[axis] = extreme.max[axis] - extreme.min[axis];
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
if (on_box_changed)
|
||||
on_box_changed(box);
|
||||
|
||||
};
|
||||
|
||||
|
||||
this.auto_rotate_x=function(box, on_box_changed){
|
||||
console.log("x auto ratote");
|
||||
|
||||
let points = box.world.lidar.get_points_of_box(box, 2.0);
|
||||
|
||||
// 1. find surounding points
|
||||
var side_indices = []
|
||||
var side_points = []
|
||||
points.position.forEach(function(p, i){
|
||||
if ((p[0] > box.scale.x/2 || p[0] < -box.scale.x/2) && (p[1] < box.scale.y/2 && p[1] > -box.scale.y/2)){
|
||||
side_indices.push(points.index[i]);
|
||||
side_points.push(points.position[i]);
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
var end_indices = []
|
||||
var end_points = []
|
||||
points.position.forEach(function(p, i){
|
||||
if ((p[0] < box.scale.x/2 && p[0] > -box.scale.x/2) && (p[1] > box.scale.y/2 || p[1] < -box.scale.y/2)){
|
||||
end_indices.push(points.index[i]);
|
||||
end_points.push(points.position[i]);
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
// 2. grid by 0.3 by 0.3
|
||||
|
||||
// compute slope (derivative)
|
||||
// for side part (pitch/tilt), use y,z axis
|
||||
// for end part (row), use x, z axis
|
||||
|
||||
|
||||
|
||||
// box.world.lidar.set_spec_points_color(side_indices, {x:1,y:0,z:0});
|
||||
// box.world.lidar.set_spec_points_color(end_indices, {x:0,y:0,z:1});
|
||||
// box.world.lidar.update_points_color();
|
||||
//render();
|
||||
|
||||
var x = side_points.map(function(x){return x[0]});
|
||||
var y = side_points.map(function(x){return x[1]});
|
||||
var z = side_points.map(function(x){return x[2]});
|
||||
var z_mean = z.reduce(function(x,y){return x+y;}, 0)/z.length;
|
||||
var z = z.map(function(x){return x-z_mean;});
|
||||
var theta = Math.atan2(dotproduct(y,z), dotproduct(y,y));
|
||||
console.log(theta);
|
||||
|
||||
this.change_rotation_x(box, theta, false, on_box_changed);
|
||||
};
|
||||
|
||||
|
||||
this.translate_box=function(box, axis, delta){
|
||||
let t = {x:0, y:0, z:0};
|
||||
|
||||
t[axis] = delta;
|
||||
|
||||
// switch (axis){
|
||||
// case 'x':
|
||||
|
||||
// box.position.x += delta*Math.cos(box.rotation.z);
|
||||
// box.position.y += delta*Math.sin(box.rotation.z);
|
||||
// break;
|
||||
// case 'y':
|
||||
// box.position.x += delta*Math.cos(Math.PI/2 + box.rotation.z);
|
||||
// box.position.y += delta*Math.sin(Math.PI/2 + box.rotation.z);
|
||||
// break;
|
||||
// case 'z':
|
||||
// box.position.z += delta;
|
||||
// break;
|
||||
|
||||
// }
|
||||
|
||||
let trans = this.translateBoxInBoxCoord(box.rotation, t);
|
||||
box.position.x += trans.x;
|
||||
box.position.y += trans.y;
|
||||
box.position.z += trans.z;
|
||||
|
||||
};
|
||||
|
||||
this.translateBoxInBoxCoord = function(rotation, t)
|
||||
{
|
||||
// euler
|
||||
let euler = new THREE.Euler(rotation.x, rotation.y, rotation.z, "XYZ")
|
||||
|
||||
let trans = new THREE.Vector3(t.x, t.y, t.z).applyEuler(euler);
|
||||
|
||||
return trans;
|
||||
};
|
||||
|
||||
this.rotate_z=function(box, theta, sticky){
|
||||
// points indices shall be obtained before rotation.
|
||||
var points_indices = box.world.lidar.get_points_indices_of_box(box);
|
||||
|
||||
|
||||
var _tempQuaternion = new Quaternion();
|
||||
var rotationAxis = new Vector3(0,0,1);
|
||||
box.quaternion.multiply( _tempQuaternion.setFromAxisAngle( rotationAxis, theta ) ).normalize();
|
||||
|
||||
if (sticky){
|
||||
|
||||
var extreme = box.world.lidar.get_dimension_of_points(points_indices, box);
|
||||
|
||||
['x','y'].forEach((axis)=>{
|
||||
|
||||
this.translate_box(box, axis, (extreme.max[axis] + extreme.min[axis])/2);
|
||||
box.scale[axis] = extreme.max[axis] - extreme.min[axis];
|
||||
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
|
||||
this.interpolate_selected_object= function(sceneName, objTrackId, currentFrame, done){
|
||||
|
||||
// var xhr = new XMLHttpRequest();
|
||||
// // we defined the xhr
|
||||
|
||||
// xhr.onreadystatechange = function () {
|
||||
// if (this.readyState != 4)
|
||||
// return;
|
||||
|
||||
// if (this.status == 200) {
|
||||
// var ret = JSON.parse(this.responseText);
|
||||
// console.log(ret);
|
||||
|
||||
// if (done)
|
||||
// done(sceneName, ret);
|
||||
// }
|
||||
|
||||
// };
|
||||
|
||||
// xhr.open('GET', "/interpolate?scene="+sceneName+"&frame="+currentFrame+"&obj_id="+objTrackId, true);
|
||||
// xhr.send();
|
||||
};
|
||||
|
||||
this.highlightBox = function(box){
|
||||
if (box){
|
||||
box.material.color.r=1;
|
||||
box.material.color.g=0;
|
||||
box.material.color.b=1;
|
||||
box.material.opacity=1;
|
||||
}
|
||||
};
|
||||
|
||||
this.unhighlightBox = function(box){
|
||||
if (box){
|
||||
// box.material.color = new THREE.Color(parseInt("0x"+get_obj_cfg_by_type(box.obj_type).color.slice(1)));
|
||||
|
||||
// box.material.opacity = box.world.data.cfg.box_opacity;
|
||||
|
||||
box.world.annotation.color_box(box);
|
||||
}
|
||||
}
|
||||
|
||||
this.interpolateAsync = async function(worldList, boxList, applyIndList){
|
||||
|
||||
// if annotator is not null, it's annotated by us algorithms
|
||||
let anns = boxList.map(b=> (!b || b.annotator)? null : b.world.annotation.ann_to_vector_global(b));
|
||||
console.log(anns);
|
||||
let ret = await ml.interpolate_annotation(anns);
|
||||
console.log(ret);
|
||||
|
||||
let refObj = boxList.find(b=>!!b);
|
||||
let obj_type = refObj.obj_type;
|
||||
let obj_track_id = refObj.obj_track_id;
|
||||
let obj_attr = refObj.obj_attr;
|
||||
|
||||
for (let i = 0; i< boxList.length; i++){
|
||||
if (!applyIndList[i])
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
let world = worldList[i];
|
||||
let ann = world.annotation.vector_global_to_ann(ret[i]);
|
||||
|
||||
// don't roate x/y
|
||||
if (!pointsGlobalConfig.enableAutoRotateXY)
|
||||
{
|
||||
ann.rotation.x = 0;
|
||||
ann.rotation.y = 0;
|
||||
}
|
||||
|
||||
|
||||
// if (world.lidar.get_box_points_number(ann) == 0)
|
||||
// {
|
||||
// continue;
|
||||
// }
|
||||
|
||||
|
||||
if (!boxList[i]){
|
||||
// create new box
|
||||
let newBox = world.annotation.add_box(ann.position,
|
||||
ann.scale,
|
||||
ann.rotation,
|
||||
obj_type,
|
||||
obj_track_id,
|
||||
obj_attr);
|
||||
newBox.annotator="i";
|
||||
world.annotation.load_box(newBox);
|
||||
world.annotation.setModified();
|
||||
|
||||
} else if (boxList[i].annotator) {
|
||||
// modify box attributes
|
||||
let b = ann;
|
||||
|
||||
boxList[i].position.x = b.position.x;
|
||||
boxList[i].position.y = b.position.y;
|
||||
boxList[i].position.z = b.position.z;
|
||||
|
||||
boxList[i].scale.x = b.scale.x;
|
||||
boxList[i].scale.y = b.scale.y;
|
||||
boxList[i].scale.z = b.scale.z;
|
||||
|
||||
boxList[i].rotation.x = b.rotation.x;
|
||||
boxList[i].rotation.y = b.rotation.y;
|
||||
boxList[i].rotation.z = b.rotation.z;
|
||||
|
||||
boxList[i].annotator = "i";
|
||||
|
||||
boxList[i].world.annotation.setModified();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
this.interpolateAndAutoAdjustAsync = async function(worldList, boxList, onFinishOneBoxCB, applyIndList, dontRotate){
|
||||
|
||||
|
||||
// if annotator is not null, it's annotated by us algorithms
|
||||
let anns = boxList.map((b,i)=> {
|
||||
|
||||
if (!b)
|
||||
return null;
|
||||
|
||||
if (b.annotator)
|
||||
return null;
|
||||
|
||||
return b.world.annotation.ann_to_vector_global(b);
|
||||
});
|
||||
|
||||
console.log("anns to interpolate", anns);
|
||||
|
||||
let autoAdjAsync = async (index, newAnn)=>{
|
||||
//let box = boxList[index];
|
||||
let world = worldList[index];
|
||||
|
||||
let tempBox = world.annotation.vector_global_to_ann(newAnn);
|
||||
tempBox.world = world;
|
||||
|
||||
// autoadj is timecomsuming
|
||||
// jump this step
|
||||
let rotateThis = dontRotate;
|
||||
if (!applyIndList[index]){
|
||||
rotateThis = "dontrotate";
|
||||
}
|
||||
|
||||
let adjustedBox = await this.auto_rotate_xyz(tempBox, null, null, null, true, rotateThis);
|
||||
return world.annotation.ann_to_vector_global(adjustedBox);
|
||||
};
|
||||
|
||||
|
||||
let refObj = boxList.find(b=>!!b);
|
||||
let obj_type = refObj.obj_type;
|
||||
let obj_track_id = refObj.obj_track_id;
|
||||
let obj_attr = refObj.obj_attr;
|
||||
|
||||
let onFinishOneBox= (index)=>{
|
||||
console.log(`auto insert ${index} ${worldList[index].frameInfo.frame}done`);
|
||||
let i = index;
|
||||
|
||||
if (!applyIndList[i]){
|
||||
return;
|
||||
}
|
||||
|
||||
if (!boxList[i]){
|
||||
// create new box
|
||||
let world = worldList[i];
|
||||
let ann = world.annotation.vector_global_to_ann(anns[i]);
|
||||
|
||||
let newBox = world.annotation.add_box(ann.position,
|
||||
ann.scale,
|
||||
ann.rotation,
|
||||
obj_type,
|
||||
obj_track_id,
|
||||
obj_attr);
|
||||
newBox.annotator="a";
|
||||
world.annotation.load_box(newBox);
|
||||
|
||||
} else if (boxList[i].annotator) {
|
||||
// modify box attributes
|
||||
let b = boxList[i].world.annotation.vector_global_to_ann(anns[i]);
|
||||
boxList[i].position.x = b.position.x;
|
||||
boxList[i].position.y = b.position.y;
|
||||
boxList[i].position.z = b.position.z;
|
||||
|
||||
boxList[i].scale.x = b.scale.x;
|
||||
boxList[i].scale.y = b.scale.y;
|
||||
boxList[i].scale.z = b.scale.z;
|
||||
|
||||
boxList[i].rotation.x = b.rotation.x;
|
||||
boxList[i].rotation.y = b.rotation.y;
|
||||
boxList[i].rotation.z = b.rotation.z;
|
||||
|
||||
boxList[i].annotator="a";
|
||||
}
|
||||
|
||||
if (onFinishOneBoxCB)
|
||||
onFinishOneBoxCB(i);
|
||||
};
|
||||
|
||||
let ret = await ml.interpolate_annotation(anns, autoAdjAsync, onFinishOneBox);
|
||||
console.log(ret);
|
||||
|
||||
// for (let i = 0; i< boxList.length; i++){
|
||||
// onFinishOneBox(i);
|
||||
// }
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
export {BoxOp}
|
||||
@ -0,0 +1,196 @@
|
||||
|
||||
import {rotation_matrix_to_euler_angle,euler_angle_to_rotate_matrix, matmul, transpose} from "./util.js"
|
||||
//import {render_2d_image, update_image_box_projection} from "./image.js"
|
||||
|
||||
function Calib(data, editor){
|
||||
this.data = data;
|
||||
this.editor = editor;
|
||||
|
||||
var euler_angle={x:0, y:0, y:0};
|
||||
var translate = {x:0, y:0, z:0};
|
||||
|
||||
this.save_calibration = function(){
|
||||
|
||||
|
||||
var scene_meta = data.meta[data.world.frameInfo.scene];
|
||||
|
||||
|
||||
var active_camera_name = data.world.cameras.active_name;
|
||||
var calib = scene_meta.calib.camera[active_camera_name]
|
||||
|
||||
var extrinsic = calib.extrinsic.map(function(x){return x*1.0;});
|
||||
|
||||
euler_angle = rotation_matrix_to_euler_angle(extrinsic);
|
||||
translate = {
|
||||
x: extrinsic[3]*1.0,
|
||||
y: extrinsic[7]*1.0,
|
||||
z: extrinsic[11]*1.0,
|
||||
};
|
||||
|
||||
|
||||
console.log(extrinsic, euler_angle, translate);
|
||||
|
||||
let matrix = euler_angle_to_rotate_matrix(euler_angle, translate)
|
||||
console.log("restoreed matrix",matrix);
|
||||
|
||||
|
||||
this.editor.infoBox.show("calib", JSON.stringify(matrix));
|
||||
}
|
||||
|
||||
this.reset_calibration = function(){
|
||||
// to be done
|
||||
this.editor.imageContextManager.render_2d_image();
|
||||
}
|
||||
|
||||
this.calib_box = null;
|
||||
|
||||
this.show_camera_pos = function(){
|
||||
this.editor.viewManager.mainView.dumpPose();
|
||||
};
|
||||
|
||||
|
||||
// show a manipulating box
|
||||
this.start_calibration = function(){
|
||||
var scene_meta = this.data.meta[data.world.frameInfo.scene];
|
||||
|
||||
var active_camera_name = this.data.world.cameras.active_name;
|
||||
var calib = scene_meta.calib.camera[active_camera_name]
|
||||
var extrinsic = calib.extrinsic.map(function(x){return x*1.0;});
|
||||
let viewMatrix = [0, -1, 0, 0, //row vector
|
||||
0, 0, -1, 0,
|
||||
1, 0, 0, 0,
|
||||
0, 0, 0, 1];
|
||||
function transpose_transmatrix(m){
|
||||
//m=4*4
|
||||
return [
|
||||
m[0],m[4],m[8],m[3],
|
||||
m[1],m[5],m[9],m[7],
|
||||
m[2],m[6],m[10],m[11],
|
||||
m[12],m[13],m[14],m[15],
|
||||
|
||||
];
|
||||
}
|
||||
|
||||
var op_matrix = matmul (transpose_transmatrix(viewMatrix),
|
||||
transpose_transmatrix(extrinsic), 4);
|
||||
|
||||
var euler_angle = rotation_matrix_to_euler_angle(op_matrix);
|
||||
var translate = {
|
||||
x: extrinsic[3]*1.0,
|
||||
y: extrinsic[7]*1.0,
|
||||
z: extrinsic[11]*1.0,
|
||||
};
|
||||
|
||||
console.log(euler_angle, translate);
|
||||
this.show_camera_pos();
|
||||
|
||||
|
||||
if (!this.calib_box)
|
||||
{
|
||||
this.calib_box = this.data.world.annotation.createCuboid(
|
||||
{
|
||||
x: translate.x,// + this.data.world.coordinatesOffset[0],
|
||||
y: translate.y,// + this.data.world.coordinatesOffset[1],
|
||||
z: translate.z, // + this.data.world.coordinatesOffset[2]
|
||||
},
|
||||
{x:1,y:1, z:1},
|
||||
{
|
||||
x: euler_angle.x,
|
||||
y: euler_angle.y,
|
||||
z: euler_angle.z
|
||||
},
|
||||
"camera",
|
||||
"camera"
|
||||
);
|
||||
|
||||
this.data.world.scene.add(this.calib_box);
|
||||
|
||||
}
|
||||
else{
|
||||
console.log("calib box exists.");
|
||||
this.calib_box.position.x = translate.x;// + this.data.world.coordinatesOffset[0];
|
||||
this.calib_box.position.y = translate.y;// + this.data.world.coordinatesOffset[1];
|
||||
this.calib_box.position.z = translate.z;// + this.data.world.coordinatesOffset[2];
|
||||
|
||||
this.calib_box.rotation.x = euler_angle.x;
|
||||
this.calib_box.rotation.y = euler_angle.y;
|
||||
this.calib_box.rotation.z = euler_angle.z;
|
||||
}
|
||||
|
||||
console.log(this.calib_box);
|
||||
this.editor.render();
|
||||
|
||||
|
||||
this.calib_box.on_box_changed = ()=>{
|
||||
console.log("calib box changed.");
|
||||
|
||||
let real_pos = {
|
||||
x: this.calib_box.position.x,// - this.data.world.coordinatesOffset[0],
|
||||
y: this.calib_box.position.y,// - this.data.world.coordinatesOffset[1],
|
||||
z: this.calib_box.position.z,// - this.data.world.coordinatesOffset[2],
|
||||
};
|
||||
|
||||
let extrinsic = euler_angle_to_rotate_matrix(this.calib_box.rotation, real_pos);
|
||||
calib.extrinsic = transpose_transmatrix(matmul (viewMatrix, extrinsic, 4));
|
||||
console.log("extrinsic", calib.extrinsic)
|
||||
console.log("euler", euler_angle, "translate", translate);
|
||||
|
||||
this.editor.imageContextManager.render_2d_image();
|
||||
}
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
function stop_calibration()
|
||||
{
|
||||
//tbd
|
||||
};
|
||||
|
||||
/*
|
||||
function calibrate(ax, value){
|
||||
var scene_meta = data.meta[data.world.frameInfo.scene];
|
||||
|
||||
var active_camera_name = data.world.cameras.active_name;
|
||||
var calib = scene_meta.calib.camera[active_camera_name]
|
||||
var extrinsic = calib.extrinsic.map(function(x){return x*1.0;});
|
||||
|
||||
var euler_angle = rotation_matrix_to_euler_angle(extrinsic);
|
||||
var translate = {
|
||||
x: extrinsic[3]*1.0,
|
||||
y: extrinsic[7]*1.0,
|
||||
z: extrinsic[11]*1.0,
|
||||
};
|
||||
|
||||
if (ax == 'z'){
|
||||
euler_angle.z += value;
|
||||
}else if (ax == 'x'){
|
||||
euler_angle.x += value;
|
||||
}
|
||||
else if (ax == 'y'){
|
||||
euler_angle.y += value;
|
||||
}else if (ax == 'tz'){
|
||||
translate.z += value;
|
||||
}else if (ax == 'tx'){
|
||||
translate.x += value;
|
||||
}
|
||||
else if (ax == 'ty'){
|
||||
translate.y += value;
|
||||
}
|
||||
|
||||
calib.extrinsic = euler_angle_to_rotate_matrix(euler_angle, translate);
|
||||
|
||||
console.log("extrinsic", calib.extrinsic)
|
||||
console.log("euler", euler_angle, "translate", translate);
|
||||
|
||||
render_2d_image();
|
||||
|
||||
if (selected_box)
|
||||
update_image_box_projection(selected_box);
|
||||
}
|
||||
*/
|
||||
|
||||
};
|
||||
|
||||
|
||||
export {Calib}
|
||||
@ -0,0 +1,121 @@
|
||||
|
||||
class Config{
|
||||
|
||||
//dataCfg = {
|
||||
|
||||
//disableLabels: true,
|
||||
enablePreload = true;
|
||||
color_points = "mono";
|
||||
enableRadar = false;
|
||||
enableAuxLidar = false;
|
||||
enableDynamicGroundLevel = true;
|
||||
|
||||
coordinateSystem = 'utm';
|
||||
|
||||
point_size = 1;
|
||||
point_brightness = 0.6;
|
||||
box_opacity = 1;
|
||||
show_background = true;
|
||||
color_obj = "category";
|
||||
theme = "dark";
|
||||
|
||||
enableFilterPoints = false;
|
||||
filterPointsZ = 2.0;
|
||||
|
||||
batchModeInstNumber = 20;
|
||||
batchModeSubviewSize = {width: 130, height: 450};
|
||||
|
||||
|
||||
// edit on one box, apply to all selected boxes.
|
||||
linkEditorsInBatchMode = false;
|
||||
|
||||
// only rotate z in 'auto/interpolate' algs
|
||||
enableAutoRotateXY = false;
|
||||
autoSave = true;
|
||||
|
||||
autoUpdateInterpolatedBoxes = true;
|
||||
|
||||
hideId = false;
|
||||
hideCategory = false;
|
||||
|
||||
moveStep = 0.01; // ratio, percentage
|
||||
rotateStep = Math.PI/360;
|
||||
|
||||
ignoreDistantObject = true;
|
||||
|
||||
///editorCfg
|
||||
|
||||
//disableSceneSelector = true;
|
||||
//disableFrameSelector = true;
|
||||
//disableCameraSelector = true;
|
||||
//disableFastToolbox= true;
|
||||
//disableMainView= true;
|
||||
//disableMainImageContext = true;
|
||||
//disableGrid = true;
|
||||
//disableRangeCircle = true;
|
||||
//disableAxis = true;
|
||||
//disableMainViewKeyDown = true;
|
||||
//projectRadarToImage = true;
|
||||
//projectLidarToImage = true;
|
||||
|
||||
constructor()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
readItem(name, defaultValue, castFunc){
|
||||
let ret = window.localStorage.getItem(name);
|
||||
|
||||
if (ret)
|
||||
{
|
||||
if (castFunc)
|
||||
return castFunc(ret);
|
||||
else
|
||||
return ret;
|
||||
}
|
||||
else
|
||||
{
|
||||
return defaultValue;
|
||||
}
|
||||
}
|
||||
|
||||
setItem(name, value)
|
||||
{
|
||||
this[name] = value;
|
||||
if (typeof value == 'object')
|
||||
value = JSON.stringify(value);
|
||||
window.localStorage.setItem(name, value);
|
||||
}
|
||||
|
||||
toBool(v)
|
||||
{
|
||||
return v==="true";
|
||||
}
|
||||
|
||||
saveItems = [
|
||||
["theme", null],
|
||||
["enableRadar", this.toBool],
|
||||
["enablePreload", this.toBool],
|
||||
["enableAuxLidar", this.toBool],
|
||||
["enableFilterPoints", this.toBool],
|
||||
["filterPointsZ", parseFloat],
|
||||
["color_points", null],
|
||||
["coordinateSystem", null],
|
||||
["batchModeInstNumber", parseInt],
|
||||
["batchModeSubviewSize", JSON.parse],
|
||||
["enableAutoRotateXY", this.toBool],
|
||||
["autoUpdateInterpolatedBoxes", this.toBool],
|
||||
];
|
||||
|
||||
load()
|
||||
{
|
||||
this.saveItems.forEach(item=>{
|
||||
let key = item[0];
|
||||
let castFunc = item[1];
|
||||
|
||||
this[key] = this.readItem(key, this[key], castFunc);
|
||||
})
|
||||
}
|
||||
};
|
||||
|
||||
export {Config};
|
||||
@ -0,0 +1,347 @@
|
||||
import { globalKeyDownManager } from "./keydown_manager.js";
|
||||
import {logger} from "./log.js";
|
||||
|
||||
class ConfigUi{
|
||||
|
||||
clickableItems = {
|
||||
"#cfg-increase-size": (event)=>{
|
||||
this.editor.data.scale_point_size(1.2);
|
||||
this.editor.render();
|
||||
this.editor.boxEditorManager.render();
|
||||
return false;
|
||||
},
|
||||
|
||||
"#cfg-decrease-size": (event)=>{
|
||||
this.editor.data.scale_point_size(0.8);
|
||||
this.editor.render();
|
||||
this.editor.boxEditorManager.render();
|
||||
return false;
|
||||
},
|
||||
|
||||
"#cfg-increase-brightness": (event)=>{
|
||||
this.editor.data.scale_point_brightness(1.2);
|
||||
this.editor.render();
|
||||
this.editor.boxEditorManager.render();
|
||||
return false;
|
||||
},
|
||||
|
||||
"#cfg-decrease-brightness": (event)=>{
|
||||
this.editor.data.scale_point_brightness(0.8);
|
||||
this.editor.render();
|
||||
this.editor.boxEditorManager.render();
|
||||
return false;
|
||||
},
|
||||
|
||||
"#cfg-take-screenshot": (event)=>{
|
||||
this.editor.downloadWebglScreenShot();
|
||||
return true;
|
||||
},
|
||||
|
||||
"#cfg-show-log": (event)=>{
|
||||
logger.show();
|
||||
return true;
|
||||
},
|
||||
|
||||
"#cfg-start-calib":(event)=>{
|
||||
this.editor.calib.start_calibration();
|
||||
return true;
|
||||
},
|
||||
|
||||
"#cfg-show-calib":(event)=>{
|
||||
this.editor.calib.save_calibration();
|
||||
return true;
|
||||
},
|
||||
|
||||
// "#cfg-reset-calib":(event)=>{
|
||||
// this.editor.calib.reset_calibration();
|
||||
// return true;
|
||||
// }
|
||||
|
||||
"#cfg-crop-scene": (event)=>{
|
||||
this.editor.cropScene.show();
|
||||
|
||||
return true;
|
||||
},
|
||||
|
||||
};
|
||||
|
||||
changeableItems = {
|
||||
|
||||
"#cfg-theme-select":(event)=>{
|
||||
let theme = event.currentTarget.value;
|
||||
|
||||
//let scheme = document.documentElement.className;
|
||||
|
||||
|
||||
document.documentElement.className = "theme-"+theme;
|
||||
|
||||
pointsGlobalConfig.setItem("theme", theme);
|
||||
|
||||
this.editor.viewManager.setColorScheme();
|
||||
this.editor.render();
|
||||
this.editor.boxEditorManager.render();
|
||||
|
||||
return false;
|
||||
},
|
||||
|
||||
"#cfg-hide-box-checkbox":(event)=>{
|
||||
let checked = event.currentTarget.checked;
|
||||
|
||||
//let scheme = document.documentElement.className;
|
||||
|
||||
if (checked)
|
||||
this.editor.data.set_box_opacity(0);
|
||||
else
|
||||
this.editor.data.set_box_opacity(1);
|
||||
|
||||
this.editor.render();
|
||||
this.editor.boxEditorManager.render();
|
||||
|
||||
|
||||
return false;
|
||||
},
|
||||
|
||||
|
||||
"#cfg-hide-id-checkbox":(event)=>{
|
||||
let checked = event.currentTarget.checked;
|
||||
this.editor.floatLabelManager.show_id(!checked);
|
||||
return false;
|
||||
},
|
||||
|
||||
|
||||
|
||||
"#cfg-hide-category-checkbox":(event)=>{
|
||||
let checked = event.currentTarget.checked;
|
||||
this.editor.floatLabelManager.show_category(!checked);
|
||||
return false;
|
||||
},
|
||||
|
||||
"#cfg-hide-circle-ruler-checkbox": (event)=>{
|
||||
let checked = event.currentTarget.checked;
|
||||
this.editor.showRangeCircle(!checked);
|
||||
return false;
|
||||
},
|
||||
|
||||
"#cfg-auto-rotate-xy-checkbox": (event)=>{
|
||||
let checked = event.currentTarget.checked;
|
||||
pointsGlobalConfig.setItem("enableAutoRotateXY", checked);
|
||||
return false;
|
||||
},
|
||||
|
||||
'#cfg-auto-update-interpolated-boxes-checkbox': (event)=>{
|
||||
let checked = event.currentTarget.checked;
|
||||
pointsGlobalConfig.setItem("autoUpdateInterpolatedBoxes", checked);
|
||||
return false;
|
||||
},
|
||||
|
||||
"#cfg-color-points-select": (event)=>{
|
||||
let value = event.currentTarget.value;
|
||||
pointsGlobalConfig.setItem("color_points", value);
|
||||
|
||||
this.editor.data.worldList.forEach(w=>{
|
||||
w.lidar.color_points();
|
||||
w.lidar.update_points_color();
|
||||
});
|
||||
this.editor.render();
|
||||
return false;
|
||||
},
|
||||
|
||||
"#cfg-color-object-scheme":(event)=>{
|
||||
let value = event.currentTarget.value;
|
||||
this.editor.data.set_obj_color_scheme(value);
|
||||
this.editor.render();
|
||||
this.editor.imageContextManager.render_2d_image();
|
||||
|
||||
this.editor.floatLabelManager.set_color_scheme(value);
|
||||
this.editor.render2dLabels(this.editor.data.world);
|
||||
this.editor.boxEditorManager.render();
|
||||
|
||||
return false;
|
||||
},
|
||||
|
||||
"#cfg-batch-mode-inst-number":(event)=>{
|
||||
let batchSize = parseInt(event.currentTarget.value);
|
||||
|
||||
pointsGlobalConfig.setItem("batchModeInstNumber", batchSize);
|
||||
|
||||
this.editor.boxEditorManager.setBatchSize(batchSize);
|
||||
return false;
|
||||
},
|
||||
|
||||
"#cfg-coordinate-system-select": (event)=>{
|
||||
let coord = event.currentTarget.value;
|
||||
pointsGlobalConfig.setItem("coordinateSystem", coord);
|
||||
|
||||
this.editor.data.worldList.forEach(w=>{
|
||||
w.calcTransformMatrix();
|
||||
});
|
||||
this.editor.render();
|
||||
},
|
||||
|
||||
"#cfg-data-aux-lidar-checkbox": (event)=>{
|
||||
let checked = event.currentTarget.checked;
|
||||
|
||||
pointsGlobalConfig.setItem("enableAuxLidar", checked);
|
||||
return false;
|
||||
},
|
||||
|
||||
"#cfg-data-radar-checkbox": (event)=>{
|
||||
let checked = event.currentTarget.checked;
|
||||
|
||||
pointsGlobalConfig.setItem("enableRadar", checked);
|
||||
return false;
|
||||
},
|
||||
|
||||
"#cfg-data-filter-points-checkbox": (event)=>{
|
||||
let checked = event.currentTarget.checked;
|
||||
|
||||
pointsGlobalConfig.setItem("enableFilterPoints", checked);
|
||||
return false;
|
||||
},
|
||||
|
||||
"#cfg-data-filter-points-z": (event)=>{
|
||||
let z = event.currentTarget.value;
|
||||
|
||||
pointsGlobalConfig.setItem("filterPointsZ", z);
|
||||
return false;
|
||||
},
|
||||
|
||||
|
||||
"#cfg-data-preload-checkbox": (event)=>{
|
||||
let checked = event.currentTarget.checked;
|
||||
pointsGlobalConfig.setItem("enablePreload", checked);
|
||||
return false;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
ignoreItems = [
|
||||
"#cfg-point-size",
|
||||
"#cfg-point-brightness",
|
||||
"#cfg-theme",
|
||||
"#cfg-color-object",
|
||||
"#cfg-menu-batch-mode-inst-number",
|
||||
"#cfg-hide-box",
|
||||
"#cfg-calib-camera-LiDAR",
|
||||
"#cfg-experimental",
|
||||
"#cfg-data",
|
||||
];
|
||||
|
||||
subMenus = [
|
||||
"#cfg-experimental",
|
||||
"#cfg-data",
|
||||
];
|
||||
|
||||
constructor(button, wrapper, editor)
|
||||
{
|
||||
this.button = button;
|
||||
this.wrapper = wrapper;
|
||||
this.editor = editor;
|
||||
this.editorCfg = editor.editorCfg;
|
||||
this.dataCfg = editor.data.cfg;
|
||||
this.menu = this.wrapper.querySelector("#config-menu");
|
||||
|
||||
this.wrapper.onclick = ()=>{
|
||||
this.hide();
|
||||
}
|
||||
|
||||
this.button.onclick = (event)=>{
|
||||
this.show(event.currentTarget);
|
||||
}
|
||||
|
||||
for (let item in this.clickableItems)
|
||||
{
|
||||
this.menu.querySelector(item).onclick = (event)=>{
|
||||
let ret = this.clickableItems[item](event);
|
||||
if (ret)
|
||||
{
|
||||
this.hide();
|
||||
}
|
||||
|
||||
event.stopPropagation();
|
||||
}
|
||||
}
|
||||
|
||||
for (let item in this.changeableItems)
|
||||
{
|
||||
this.menu.querySelector(item).onchange = (event)=>{
|
||||
let ret = this.changeableItems[item](event);
|
||||
if (ret)
|
||||
{
|
||||
this.hide();
|
||||
}
|
||||
|
||||
event.stopPropagation();
|
||||
}
|
||||
}
|
||||
|
||||
this.ignoreItems.forEach(item=>{
|
||||
this.menu.querySelector(item).onclick = (event)=>{
|
||||
{
|
||||
event.stopPropagation();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
this.subMenus.forEach(item=>{
|
||||
this.menu.querySelector(item).onmouseenter = function(event){
|
||||
if (this.timerId)
|
||||
{
|
||||
clearTimeout(this.timerId);
|
||||
this.timerId = null;
|
||||
}
|
||||
|
||||
event.currentTarget.querySelector(item +"-submenu").style.display="inherit";
|
||||
}
|
||||
|
||||
this.menu.querySelector(item).onmouseleave = function(event){
|
||||
let ui = event.currentTarget.querySelector(item +"-submenu");
|
||||
this.timerId = setTimeout(()=>{
|
||||
ui.style.display="none";
|
||||
this.timerId = null;
|
||||
},
|
||||
200);
|
||||
}
|
||||
});
|
||||
|
||||
this.menu.onclick = (event)=>{
|
||||
event.stopPropagation();
|
||||
};
|
||||
|
||||
|
||||
|
||||
// init ui
|
||||
this.menu.querySelector("#cfg-theme-select").value = pointsGlobalConfig.theme;
|
||||
this.menu.querySelector("#cfg-data-aux-lidar-checkbox").checked = pointsGlobalConfig.enableAuxLidar;
|
||||
this.menu.querySelector("#cfg-data-radar-checkbox").checked = pointsGlobalConfig.enableRadar;
|
||||
this.menu.querySelector("#cfg-color-points-select").value = pointsGlobalConfig.color_points;
|
||||
this.menu.querySelector("#cfg-coordinate-system-select").value = pointsGlobalConfig.coordinateSystem;
|
||||
this.menu.querySelector("#cfg-batch-mode-inst-number").value = pointsGlobalConfig.batchModeInstNumber;
|
||||
this.menu.querySelector("#cfg-data-filter-points-checkbox").checked = pointsGlobalConfig.enableFilterPoints;
|
||||
this.menu.querySelector("#cfg-data-filter-points-z").value = pointsGlobalConfig.filterPointsZ;
|
||||
this.menu.querySelector("#cfg-hide-id-checkbox").value = pointsGlobalConfig.hideId;
|
||||
this.menu.querySelector("#cfg-hide-category-checkbox").value = pointsGlobalConfig.hideCategory;
|
||||
this.menu.querySelector("#cfg-data-preload-checkbox").checked = pointsGlobalConfig.enablePreload;
|
||||
this.menu.querySelector("#cfg-auto-rotate-xy-checkbox").checked = pointsGlobalConfig.enableAutoRotateXY;
|
||||
this.menu.querySelector("#cfg-auto-update-interpolated-boxes-checkbox").checked = pointsGlobalConfig.autoUpdateInterpolatedBoxes;
|
||||
}
|
||||
|
||||
|
||||
show(target){
|
||||
this.wrapper.style.display="inherit";
|
||||
|
||||
this.menu.style.right = "0px";
|
||||
this.menu.style.top = target.offsetHeight + "px";
|
||||
|
||||
globalKeyDownManager.register((event)=>false, 'config');
|
||||
}
|
||||
|
||||
hide(){
|
||||
globalKeyDownManager.deregister('config');
|
||||
this.wrapper.style.display="none";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
export {ConfigUi}
|
||||