# - Try to find libpcap include dirs and libraries # # Usage of this module as follows: # # find_package(PCAP) # # Variables used by this module, they can change the default behaviour and need # to be set before calling find_package: # # PCAP_ROOT_DIR Set this variable to the root installation of # libpcap if the module has problems finding the # proper installation path. # # Variables defined by this module: # # PCAP_FOUND System has libpcap, include and library dirs found # PCAP_INCLUDE_DIR The libpcap include directories. # PCAP_LIBRARY The libpcap library (possibly includes a thread # library e.g. required by pf_ring's libpcap) # HAVE_PF_RING If a found version of libpcap supports PF_RING
# check if linking against libpcap also needs to link against a thread library if (NOT PCAP_LINKS_SOLO) find_package(Threads) if (THREADS_FOUND) set(CMAKE_REQUIRED_LIBRARIES ${PCAP_LIBRARY}${CMAKE_THREAD_LIBS_INIT}) check_c_source_compiles("int main() { return 0; }" PCAP_NEEDS_THREADS) set(CMAKE_REQUIRED_LIBRARIES) endif () if (THREADS_FOUND AND PCAP_NEEDS_THREADS) set(_tmp ${PCAP_LIBRARY}${CMAKE_THREAD_LIBS_INIT}) list(REMOVE_DUPLICATES _tmp) set(PCAP_LIBRARY ${_tmp} CACHE STRING"Libraries needed to link against libpcap" FORCE) else () message(FATAL_ERROR "Couldn't determine how to link against libpcap") endif () endif ()
c++ function: managled names c function: unmangled names extern c告诉c++编译器将f_int,f_float视为c函数,使用 unmangled names(修饰名称)
managled/unmangled names
a.cpp
1 2 3 4 5 6 7 8 9 10
voidf(){} voidg();
extern"C" { voidef(){} voideg(); }
/* Prevent g and eg from being optimized away. */ voidh(){ g(); eg(); }
Compile with GCC 4.8 Linux ELF output:
g++ -c a.cpp
Decompile the symbol table:
readelf -s a.o
output
Num: Value Size Type Bind Vis Ndx Name
8: 0000000000000000 6 FUNC GLOBAL DEFAULT 1 _Z1fv
9: 0000000000000006 6 FUNC GLOBAL DEFAULT 1 ef
10: 000000000000000c 16 FUNC GLOBAL DEFAULT 1 _Z1hv
11: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND _Z1gv
12: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND eg
managled names: _Z1fv,_Z1hv,_Z1gv for f,g,h unmangled names: ef,eg
It becomes obvious that any C++ feature that requires name mangling will not work inside extern C:
error.cpp
1 2 3 4 5 6 7 8 9 10
extern"C" { // Overloading. // error: declaration of C function ‘void f(int)’ conflicts with voidf(); voidf(int i);
// Templates. // error: template with C linkage template <classC> voidf(C i){ } }
compile and generate errors
g++ -c error.cpp
error.cpp:5:17: error: conflicting declaration of C function ‘void f(int)’
void f(int i);
^
error.cpp:4:10: note: previous declaration ‘void f()’
void f();
^
error.cpp:9:5: error: template with C linkage
template <class C> void f(C i) { }
^
So you will need extern "C" both when calling:
C from C++: tell g++ to expect unmangled symbols produced by gcc
C++ from C: tell gcc to use unmangled symbols produced by g++
cpp中使用c方法
code
main.cpp
1 2 3 4 5 6 7
#include<cassert>
#include"c.h"
intmain(){ assert(f() == 1); }
c.h
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
#ifndef C_H #define C_H
/* This ifdef allows the header to be used from both C and C++. */ #ifdef __cplusplus extern"C" { #endif
intf();
#ifdef __cplusplus } #endif
#endif
c.c
1 2 3
#include"c.h"
intf(void) { return1; }
OK
compile main.cpp
g++ -c -o main.o -std=c++98 main.cpp
readelf -s main.o
10: 0000000000000000 46 FUNC GLOBAL DEFAULT 1 main
11: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND f
12: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND __assert_fail
使用c++编译器,extern c告诉c++编译器f是一个c函数,使用unmanagled name f
compile c.c
gcc -c -o c.o -std=c89 c.c
readelf -s c.o
8: 0000000000000000 11 FUNC GLOBAL DEFAULT 1 f
使用c编译器,对于c函数生成unmanagled name f
link main.o and c.o
g++ -o main.out main.o c.o
./main.out
OK.
Error
Without extern "C" the link fails with:
main.cpp:6: undefined reference to `f()'
compile main.cpp
g++ -c -o main.o -std=c++98 main.cpp
readelf -s main.o
10: 0000000000000000 46 FUNC GLOBAL DEFAULT 1 main
11: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND _Z1fv
12: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND __assert_fail
因为没有extern c,所以g++编译器将f看做是c++函数,使用managled name _Z1fv
compile c.c
gcc -c -o c.o -std=c89 c.c
readelf -s c.o
8: 0000000000000000 11 FUNC GLOBAL DEFAULT 1 f
使用c编译器,对于c函数生成unmanagled name f
link main.o and c.o
g++ -o main.out main.o c.o
main.o: In function `main':
main.cpp:(.text+0x5): undefined reference to `f()'
collect2: error: ld returned 1 exit status
link失败,因为c++编译器需要managled name _Z1fv,然而c编译器生成了unmanagled name f
tar -xvf protobuf-cpp-3.6.1.tar.gz cd protobuf-3.6.1 ./configure --disable-shared CXXFLAGS="-fPIC" make -j8
tips: we compile static library with --disable-shared CXXFLAGS="-fPIC". 编译动态库dll/so的时候,如果依赖static library(比如profobuf),那么static library编译的时候需要加上-fPIC,否则动态库编译出错。 对于CMake,使用cmake CMAKE_CXX_FLGAS="-fPIC" ..
otherwise, error occurs
Linking CXX shared library ../../../../bin/libcommon.so
/usr/bin/ld: /usr/local/lib/libprotobuf.a(common.o): relocation R_X86_64_32S against `.rodata' can not be used when makinga shared object; recompile with -fPIC
/usr/local/lib/libprotobuf.a: error adding symbols: Bad value
By default, make install' will install all the files in /usr/local/bin’, /usr/local/lib' etc. You can specify an installation prefix other than /usr/local’ using --prefix', for instance –prefix=$HOME’.
Static linking is now the default for the Protocol Buffer libraries. Due to issues with Win32’s use of a separate heap for each DLL, as well as binary compatibility issues between different versions of MSVC’s STL library, it is recommended that you use static linkage only. However, it is possible to build libprotobuf and libprotoc as DLLs if you really want. To do this, do the following:
Add an additional flag -Dprotobuf_BUILD_SHARED_LIBS=ON when invoking cmake
Follow the same steps as described in the above section.
When compiling your project, make sure to #define PROTOBUF_USE_DLLS.
[libprotobuf ERROR google/protobuf/descriptor_database.cc:58] File already exists in database: adapter_config.proto [libprotobuf FATAL google/protobuf/descriptor.cc:1315] CHECK failed: generated_database_->Add(encoded_file_descriptor, size): terminate called after throwing an instance of 'google::protobuf::FatalException' what(): CHECK failed: generated_database_->Add(encoded_file_descriptor, size): Aborted (core dumped)
reasons
The problem happens when you have multiple compiled copies of the same .pb.cc file sharing a single copy of libprotobuf.so.
`common`模块编译了`adapter_config.pb.cc`,`node_perception`依赖于`common`,同时也要编译`adapter_config.pb.cc`。运行`node_perception`就会报错。
rosmsg show beginner_tutorials/Num
int64 num
rosmsg show Num
[beginner_tutorials/Num]:
int64 num
show srv
rossrv show
rossrv show beginner_tutorials/AddTwoInts
int64 a
int64 b
---
int64 sum
rossrv show AddTwoInts
[beginner_tutorials/AddTwoInts]:
int64 a
int64 b
---
int64 sum
[rospy_tutorials/AddTwoInts]:
int64 a
int64 b
---
int64 sum
/** * This tutorial demonstrates simple sending of messages over the ROS system. */ intmain(int argc, char **argv) { /** * The ros::init() function needs to see argc and argv so that it can perform * any ROS arguments and name remapping that were provided at the command line. * For programmatic remappings you can use a different version of init() which takes * remappings directly, but for most command-line programs, passing argc and argv is * the easiest way to do it. The third argument to init() is the name of the node. * * You must call one of the versions of ros::init() before using any other * part of the ROS system. */ ros::init(argc, argv, "talker");
/** * NodeHandle is the main access point to communications with the ROS system. * The first NodeHandle constructed will fully initialize this node, and the last * NodeHandle destructed will close down the node. */ ros::NodeHandle n;
/** * The advertise() function is how you tell ROS that you want to * publish on a given topic name. This invokes a call to the ROS * master node, which keeps a registry of who is publishing and who * is subscribing. After this advertise() call is made, the master * node will notify anyone who is trying to subscribe to this topic name, * and they will in turn negotiate a peer-to-peer connection with this * node. advertise() returns a Publisher object which allows you to * publish messages on that topic through a call to publish(). Once * all copies of the returned Publisher object are destroyed, the topic * will be automatically unadvertised. * * The second parameter to advertise() is the size of the message queue * used for publishing messages. If messages are published more quickly * than we can send them, the number here specifies how many messages to * buffer up before throwing some away. */ ros::Publisher chatter_pub = n.advertise<std_msgs::String>("chatter", 1000);
ros::Rate loop_rate(10);
/** * A count of how many messages we have sent. This is used to create * a unique string for each message. */ int count = 0; while (ros::ok()) { /** * This is a message object. You stuff it with data, and then publish it. */ std_msgs::String msg;
std::stringstream ss; ss << "hello world " << count; msg.data = ss.str();
ROS_INFO("%s", msg.data.c_str());
/** * The publish() function is how you send messages. The parameter * is the message object. The type of this object must agree with the type * given as a template parameter to the advertise<>() call, as was done * in the constructor above. */ chatter_pub.publish(msg);
/** * This tutorial demonstrates simple receipt of messages over the ROS system. */ voidchatterCallback(const std_msgs::String::ConstPtr& msg) { ROS_INFO("I heard: [%s]", msg->data.c_str()); }
intmain(int argc, char **argv) { /** * The ros::init() function needs to see argc and argv so that it can perform * any ROS arguments and name remapping that were provided at the command line. * For programmatic remappings you can use a different version of init() which takes * remappings directly, but for most command-line programs, passing argc and argv is * the easiest way to do it. The third argument to init() is the name of the node. * * You must call one of the versions of ros::init() before using any other * part of the ROS system. */ ros::init(argc, argv, "listener");
/** * NodeHandle is the main access point to communications with the ROS system. * The first NodeHandle constructed will fully initialize this node, and the last * NodeHandle destructed will close down the node. */ ros::NodeHandle n;
/** * The subscribe() call is how you tell ROS that you want to receive messages * on a given topic. This invokes a call to the ROS * master node, which keeps a registry of who is publishing and who * is subscribing. Messages are passed to a callback function, here * called chatterCallback. subscribe() returns a Subscriber object that you * must hold on to until you want to unsubscribe. When all copies of the Subscriber * object go out of scope, this callback will automatically be unsubscribed from * this topic. * * The second parameter to the subscribe() function is the size of the message * queue. If messages are arriving faster than they are being processed, this * is the number of messages that will be buffered up before beginning to throw * away the oldest ones. */ ros::Subscriber sub = n.subscribe("chatter", 1000, chatterCallback);
/** * ros::spin() will enter a loop, pumping callbacks. With this version, all * callbacks will be called from within this thread (the main one). ros::spin() * will exit when Ctrl-C is pressed, or the node is shutdown by the master. */ ros::spin();
## Compile as C++11, supported in ROS Kinetic and newer add_compile_options(-std=c++11)
## Find catkin macros and libraries ## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz) ## is used, also find other catkin packages find_package(catkin REQUIRED COMPONENTS roscpp rospy std_msgs message_generation )
## System dependencies are found with CMake's conventions # find_package(Boost REQUIRED COMPONENTS system)
## Generate messages in the 'msg' folder add_message_files( FILES Num.msg )
## Generate services in the 'srv' folder add_service_files( FILES AddTwoInts.srv )
## Generate actions in the 'action' folder # add_action_files( # FILES # Action1.action # Action2.action # )
## Generate added messages and services with any dependencies listed here generate_messages( DEPENDENCIES std_msgs )
## Specify additional locations of header files ## Your package locations should be listed before other locations include_directories( include ${catkin_INCLUDE_DIRS} )
cd ~/catkin_ws
catkin_make
Base path: /home/kezunlin/workspace/ros/catkin_ws
Source space: /home/kezunlin/workspace/ros/catkin_ws/src
Build space: /home/kezunlin/workspace/ros/catkin_ws/build
Devel space: /home/kezunlin/workspace/ros/catkin_ws/devel
Install space: /home/kezunlin/workspace/ros/catkin_ws/install
####
#### Running command: "make cmake_check_build_system" in "/home/kezunlin/workspace/ros/catkin_ws/build"
####
-- Using CATKIN_DEVEL_PREFIX: /home/kezunlin/workspace/ros/catkin_ws/devel
-- Using CMAKE_PREFIX_PATH: /home/kezunlin/workspace/ros/catkin_ws/devel;/home/kezunlin/catkin_ws/devel;/opt/ros/kinetic
-- This workspace overlays: /home/kezunlin/workspace/ros/catkin_ws/devel;/home/kezunlin/catkin_ws/devel;/opt/ros/kinetic
-- Using PYTHON_EXECUTABLE: /usr/bin/python
-- Using Debian Python package layout
-- Using empy: /usr/bin/empy
-- Using CATKIN_ENABLE_TESTING: ON
-- Call enable_testing()
-- Using CATKIN_TEST_RESULTS_DIR: /home/kezunlin/workspace/ros/catkin_ws/build/test_results
-- Found gtest: gtests will be built
-- Using Python nosetests: /usr/local/bin/nosetests-2.7
-- catkin 0.7.14
-- BUILD_SHARED_LIBS is on
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- ~~ traversing 1 packages in topological order:
-- ~~ - beginner_tutorials
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- +++ processing catkin package: 'beginner_tutorials'
-- ==> add_subdirectory(beginner_tutorials)
-- Using these message generators: gencpp;geneus;genlisp;gennodejs;genpy
-- beginner_tutorials: 1 messages, 1 services
-- Configuring done
-- Generating done
-- Build files have been written to: /home/kezunlin/workspace/ros/catkin_ws/build
####
#### Running command: "make -j8 -l8" in "/home/kezunlin/workspace/ros/catkin_ws/build"
####
[ 0%] [ 0%] [ 0%] [ 0%] Built target std_msgs_generate_messages_cpp
Built target std_msgs_generate_messages_py
[ 0%] Built target std_msgs_generate_messages_nodejs
Built target std_msgs_generate_messages_lisp
Built target std_msgs_generate_messages_eus
[ 0%] [ 0%] Built target _beginner_tutorials_generate_messages_check_deps_AddTwoInts
Built target _beginner_tutorials_generate_messages_check_deps_Num
[ 20%] [ 20%] [ 20%] [ 26%] [ 33%] [ 40%] [ 46%] Generating Lisp code from beginner_tutorials/Num.msg
Generating EusLisp code from beginner_tutorials/AddTwoInts.srv
Generating EusLisp code from beginner_tutorials/Num.msg
Generating Javascript code from beginner_tutorials/Num.msg
Generating Javascript code from beginner_tutorials/AddTwoInts.srv
Generating C++ code from beginner_tutorials/Num.msg
[ 53%] Generating C++ code from beginner_tutorials/AddTwoInts.srv
Generating Python from MSG beginner_tutorials/Num
[ 60%] Generating Lisp code from beginner_tutorials/AddTwoInts.srv
[ 66%] Generating Python code from SRV beginner_tutorials/AddTwoInts
[ 66%] Built target beginner_tutorials_generate_messages_nodejs
[ 73%] Built target beginner_tutorials_generate_messages_eus
[ 73%] Built target beginner_tutorials_generate_messages_lisp
[ 80%] [ 86%] Generating Python srv __init__.py for beginner_tutorials
Generating Python msg __init__.py for beginner_tutorials
[ 86%] Built target beginner_tutorials_generate_messages_cpp
Scanning dependencies of target listener
Scanning dependencies of target talker
[ 93%] [100%] Building CXX object beginner_tutorials/CMakeFiles/listener.dir/src/listener.cpp.o
Building CXX object beginner_tutorials/CMakeFiles/talker.dir/src/talker.cpp.o
[100%] Built target beginner_tutorials_generate_messages_py
[100%] Built target beginner_tutorials_generate_messages
Linking CXX executable /home/kezunlin/workspace/ros/catkin_ws/devel/lib/beginner_tutorials/talker
[100%] Built target talker
Linking CXX executable /home/kezunlin/workspace/ros/catkin_ws/devel/lib/beginner_tutorials/listener
[100%] Built target listener
play with talker and listener
roscore
cd ~/catkin_ws
./devel/lib/beginner_tutorials/talker
./devel/lib/beginner_tutorials/listener
rosrun beginner_tutorials talker
[ INFO] [1545039519.457624559]: hello world 803
[ INFO] [1545039519.557624500]: hello world 804
[ INFO] [1545039519.657595852]: hello world 805
[ INFO] [1545039519.757538635]: hello world 806
rosrun beginner_tutorials listener
[ INFO] [1545039519.458099942]: I heard: [hello world 803]
[ INFO] [1545039519.558116295]: I heard: [hello world 804]
[ INFO] [1545039519.658085716]: I heard: [hello world 805]
[ INFO] [1545039519.757998160]: I heard: [hello world 806]
Note that roscd, like other ROS tools, will only find ROS packages that are within the directories listed in your ROS_PACKAGE_PATH. echo $ROS_PACKAGE_PATH
workspace_folder/ – WORKSPACE src/ – SOURCE SPACE CMakeLists.txt – ‘Toplevel’ CMake file, provided by catkin package_1/ CMakeLists.txt – CMakeLists.txt file for package_1 package.xml – Package manifest for package_1 … package_n/ CMakeLists.txt – CMakeLists.txt file for package_n package.xml – Package manifest for package_n
create a catkin package
catkin_create_pkg [depend1] [depend2] [depend3]
cd ~/catkin_ws/src catkin_create_pkg beginner_tutorials roscpp rospy std_msgs
Created file beginner_tutorials/CMakeLists.txt
Created file beginner_tutorials/package.xml
Created folder beginner_tutorials/include/beginner_tutorials
Created folder beginner_tutorials/src
# In a CMake project
$ mkdir build
$ cd build
$ cmake ..
$ make
$ make install # (optionally)
# In a catkin workspace
$ catkin_make
$ catkin_make install # (optionally)
Understanding ROS Nodes
commands
roscore = ros+core : master (provides name service for ROS) + rosout (stdout/stderr) + parameter server (parameter server will be introduced later)
rosnode = ros+node : ROS tool to get information about a node.
rosrun = ros+run : runs a node from a given package.
concepts
Quick Overview of Graph Concepts
Nodes: A node is an executable that uses ROS to communicate with other nodes.
Messages: ROS data type used when subscribing or publishing to a topic.
Topics: Nodes can publish messages to a topic as well as subscribe to a topic to receive messages.
Master: Name service for ROS (i.e. helps nodes find each other)
rosout: ROS equivalent of stdout/stderr
roscore: Master + rosout + parameter server (parameter server will be introduced later)
Note: If you still see /turtlesim in the list, it might mean that you stopped the node in the terminal using ctrl-C instead of closing the window
ping node
rosnode ping my_turtle rosnode: node is [/my_turtle] pinging /my_turtle with a timeout of 3.0s xmlrpc reply from http://ke:33523/ time=0.274181ms xmlrpc reply from http://ke:33523/ time=1.040220ms xmlrpc reply from http://ke:33523/ time=1.013041ms ^Cping average: 0.775814ms
You will see the two turtlesims start moving even though the publish command is only being sent to turtlesim1.
rosed
rosed roscpp
rosed roscpp Logger.msg
Creating a ROS msg and srv
msg: msg files are simple text files that describe the fields of a ROS message. They are used to generate source code for messages in different languages.
srv: an srv file describes a service. It is composed of two parts: a request and a response.
msg
msgs are just simple text files with a field type and field name per line. The field types you can use are:
int8, int16, int32, int64 (plus uint*) float32, float64 string time, duration other msg files variable-length array[] and fixed-length array[C]
There is also a special type in ROS: Header, the header contains a timestamp and coordinate frame information that are commonly used in ROS.
rosmsg show Num [beginner_tutorials/Num]: int64 num
show srv
rossrv show rossrv show beginner_tutorials/AddTwoInts
int64 a
int64 b
---
int64 sum
rossrv show AddTwoInts
[beginner_tutorials/AddTwoInts]:
int64 a
int64 b
---
int64 sum
[rospy_tutorials/AddTwoInts]:
int64 a
int64 b
---
int64 sum
catkin_make
roscd beginner_tutorials cd ../.. catkin_make install
review
rospack = ros+pack(age) : provides information related to ROS packages roscd = ros+cd : changes directory to a ROS package or stack rosls = ros+ls : lists files in a ROS package roscp = ros+cp : copies files from/to a ROS package rosmsg = ros+msg : provides information related to ROS message definitions rossrv = ros+srv : provides information related to ROS service definitions catkin_make : makes (compiles) a ROS package rosmake = ros+make : makes (compiles) a ROS package (if you’re not using a catkin workspace)
Writing a Simple Publisher and Subscriber
src
roscd beginner_tutorials vim src/talker.cpp vim src/listener.cpp
build
cd ~/catkin_ws catkin_make
play with talker and listener
roscore
rosrun beginner_tutorials talker
[ INFO] [1545039519.457624559]: hello world 803
[ INFO] [1545039519.557624500]: hello world 804
[ INFO] [1545039519.657595852]: hello world 805
[ INFO] [1545039519.757538635]: hello world 806
rosrun beginner_tutorials listener
[ INFO] [1545039519.458099942]: I heard: [hello world 803]
[ INFO] [1545039519.558116295]: I heard: [hello world 804]
[ INFO] [1545039519.658085716]: I heard: [hello world 805]
[ INFO] [1545039519.757998160]: I heard: [hello world 806]
7)关闭会话(销毁会话) [root@Centos6 ~]# tmux ls aaa: 2 windows (created Wed Aug 30 16:54:33 2017) [112x22] bbb: 1 windows (created Wed Aug 30 19:02:09 2017) [112x22]
[root@Centos6 ~]# tmux kill-session -t bbb
[root@Centos6 ~]# tmux ls aaa: 2 windows (created Wed Aug 30 16:54:33 2017) [112x22]
8)重命名会话 [root@Centos6 ~]# tmux ls wangshibo: 1 windows (created Sun Sep 30 10:17:00 2018) [136x29] (attached)
[root@Centos6 ~]# tmux rename -t wangshibo kevin
[root@Centos6 ~]# tmux ls kevin: 1 windows (created Sun Sep 30 10:17:00 2018) [136x29] (attached)
9)发送命令到回话并执行 [root@Centos6 ~]# tmux send -t session_name "command" ENTER
pyinstaller AttributeError: 'str' object has no attribute 'items'
solution:
1
pip3 install --upgrade setuptools
usage
1
pyinstaller -h
params:
General Options
-y, –noconfirm Replace output directory (default: SPECPATH/dist/SPECNAME) without asking for confirmation –upx-dir UPX_DIR Path to UPX utility (default: search the execution path)
–clean Clean PyInstaller cache and remove temporary files before building.
–log-level LEVEL Amount of detail in build-time console messages. LEVEL may be one of TRACE, DEBUG, INFO, WARN, ERROR, CRITICAL (default: INFO).
What to generate
-D, --onedir
Create a one-folder bundle containing an executable (default)
-F, --onefile
Create a one-file bundled executable.
What to bundle, where to search
--add-data <SRC;DEST or SRC:DEST>
This option can be used multiple times.
--add-binary <SRC;DEST or SRC:DEST>
This option can be used multiple times.
-p DIR, --paths DIR
A path to search for imports (like using PYTHONPATH).
Multiple paths are allowed, separated by ‘:’, or use
this option multiple times
--hidden-import MODULENAME, --hiddenimport MODULENAME
Name an import not visible in the code of the script(s).
This option can be used multiple times.
Windows and Mac OS X specific options
-c, --console, --nowindowed
Open a console window for standard i/o (default)
-w, --windowed, --noconsole
Windows and Mac OS X: do not provide a console window
for standard i/o
93 INFO: Extending PYTHONPATH with paths
['E:\\git\\python\\helloworld',
'E:\\git\\python\\helloworld\\sdk\\superdog',
'E:\\git\\python\\helloworld\\sdk\\detect',
'E:\\git\\python\\helloworld']
...
WARNING: Ignoring ./sdk/detect/cuda80_detect_cpp_dll.dll imported
from E:\git\python\helloworld\sdk\detect\detect.py -
ctypes imports are only supported using bare filenames
all related dlls have been copied to dist/demo/ folder, eg. cublas64_80.dll,curand64_80.dll,cudart64_80.dll,cudnn64_6.dll and cuda80_detect_cpp_dll.dll
# UTF-8 # # For more details about fixed file info 'ffi' see: # http://msdn.microsoft.com/en-us/library/ms646997.aspx VSVersionInfo( ffi=FixedFileInfo( # filevers and prodvers should be always a tuple with four items: (1, 2, 3, 4) # Set not needed items to zero 0. filevers=(9, 0, 4, 23780), prodvers=(9, 0, 4, 23780), # Contains a bitmask that specifies the valid bits 'flags'r mask=0x3f, # Contains a bitmask that specifies the Boolean attributes of the file. flags=0x0, # The operating system for which this file was designed. # 0x4 - NT and there is no need to change it. OS=0x40004, # The general type of file. # 0x1 - the file is an application. fileType=0x1, # The function of the file. # 0x0 - the function is not defined for this fileType subtype=0x0, # Creation date and time stamp. date=(0, 0) ), kids=[ StringFileInfo( [ StringTable( u'080404b0', [StringStruct(u'CompanyName', u'Tencent'), StringStruct(u'FileDescription', u'腾讯QQ'), StringStruct(u'FileVersion', u'9.0.4.23780'), StringStruct(u'LegalCopyright', u'Copyright (C) 1999-2018 Tencent. All Rights Reserved'), StringStruct(u'ProductName', u'腾讯QQ'), StringStruct(u'ProductVersion', u'9.0.4.23780')]) ]), VarFileInfo([VarStruct(u'Translation', [2052, 1200])]) ] )
To encrypt the Python bytecode modules stored in the bundle, pass the --key=key-string argument on the command line.
For this to work, you must have the PyCrypto module installed. The key-string is a string of 16 characters which is used to encrypt each file of Python byte-code before it is stored in the archive inside the executable file.
# load our serialized face detector from disk print("[INFO] loading face detector...") protoPath = os.path.sep.join([args["detector"], "deploy.prototxt"]) modelPath = os.path.sep.join([args["detector"], "res10_300x300_ssd_iter_140000.caffemodel"]) net = cv2.dnn.readNetFromCaffe(protoPath, modelPath)
readNetFromTensorflow
1 2 3 4 5 6 7 8 9 10
# derive the paths to the Mask R-CNN weights and model configuration weightsPath = os.path.sep.join([args["mask_rcnn"], "frozen_inference_graph.pb"]) configPath = os.path.sep.join([args["mask_rcnn"], "mask_rcnn_inception_v2_coco_2018_01_28.pbtxt"])
# load our Mask R-CNN trained on the COCO dataset (90 classes) # from disk print("[INFO] loading Mask R-CNN from disk...") net = cv2.dnn.readNetFromTensorflow(weightsPath, configPath)
readNetFromDarknet
1 2 3 4 5 6 7
# derive the paths to the YOLO weights and model configuration weightsPath = os.path.sep.join([args["yolo"], "yolov3.weights"]) configPath = os.path.sep.join([args["yolo"], "yolov3.cfg"])
# load our YOLO object detector trained on COCO dataset (80 classes) print("[INFO] loading YOLO from disk...") net = cv2.dnn.readNetFromDarknet(configPath, weightsPath)
readNetFromTorch
1 2 3 4 5 6 7
# load our serialized face embedding model from disk print("[INFO] loading face recognizer...") net = cv2.dnn.readNetFromTorch(args["embedding_model"])
# load the neural style transfer model from disk print("[INFO] loading style transfer model...") net = cv2.dnn.readNetFromTorch(args["model"])
Searching for include files...
Searching for example files...
Searching for images...
Searching for dot files...
Searching for msc files...
Searching for dia files...
Searching for files to exclude
Searching INPUT for files to process...
...