Skip to content

Commit

Permalink
build(traffic_light_ssd_fine_detector): remove download logic from CMake
Browse files Browse the repository at this point in the history
Signed-off-by: Esteve Fernandez <[email protected]>
  • Loading branch information
esteve committed Sep 20, 2023
1 parent 32a3d86 commit 5099b52
Showing 1 changed file with 0 additions and 43 deletions.
43 changes: 0 additions & 43 deletions perception/traffic_light_ssd_fine_detector/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -70,48 +70,6 @@ else()
set(CUDNN_AVAIL OFF)
endif()

# Download caffemodel and prototxt
set(PRETRAINED_MODEL_HASH 34ce7f2cbacbf6da8bc35769f027b73f)
set(LAMP_LABEL_HASH e9f45efb02f2a9aa8ac27b3d5c164905)

set(DATA_PATH "${CMAKE_CURRENT_SOURCE_DIR}/data")
if(NOT EXISTS "${DATA_PATH}")
execute_process(COMMAND mkdir -p ${DATA_PATH})
endif()
function(download FILE_NAME FILE_HASH)
message(STATUS "Checking and downloading ${FILE_NAME}")
set(FILE_PATH ${DATA_PATH}/${FILE_NAME})
set(STATUS_CODE 0)
message(STATUS "start ${FILE_NAME}")
if(EXISTS ${FILE_PATH})
message(STATUS "found ${FILE_NAME}")
file(MD5 ${FILE_PATH} EXISTING_FILE_HASH)
if(${FILE_HASH} STREQUAL ${EXISTING_FILE_HASH})
message(STATUS "same ${FILE_NAME}")
message(STATUS "File already exists.")
else()
message(STATUS "diff ${FILE_NAME}")
message(STATUS "File hash changes. Downloading now ...")
file(DOWNLOAD https://awf.ml.dev.web.auto/perception/models/${FILE_NAME} ${FILE_PATH} STATUS DOWNLOAD_STATUS TIMEOUT 300)
list(GET DOWNLOAD_STATUS 0 STATUS_CODE)
list(GET DOWNLOAD_STATUS 1 ERROR_MESSAGE)
endif()
else()
message(STATUS "not found ${FILE_NAME}")
message(STATUS "File doesn't exists. Downloading now ...")
file(DOWNLOAD https://awf.ml.dev.web.auto/perception/models/${FILE_NAME} ${FILE_PATH} STATUS DOWNLOAD_STATUS TIMEOUT 300)
list(GET DOWNLOAD_STATUS 0 STATUS_CODE)
list(GET DOWNLOAD_STATUS 1 ERROR_MESSAGE)
endif()
if(${STATUS_CODE} EQUAL 0)
message(STATUS "Download completed successfully!")
else()
message(FATAL_ERROR "Error occurred during download: ${ERROR_MESSAGE}")
endif()
endfunction()
download(mb2-ssd-lite-tlr.onnx 34ce7f2cbacbf6da8bc35769f027b73f)
download(voc_labels_tl.txt e9f45efb02f2a9aa8ac27b3d5c164905)

if(TRT_AVAIL AND CUDA_AVAIL AND CUDNN_AVAIL)
include_directories(
${OpenCV_INCLUDE_DIRS}
Expand Down Expand Up @@ -174,7 +132,6 @@ if(TRT_AVAIL AND CUDA_AVAIL AND CUDNN_AVAIL)
)

ament_auto_package(INSTALL_TO_SHARE
data
launch
)

Expand Down

0 comments on commit 5099b52

Please sign in to comment.