From 43b6d4f8cb39b18bd192b070f40ae8e3f228068a Mon Sep 17 00:00:00 2001 From: baiyf Date: Sat, 12 May 2018 02:11:23 -0500 Subject: [PATCH] put detection op together (#10595) --- paddle/fluid/operators/CMakeLists.txt | 5 ++++ .../fluid/operators/detection/CMakeLists.txt | 29 +++++++++++++++++++ .../{ => detection}/bipartite_match_op.cc | 0 .../operators/{ => detection}/box_coder_op.cc | 2 +- .../operators/{ => detection}/box_coder_op.cu | 2 +- .../operators/{ => detection}/box_coder_op.h | 0 .../{ => detection}/iou_similarity_op.cc | 2 +- .../{ => detection}/iou_similarity_op.cu | 2 +- .../{ => detection}/iou_similarity_op.h | 0 .../{ => detection}/mine_hard_examples_op.cc | 0 .../{ => detection}/multiclass_nms_op.cc | 0 .../operators/{ => detection}/prior_box_op.cc | 2 +- .../operators/{ => detection}/prior_box_op.cu | 2 +- .../operators/{ => detection}/prior_box_op.h | 0 .../{ => detection}/target_assign_op.cc | 2 +- .../{ => detection}/target_assign_op.cu | 2 +- .../{ => detection}/target_assign_op.h | 0 17 files changed, 42 insertions(+), 8 deletions(-) create mode 100644 paddle/fluid/operators/detection/CMakeLists.txt rename paddle/fluid/operators/{ => detection}/bipartite_match_op.cc (100%) rename paddle/fluid/operators/{ => detection}/box_coder_op.cc (99%) rename paddle/fluid/operators/{ => detection}/box_coder_op.cu (99%) rename paddle/fluid/operators/{ => detection}/box_coder_op.h (100%) rename paddle/fluid/operators/{ => detection}/iou_similarity_op.cc (98%) rename paddle/fluid/operators/{ => detection}/iou_similarity_op.cu (92%) rename paddle/fluid/operators/{ => detection}/iou_similarity_op.h (100%) rename paddle/fluid/operators/{ => detection}/mine_hard_examples_op.cc (100%) rename paddle/fluid/operators/{ => detection}/multiclass_nms_op.cc (100%) rename paddle/fluid/operators/{ => detection}/prior_box_op.cc (99%) rename paddle/fluid/operators/{ => detection}/prior_box_op.cu (99%) rename paddle/fluid/operators/{ => detection}/prior_box_op.h (100%) rename paddle/fluid/operators/{ => detection}/target_assign_op.cc (98%) rename paddle/fluid/operators/{ => detection}/target_assign_op.cu (97%) rename paddle/fluid/operators/{ => detection}/target_assign_op.h (100%) diff --git a/paddle/fluid/operators/CMakeLists.txt b/paddle/fluid/operators/CMakeLists.txt index fbeacb66cef..c14a2b7786f 100644 --- a/paddle/fluid/operators/CMakeLists.txt +++ b/paddle/fluid/operators/CMakeLists.txt @@ -270,6 +270,11 @@ foreach(src ${READER_LIBRARY}) set(OP_LIBRARY ${src} ${OP_LIBRARY}) endforeach() +add_subdirectory(detection) +foreach(src ${DETECTION_LIBRARY}) + set(OP_LIBRARY ${src} ${OP_LIBRARY}) +endforeach() + set(GLOB_OP_LIB ${OP_LIBRARY} CACHE INTERNAL "Global OP library") cc_test(gather_test SRCS gather_test.cc DEPS tensor) diff --git a/paddle/fluid/operators/detection/CMakeLists.txt b/paddle/fluid/operators/detection/CMakeLists.txt new file mode 100644 index 00000000000..a5bb58c2f40 --- /dev/null +++ b/paddle/fluid/operators/detection/CMakeLists.txt @@ -0,0 +1,29 @@ +set(LOCAL_DETECTION_LIBS) + +function(detection_library TARGET_NAME) + set(oneValueArgs "") + set(multiValueArgs SRCS DEPS) + set(options "") + set(common_deps op_registry) + set(pybind_flag 0) + cmake_parse_arguments(detection_library "${options}" "${oneValueArgs}" + "${multiValueArgs}" ${ARGN}) + op_library(${TARGET_NAME} SRCS ${detection_library_SRCS} DEPS ${common_deps} ${detection_library_DEPS}) + set(LOCAL_DETECTION_LIBS + ${TARGET_NAME} + ${LOCAL_DETECTION_LIBS} + PARENT_SCOPE) +endfunction() + +detection_library(bipartite_match_op SRCS bipartite_match_op.cc) +detection_library(box_coder_op SRCS box_coder_op.cc box_coder_op.cu) +detection_library(iou_similarity_op SRCS iou_similarity_op.cc +iou_similarity_op.cu) +detection_library(mine_hard_examples_op SRCS mine_hard_examples_op.cc) +detection_library(multiclass_nms_op SRCS multiclass_nms_op.cc) +detection_library(prior_box_op SRCS prior_box_op.cc prior_box_op.cu) +detection_library(target_assign_op SRCS target_assign_op.cc +target_assign_op.cu) + +# Export local libraries to parent +set(DETECTION_LIBRARY ${LOCAL_DETECTION_LIBS} PARENT_SCOPE) diff --git a/paddle/fluid/operators/bipartite_match_op.cc b/paddle/fluid/operators/detection/bipartite_match_op.cc similarity index 100% rename from paddle/fluid/operators/bipartite_match_op.cc rename to paddle/fluid/operators/detection/bipartite_match_op.cc diff --git a/paddle/fluid/operators/box_coder_op.cc b/paddle/fluid/operators/detection/box_coder_op.cc similarity index 99% rename from paddle/fluid/operators/box_coder_op.cc rename to paddle/fluid/operators/detection/box_coder_op.cc index ce9bf10dc3c..74848005d0b 100644 --- a/paddle/fluid/operators/box_coder_op.cc +++ b/paddle/fluid/operators/detection/box_coder_op.cc @@ -9,7 +9,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -#include "paddle/fluid/operators/box_coder_op.h" +#include "paddle/fluid/operators/detection/box_coder_op.h" namespace paddle { namespace operators { diff --git a/paddle/fluid/operators/box_coder_op.cu b/paddle/fluid/operators/detection/box_coder_op.cu similarity index 99% rename from paddle/fluid/operators/box_coder_op.cu rename to paddle/fluid/operators/detection/box_coder_op.cu index 708c7a5fa96..8cef8e03439 100644 --- a/paddle/fluid/operators/box_coder_op.cu +++ b/paddle/fluid/operators/detection/box_coder_op.cu @@ -9,7 +9,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -#include "paddle/fluid/operators/box_coder_op.h" +#include "paddle/fluid/operators/detection/box_coder_op.h" #include "paddle/fluid/platform/cuda_primitives.h" namespace paddle { diff --git a/paddle/fluid/operators/box_coder_op.h b/paddle/fluid/operators/detection/box_coder_op.h similarity index 100% rename from paddle/fluid/operators/box_coder_op.h rename to paddle/fluid/operators/detection/box_coder_op.h diff --git a/paddle/fluid/operators/iou_similarity_op.cc b/paddle/fluid/operators/detection/iou_similarity_op.cc similarity index 98% rename from paddle/fluid/operators/iou_similarity_op.cc rename to paddle/fluid/operators/detection/iou_similarity_op.cc index 007e0af7a5a..8e58605fcea 100644 --- a/paddle/fluid/operators/iou_similarity_op.cc +++ b/paddle/fluid/operators/detection/iou_similarity_op.cc @@ -12,7 +12,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -#include "paddle/fluid/operators/iou_similarity_op.h" +#include "paddle/fluid/operators/detection/iou_similarity_op.h" namespace paddle { namespace operators { diff --git a/paddle/fluid/operators/iou_similarity_op.cu b/paddle/fluid/operators/detection/iou_similarity_op.cu similarity index 92% rename from paddle/fluid/operators/iou_similarity_op.cu rename to paddle/fluid/operators/detection/iou_similarity_op.cu index f40a388d62e..8342b4138c8 100644 --- a/paddle/fluid/operators/iou_similarity_op.cu +++ b/paddle/fluid/operators/detection/iou_similarity_op.cu @@ -12,7 +12,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -#include "paddle/fluid/operators/iou_similarity_op.h" +#include "paddle/fluid/operators/detection/iou_similarity_op.h" namespace ops = paddle::operators; REGISTER_OP_CUDA_KERNEL( diff --git a/paddle/fluid/operators/iou_similarity_op.h b/paddle/fluid/operators/detection/iou_similarity_op.h similarity index 100% rename from paddle/fluid/operators/iou_similarity_op.h rename to paddle/fluid/operators/detection/iou_similarity_op.h diff --git a/paddle/fluid/operators/mine_hard_examples_op.cc b/paddle/fluid/operators/detection/mine_hard_examples_op.cc similarity index 100% rename from paddle/fluid/operators/mine_hard_examples_op.cc rename to paddle/fluid/operators/detection/mine_hard_examples_op.cc diff --git a/paddle/fluid/operators/multiclass_nms_op.cc b/paddle/fluid/operators/detection/multiclass_nms_op.cc similarity index 100% rename from paddle/fluid/operators/multiclass_nms_op.cc rename to paddle/fluid/operators/detection/multiclass_nms_op.cc diff --git a/paddle/fluid/operators/prior_box_op.cc b/paddle/fluid/operators/detection/prior_box_op.cc similarity index 99% rename from paddle/fluid/operators/prior_box_op.cc rename to paddle/fluid/operators/detection/prior_box_op.cc index a0b069da0dd..4e35c38e4e0 100644 --- a/paddle/fluid/operators/prior_box_op.cc +++ b/paddle/fluid/operators/detection/prior_box_op.cc @@ -12,7 +12,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -#include "paddle/fluid/operators/prior_box_op.h" +#include "paddle/fluid/operators/detection/prior_box_op.h" namespace paddle { namespace operators { diff --git a/paddle/fluid/operators/prior_box_op.cu b/paddle/fluid/operators/detection/prior_box_op.cu similarity index 99% rename from paddle/fluid/operators/prior_box_op.cu rename to paddle/fluid/operators/detection/prior_box_op.cu index 0ea8909296f..f67e6ca91c0 100644 --- a/paddle/fluid/operators/prior_box_op.cu +++ b/paddle/fluid/operators/detection/prior_box_op.cu @@ -12,7 +12,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -#include "paddle/fluid/operators/prior_box_op.h" +#include "paddle/fluid/operators/detection/prior_box_op.h" namespace paddle { namespace operators { diff --git a/paddle/fluid/operators/prior_box_op.h b/paddle/fluid/operators/detection/prior_box_op.h similarity index 100% rename from paddle/fluid/operators/prior_box_op.h rename to paddle/fluid/operators/detection/prior_box_op.h diff --git a/paddle/fluid/operators/target_assign_op.cc b/paddle/fluid/operators/detection/target_assign_op.cc similarity index 98% rename from paddle/fluid/operators/target_assign_op.cc rename to paddle/fluid/operators/detection/target_assign_op.cc index 9fce216e880..36700193925 100644 --- a/paddle/fluid/operators/target_assign_op.cc +++ b/paddle/fluid/operators/detection/target_assign_op.cc @@ -12,7 +12,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -#include "paddle/fluid/operators/target_assign_op.h" +#include "paddle/fluid/operators/detection/target_assign_op.h" namespace paddle { namespace operators { diff --git a/paddle/fluid/operators/target_assign_op.cu b/paddle/fluid/operators/detection/target_assign_op.cu similarity index 97% rename from paddle/fluid/operators/target_assign_op.cu rename to paddle/fluid/operators/detection/target_assign_op.cu index 24664f99b20..ddf68899423 100644 --- a/paddle/fluid/operators/target_assign_op.cu +++ b/paddle/fluid/operators/detection/target_assign_op.cu @@ -12,7 +12,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -#include "paddle/fluid/operators/target_assign_op.h" +#include "paddle/fluid/operators/detection/target_assign_op.h" namespace paddle { namespace operators { diff --git a/paddle/fluid/operators/target_assign_op.h b/paddle/fluid/operators/detection/target_assign_op.h similarity index 100% rename from paddle/fluid/operators/target_assign_op.h rename to paddle/fluid/operators/detection/target_assign_op.h -- GitLab