diff --git a/CMakeLists.txt b/CMakeLists.txt index ba616b837..faa7fa4b9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -26,7 +26,7 @@ if(WIN32) endif() # Create depthai project -project(depthai VERSION "2.7.2" LANGUAGES CXX C) +project(depthai VERSION "2.8.0" LANGUAGES CXX C) get_directory_property(has_parent PARENT_DIRECTORY) if(has_parent) set(DEPTHAI_VERSION ${PROJECT_VERSION} PARENT_SCOPE) diff --git a/cmake/Depthai/DepthaiDeviceSideConfig.cmake b/cmake/Depthai/DepthaiDeviceSideConfig.cmake index abff3259e..5435ead44 100644 --- a/cmake/Depthai/DepthaiDeviceSideConfig.cmake +++ b/cmake/Depthai/DepthaiDeviceSideConfig.cmake @@ -2,7 +2,7 @@ set(DEPTHAI_DEVICE_SIDE_MATURITY "snapshot") # "full commit hash of device side binary" -set(DEPTHAI_DEVICE_SIDE_COMMIT "673983dd2b693f267cb3cb11a4247ec4a38a6508") +set(DEPTHAI_DEVICE_SIDE_COMMIT "c0a7810c9c1e7678ae65035b8f23d4cac6beb568") # "version if applicable" set(DEPTHAI_DEVICE_SIDE_VERSION "") diff --git a/examples/src/imu_rotation_vector.cpp b/examples/src/imu_rotation_vector.cpp index f2bf25c2f..ca0106859 100644 --- a/examples/src/imu_rotation_vector.cpp +++ b/examples/src/imu_rotation_vector.cpp @@ -54,7 +54,7 @@ int main() { rVvalues.j, rVvalues.k, rVvalues.real, - rVvalues.accuracy); + rVvalues.rotationVectorAccuracy); } int key = cv::waitKey(1); diff --git a/include/depthai/device/Device.hpp b/include/depthai/device/Device.hpp index 303e989b2..240f71466 100644 --- a/include/depthai/device/Device.hpp +++ b/include/depthai/device/Device.hpp @@ -25,10 +25,6 @@ #include "depthai-shared/log/LogLevel.hpp" #include "depthai-shared/log/LogMessage.hpp" -// libraries -#include "nanorpc/core/client.h" -#include "nanorpc/packer/nlohmann_msgpack.h" - namespace dai { // Device (RAII), connects to device and maintains watchdog, timesync, ... @@ -510,8 +506,6 @@ class Device { void checkClosed() const; std::shared_ptr connection; - std::unique_ptr> client; - std::mutex rpcMutex; std::vector patchedCmd; DeviceInfo deviceInfo = {}; @@ -543,9 +537,6 @@ class Device { std::thread loggingThread; std::atomic loggingRunning{true}; - // RPC stream - std::unique_ptr rpcStream; - // closed std::atomic closed{false}; diff --git a/include/depthai/device/DeviceBootloader.hpp b/include/depthai/device/DeviceBootloader.hpp index 017ac1121..f8df39c42 100644 --- a/include/depthai/device/DeviceBootloader.hpp +++ b/include/depthai/device/DeviceBootloader.hpp @@ -12,10 +12,6 @@ #include "depthai/xlink/XLinkConnection.hpp" #include "depthai/xlink/XLinkStream.hpp" -// libraries -#include "nanorpc/core/client.h" -#include "nanorpc/packer/nlohmann_msgpack.h" - // shared #include "depthai-bootloader-shared/Memory.hpp" #include "depthai-bootloader-shared/Section.hpp" diff --git a/include/depthai/openvino/OpenVINO.hpp b/include/depthai/openvino/OpenVINO.hpp index 7aea4dda8..beb9da4a4 100644 --- a/include/depthai/openvino/OpenVINO.hpp +++ b/include/depthai/openvino/OpenVINO.hpp @@ -13,7 +13,7 @@ namespace dai { class OpenVINO { public: /// OpenVINO Version supported version information - enum Version { VERSION_2020_1, VERSION_2020_2, VERSION_2020_3, VERSION_2020_4, VERSION_2021_1, VERSION_2021_2, VERSION_2021_3 }; + enum Version { VERSION_2020_3, VERSION_2020_4, VERSION_2021_1, VERSION_2021_2, VERSION_2021_3, VERSION_2021_4 }; /** * @returns Supported versions diff --git a/include/depthai/pipeline/Pipeline.hpp b/include/depthai/pipeline/Pipeline.hpp index e67de6c92..396892922 100644 --- a/include/depthai/pipeline/Pipeline.hpp +++ b/include/depthai/pipeline/Pipeline.hpp @@ -58,7 +58,7 @@ class PipelineImpl { // Pipeline asset manager AssetManager assetManager; // Default version - constexpr static auto DEFAULT_OPENVINO_VERSION = OpenVINO::Version::VERSION_2021_3; + constexpr static auto DEFAULT_OPENVINO_VERSION = OpenVINO::Version::VERSION_2021_4; // Optionally forced version tl::optional forceRequiredOpenVINOVersion; // Global pipeline properties diff --git a/include/depthai/pipeline/datatype/ImgFrame.hpp b/include/depthai/pipeline/datatype/ImgFrame.hpp index 31ac250f3..c75f181bd 100644 --- a/include/depthai/pipeline/datatype/ImgFrame.hpp +++ b/include/depthai/pipeline/datatype/ImgFrame.hpp @@ -40,32 +40,38 @@ class ImgFrame : public Buffer { // getters /** - * Retrievies image timestamp related to steady_clock / time.monotonic + * Retrieves image timestamp related to steady_clock / time.monotonic */ std::chrono::time_point getTimestamp() const; /** - * Retrievies instance number + * Retrieves image timestamp directly captured from device's monotonic clock, + * not synchronized to host time. Used mostly for debugging + */ + std::chrono::time_point getTimestampDevice() const; + + /** + * Retrieves instance number */ unsigned int getInstanceNum() const; /** - * Retrievies image category + * Retrieves image category */ unsigned int getCategory() const; /** - * Retrievies image sequence number + * Retrieves image sequence number */ unsigned int getSequenceNum() const; /** - * Retrievies image width in pixels + * Retrieves image width in pixels */ unsigned int getWidth() const; /** - * Retrievies image height in pixels + * Retrieves image height in pixels */ unsigned int getHeight() const; diff --git a/shared/depthai-shared b/shared/depthai-shared index 9b5d920d3..226a20626 160000 --- a/shared/depthai-shared +++ b/shared/depthai-shared @@ -1 +1 @@ -Subproject commit 9b5d920d354cc5dad0793b3f168159a9c62fcb09 +Subproject commit 226a20626439b4235e43e7016dcb0eb0008af4c5 diff --git a/src/device/Device.cpp b/src/device/Device.cpp index ac55fe855..afad77ec2 100644 --- a/src/device/Device.cpp +++ b/src/device/Device.cpp @@ -25,6 +25,8 @@ #include "utility/Resources.hpp" // libraries +#include "nanorpc/core/client.h" +#include "nanorpc/packer/nlohmann_msgpack.h" #include "spdlog/fmt/chrono.h" #include "spdlog/sinks/stdout_color_sinks.h" #include "spdlog/spdlog.h" @@ -187,6 +189,11 @@ class Device::Impl { // Device Logger DeviceLogger logger{"", stdoutColorSink}; + // RPC + std::mutex rpcMutex; + std::unique_ptr rpcStream; + std::unique_ptr> rpcClient; + void setLogLevel(LogLevel level); LogLevel getLogLevel(); void setPattern(const std::string& pattern); @@ -358,7 +365,7 @@ void Device::close() { if(loggingThread.joinable()) loggingThread.join(); // Close rpcStream - rpcStream = nullptr; + pimpl->rpcStream = nullptr; spdlog::debug("Device closed, {}", duration_cast(steady_clock::now() - t1).count()); } @@ -518,11 +525,12 @@ void Device::init2(bool embeddedMvcmd, bool usb2Mode, const std::string& pathToM deviceInfo.state = X_LINK_BOOTED; // prepare rpc for both attached and host controlled mode - rpcStream = std::make_unique(*connection, dai::XLINK_CHANNEL_MAIN_RPC, dai::XLINK_USB_BUFFER_MAX_SIZE); + pimpl->rpcStream = std::make_unique(*connection, dai::XLINK_CHANNEL_MAIN_RPC, dai::XLINK_USB_BUFFER_MAX_SIZE); - client = std::make_unique>([this](nanorpc::core::type::buffer request) { - // TODO(TheMarpe) - causes issues on Windows - // std::unique_lock lock(this->rpcMutex); + pimpl->rpcClient = std::make_unique>([this](nanorpc::core::type::buffer request) { + // Lock for time of the RPC call, to not mix the responses between calling threads. + // Note: might cause issues on Windows on incorrect shutdown. To be investigated + std::unique_lock lock(pimpl->rpcMutex); // Log the request data if(spdlog::get_level() == spdlog::level::trace) { @@ -530,11 +538,11 @@ void Device::init2(bool embeddedMvcmd, bool usb2Mode, const std::string& pathToM } // Send request to device - rpcStream->write(std::move(request)); + pimpl->rpcStream->write(std::move(request)); // Receive response back // Send to nanorpc to parse - return rpcStream->read(); + return pimpl->rpcStream->read(); }); // prepare watchdog thread, which will keep device alive @@ -542,7 +550,7 @@ void Device::init2(bool embeddedMvcmd, bool usb2Mode, const std::string& pathToM std::shared_ptr conn = this->connection; while(watchdogRunning) { try { - client->call("watchdogKeepalive"); + pimpl->rpcClient->call("watchdogKeepalive"); } catch(const std::exception&) { break; } @@ -845,80 +853,80 @@ std::string Device::getQueueEvent(std::chrono::microseconds timeout) { std::string Device::getMxId() { checkClosed(); - return client->call("getMxId").as(); + return pimpl->rpcClient->call("getMxId").as(); } std::vector Device::getConnectedCameras() { checkClosed(); - return client->call("getConnectedCameras").as>(); + return pimpl->rpcClient->call("getConnectedCameras").as>(); } // Convinience functions for querying current system information MemoryInfo Device::getDdrMemoryUsage() { checkClosed(); - return client->call("getDdrUsage").as(); + return pimpl->rpcClient->call("getDdrUsage").as(); } MemoryInfo Device::getCmxMemoryUsage() { checkClosed(); - return client->call("getCmxUsage").as(); + return pimpl->rpcClient->call("getCmxUsage").as(); } MemoryInfo Device::getLeonCssHeapUsage() { checkClosed(); - return client->call("getLeonCssHeapUsage").as(); + return pimpl->rpcClient->call("getLeonCssHeapUsage").as(); } MemoryInfo Device::getLeonMssHeapUsage() { checkClosed(); - return client->call("getLeonMssHeapUsage").as(); + return pimpl->rpcClient->call("getLeonMssHeapUsage").as(); } ChipTemperature Device::getChipTemperature() { checkClosed(); - return client->call("getChipTemperature").as(); + return pimpl->rpcClient->call("getChipTemperature").as(); } CpuUsage Device::getLeonCssCpuUsage() { checkClosed(); - return client->call("getLeonCssCpuUsage").as(); + return pimpl->rpcClient->call("getLeonCssCpuUsage").as(); } CpuUsage Device::getLeonMssCpuUsage() { checkClosed(); - return client->call("getLeonMssCpuUsage").as(); + return pimpl->rpcClient->call("getLeonMssCpuUsage").as(); } UsbSpeed Device::getUsbSpeed() { checkClosed(); - return client->call("getUsbSpeed").as(); + return pimpl->rpcClient->call("getUsbSpeed").as(); } bool Device::isPipelineRunning() { checkClosed(); - return client->call("isPipelineRunning").as(); + return pimpl->rpcClient->call("isPipelineRunning").as(); } void Device::setLogLevel(LogLevel level) { checkClosed(); - client->call("setLogLevel", level); + pimpl->rpcClient->call("setLogLevel", level); } LogLevel Device::getLogLevel() { checkClosed(); - return client->call("getLogLevel").as(); + return pimpl->rpcClient->call("getLogLevel").as(); } DeviceInfo Device::getDeviceInfo() { @@ -970,24 +978,24 @@ bool Device::removeLogCallback(int callbackId) { void Device::setSystemInformationLoggingRate(float rateHz) { checkClosed(); - client->call("setSystemInformationLoggingRate", rateHz); + pimpl->rpcClient->call("setSystemInformationLoggingRate", rateHz); } float Device::getSystemInformationLoggingRate() { checkClosed(); - return client->call("getSystemInformationLoggingrate").as(); + return pimpl->rpcClient->call("getSystemInformationLoggingrate").as(); } bool Device::flashCalibration(CalibrationHandler calibrationDataHandler) { if(!calibrationDataHandler.validateCameraArray()) { throw std::runtime_error("Failed to validate the extrinsics connection. Enable debug mode for more information."); } - return client->call("storeToEeprom", calibrationDataHandler.getEepromData()).as(); + return pimpl->rpcClient->call("storeToEeprom", calibrationDataHandler.getEepromData()).as(); } CalibrationHandler Device::readCalibration() { - dai::EepromData eepromData = client->call("readFromEeprom"); + dai::EepromData eepromData = pimpl->rpcClient->call("readFromEeprom"); return CalibrationHandler(eepromData); } @@ -1068,14 +1076,14 @@ bool Device::startPipeline(const Pipeline& pipeline) { } // Load pipelineDesc, assets, and asset storage - client->call("setPipelineSchema", schema); + pimpl->rpcClient->call("setPipelineSchema", schema); // Transfer storage != empty if(!assetStorage.empty()) { - client->call("setAssets", assets); + pimpl->rpcClient->call("setAssets", assets); // allocate, returns a pointer to memory on device side - auto memHandle = client->call("memAlloc", static_cast(assetStorage.size())).as(); + auto memHandle = pimpl->rpcClient->call("memAlloc", static_cast(assetStorage.size())).as(); // Transfer the whole assetStorage in a separate thread const std::string streamAssetStorage = "__stream_asset_storage"; @@ -1090,22 +1098,22 @@ bool Device::startPipeline(const Pipeline& pipeline) { }); // Open a channel to transfer AssetStorage - client->call("readFromXLink", streamAssetStorage, memHandle, assetStorage.size()); + pimpl->rpcClient->call("readFromXLink", streamAssetStorage, memHandle, assetStorage.size()); t1.join(); // After asset storage is transfers, set the asset storage - client->call("setAssetStorage", memHandle, assetStorage.size()); + pimpl->rpcClient->call("setAssetStorage", memHandle, assetStorage.size()); } // print assets on device side for test - client->call("printAssets"); + pimpl->rpcClient->call("printAssets"); // Build and start the pipeline bool success = false; std::string errorMsg; - std::tie(success, errorMsg) = client->call("buildPipeline").as>(); + std::tie(success, errorMsg) = pimpl->rpcClient->call("buildPipeline").as>(); if(success) { - client->call("startPipeline"); + pimpl->rpcClient->call("startPipeline"); } else { throw std::runtime_error(errorMsg); return false; diff --git a/src/openvino/OpenVINO.cpp b/src/openvino/OpenVINO.cpp index 0bc27d8fd..d2f4d8cd4 100644 --- a/src/openvino/OpenVINO.cpp +++ b/src/openvino/OpenVINO.cpp @@ -16,44 +16,38 @@ namespace dai { // major and minor represent openvino NN blob version information const std::map, OpenVINO::Version> OpenVINO::blobVersionToLatestOpenvinoMapping = { {{5, 0}, OpenVINO::VERSION_2020_3}, - {{6, 0}, OpenVINO::VERSION_2021_3}, - {{2020, 1}, OpenVINO::VERSION_2020_1}, - {{2020, 2}, OpenVINO::VERSION_2020_2}, + {{6, 0}, OpenVINO::VERSION_2021_4}, {{2020, 3}, OpenVINO::VERSION_2020_3}, {{2020, 4}, OpenVINO::VERSION_2020_4}, {{2021, 1}, OpenVINO::VERSION_2021_1}, {{2021, 2}, OpenVINO::VERSION_2021_2}, {{2021, 3}, OpenVINO::VERSION_2021_3}, + {{2021, 4}, OpenVINO::VERSION_2021_4}, + }; const std::map, std::vector> OpenVINO::blobVersionToOpenvinoMapping = { - {{5, 0}, {OpenVINO::VERSION_2020_1, OpenVINO::VERSION_2020_2, OpenVINO::VERSION_2020_3}}, - {{6, 0}, {OpenVINO::VERSION_2020_4, OpenVINO::VERSION_2021_1, OpenVINO::VERSION_2021_2, OpenVINO::VERSION_2021_3}}, - {{2020, 1}, {OpenVINO::VERSION_2020_1}}, - {{2020, 2}, {OpenVINO::VERSION_2020_2}}, + {{5, 0}, {OpenVINO::VERSION_2020_3}}, + {{6, 0}, {OpenVINO::VERSION_2020_4, OpenVINO::VERSION_2021_1, OpenVINO::VERSION_2021_2, OpenVINO::VERSION_2021_3, OpenVINO::VERSION_2021_4}}, {{2020, 3}, {OpenVINO::VERSION_2020_3}}, {{2020, 4}, {OpenVINO::VERSION_2020_4}}, {{2021, 1}, {OpenVINO::VERSION_2021_1}}, {{2021, 2}, {OpenVINO::VERSION_2021_2}}, {{2021, 3}, {OpenVINO::VERSION_2021_3}}, + {{2021, 4}, {OpenVINO::VERSION_2021_4}}, }; std::vector OpenVINO::getVersions() { - return {OpenVINO::VERSION_2020_1, - OpenVINO::VERSION_2020_2, - OpenVINO::VERSION_2020_3, + return {OpenVINO::VERSION_2020_3, OpenVINO::VERSION_2020_4, OpenVINO::VERSION_2021_1, OpenVINO::VERSION_2021_2, - OpenVINO::VERSION_2021_3}; + OpenVINO::VERSION_2021_3, + OpenVINO::VERSION_2021_4}; } std::string OpenVINO::getVersionName(OpenVINO::Version version) { switch(version) { - case OpenVINO::VERSION_2020_1: - return "2020.1"; - case OpenVINO::VERSION_2020_2: - return "2020.2"; case OpenVINO::VERSION_2020_3: return "2020.3"; case OpenVINO::VERSION_2020_4: @@ -64,6 +58,8 @@ std::string OpenVINO::getVersionName(OpenVINO::Version version) { return "2021.2"; case OpenVINO::VERSION_2021_3: return "2021.3"; + case OpenVINO::VERSION_2021_4: + return "2021.4"; } throw std::logic_error("OpenVINO - Unknown version enum specified"); } diff --git a/src/pipeline/datatype/ImgFrame.cpp b/src/pipeline/datatype/ImgFrame.cpp index 4a0ccd2f2..25d017139 100644 --- a/src/pipeline/datatype/ImgFrame.cpp +++ b/src/pipeline/datatype/ImgFrame.cpp @@ -21,6 +21,10 @@ std::chrono::time_point{seconds(img.ts.sec) + nanoseconds(img.ts.nsec)}; } +std::chrono::time_point ImgFrame::getTimestampDevice() const { + using namespace std::chrono; + return time_point{seconds(img.tsDevice.sec) + nanoseconds(img.tsDevice.nsec)}; +} unsigned int ImgFrame::getInstanceNum() const { return img.instanceNum; } diff --git a/src/utility/Resources.cpp b/src/utility/Resources.cpp index ca1ce18b8..3f8e00f19 100644 --- a/src/utility/Resources.cpp +++ b/src/utility/Resources.cpp @@ -31,40 +31,38 @@ namespace dai { constexpr static auto CMRC_DEPTHAI_DEVICE_TAR_XZ = "depthai-device-fwp-" DEPTHAI_DEVICE_VERSION ".tar.xz"; // Main FW -constexpr static auto DEPTHAI_CMD_OPENVINO_2021_3_PATH = "depthai-device-openvino-2021.3-" DEPTHAI_DEVICE_VERSION ".cmd"; +constexpr static auto DEPTHAI_CMD_OPENVINO_2021_4_PATH = "depthai-device-openvino-2021.4-" DEPTHAI_DEVICE_VERSION ".cmd"; // Patches from Main FW -constexpr static auto DEPTHAI_CMD_OPENVINO_2020_1_PATCH_PATH = "depthai-device-openvino-2020.1-" DEPTHAI_DEVICE_VERSION ".patch"; + constexpr static auto DEPTHAI_CMD_OPENVINO_2020_3_PATCH_PATH = "depthai-device-openvino-2020.3-" DEPTHAI_DEVICE_VERSION ".patch"; -constexpr static auto DEPTHAI_CMD_OPENVINO_2020_2_PATCH_PATH = DEPTHAI_CMD_OPENVINO_2020_3_PATCH_PATH; constexpr static auto DEPTHAI_CMD_OPENVINO_2020_4_PATCH_PATH = "depthai-device-openvino-2020.4-" DEPTHAI_DEVICE_VERSION ".patch"; constexpr static auto DEPTHAI_CMD_OPENVINO_2021_1_PATCH_PATH = "depthai-device-openvino-2021.1-" DEPTHAI_DEVICE_VERSION ".patch"; constexpr static auto DEPTHAI_CMD_OPENVINO_2021_2_PATCH_PATH = "depthai-device-openvino-2021.2-" DEPTHAI_DEVICE_VERSION ".patch"; +constexpr static auto DEPTHAI_CMD_OPENVINO_2021_3_PATCH_PATH = "depthai-device-openvino-2021.3-" DEPTHAI_DEVICE_VERSION ".patch"; // Usb2 patches -constexpr static auto DEPTHAI_CMD_OPENVINO_2020_1_USB2_PATCH_PATH = "depthai-device-usb2-patch-openvino-2020.1-" DEPTHAI_DEVICE_VERSION ".patch"; constexpr static auto DEPTHAI_CMD_OPENVINO_2020_3_USB2_PATCH_PATH = "depthai-device-usb2-patch-openvino-2020.3-" DEPTHAI_DEVICE_VERSION ".patch"; -constexpr static auto DEPTHAI_CMD_OPENVINO_2020_2_USB2_PATCH_PATH = DEPTHAI_CMD_OPENVINO_2020_3_USB2_PATCH_PATH; constexpr static auto DEPTHAI_CMD_OPENVINO_2020_4_USB2_PATCH_PATH = "depthai-device-usb2-patch-openvino-2020.4-" DEPTHAI_DEVICE_VERSION ".patch"; constexpr static auto DEPTHAI_CMD_OPENVINO_2021_1_USB2_PATCH_PATH = "depthai-device-usb2-patch-openvino-2021.1-" DEPTHAI_DEVICE_VERSION ".patch"; constexpr static auto DEPTHAI_CMD_OPENVINO_2021_2_USB2_PATCH_PATH = "depthai-device-usb2-patch-openvino-2021.2-" DEPTHAI_DEVICE_VERSION ".patch"; constexpr static auto DEPTHAI_CMD_OPENVINO_2021_3_USB2_PATCH_PATH = "depthai-device-usb2-patch-openvino-2021.3-" DEPTHAI_DEVICE_VERSION ".patch"; +constexpr static auto DEPTHAI_CMD_OPENVINO_2021_4_USB2_PATCH_PATH = "depthai-device-usb2-patch-openvino-2021.4-" DEPTHAI_DEVICE_VERSION ".patch"; -constexpr static std::array RESOURCE_LIST_DEVICE = { - DEPTHAI_CMD_OPENVINO_2021_3_PATH, - DEPTHAI_CMD_OPENVINO_2020_1_PATCH_PATH, +constexpr static std::array RESOURCE_LIST_DEVICE = { DEPTHAI_CMD_OPENVINO_2020_3_PATCH_PATH, - DEPTHAI_CMD_OPENVINO_2020_2_PATCH_PATH, DEPTHAI_CMD_OPENVINO_2020_4_PATCH_PATH, DEPTHAI_CMD_OPENVINO_2021_1_PATCH_PATH, DEPTHAI_CMD_OPENVINO_2021_2_PATCH_PATH, - DEPTHAI_CMD_OPENVINO_2020_1_USB2_PATCH_PATH, - DEPTHAI_CMD_OPENVINO_2020_2_USB2_PATCH_PATH, + DEPTHAI_CMD_OPENVINO_2021_3_PATCH_PATH, + DEPTHAI_CMD_OPENVINO_2021_4_PATH, DEPTHAI_CMD_OPENVINO_2020_3_USB2_PATCH_PATH, DEPTHAI_CMD_OPENVINO_2020_4_USB2_PATCH_PATH, DEPTHAI_CMD_OPENVINO_2021_1_USB2_PATCH_PATH, DEPTHAI_CMD_OPENVINO_2021_2_USB2_PATCH_PATH, DEPTHAI_CMD_OPENVINO_2021_3_USB2_PATCH_PATH, + DEPTHAI_CMD_OPENVINO_2021_4_USB2_PATCH_PATH, + }; std::vector Resources::getDeviceBinary(OpenVINO::Version version, bool usb2Mode) { @@ -90,25 +88,13 @@ std::vector Resources::getDeviceBinary(OpenVINO::Version version, // Temporary binary std::vector tmpDepthaiBinary; // Main FW - std::vector depthaiBinary = resourceMapDevice[DEPTHAI_CMD_OPENVINO_2021_3_PATH]; + std::vector depthaiBinary = resourceMapDevice[DEPTHAI_CMD_OPENVINO_2021_4_PATH]; // Patch from main to specified - std::vector depthaiPatch = resourceMapDevice[DEPTHAI_CMD_OPENVINO_2021_2_PATCH_PATH]; + std::vector depthaiPatch = resourceMapDevice[DEPTHAI_CMD_OPENVINO_2021_3_PATCH_PATH]; // Patch from specified to usb2 specified - std::vector depthaiUsb2Patch = resourceMapDevice[DEPTHAI_CMD_OPENVINO_2021_3_USB2_PATCH_PATH]; + std::vector depthaiUsb2Patch = resourceMapDevice[DEPTHAI_CMD_OPENVINO_2021_4_USB2_PATCH_PATH]; switch(version) { - case OpenVINO::VERSION_2020_1: - spdlog::warn("OpenVino version 2020.1 is deprecated and will be removed in the next release!"); - depthaiPatch = resourceMapDevice[DEPTHAI_CMD_OPENVINO_2020_1_PATCH_PATH]; - depthaiUsb2Patch = resourceMapDevice[DEPTHAI_CMD_OPENVINO_2020_1_USB2_PATCH_PATH]; - break; - - case OpenVINO::VERSION_2020_2: - spdlog::warn("OpenVino version 2020.2 is deprecated and will be removed in the next release!"); - depthaiPatch = resourceMapDevice[DEPTHAI_CMD_OPENVINO_2020_2_PATCH_PATH]; - depthaiUsb2Patch = resourceMapDevice[DEPTHAI_CMD_OPENVINO_2020_2_USB2_PATCH_PATH]; - break; - case OpenVINO::VERSION_2020_3: depthaiPatch = resourceMapDevice[DEPTHAI_CMD_OPENVINO_2020_3_PATCH_PATH]; depthaiUsb2Patch = resourceMapDevice[DEPTHAI_CMD_OPENVINO_2020_3_USB2_PATCH_PATH]; @@ -130,14 +116,19 @@ std::vector Resources::getDeviceBinary(OpenVINO::Version version, break; case OpenVINO::VERSION_2021_3: - depthaiBinary = resourceMapDevice[DEPTHAI_CMD_OPENVINO_2021_3_PATH]; + depthaiPatch = resourceMapDevice[DEPTHAI_CMD_OPENVINO_2021_3_PATCH_PATH]; depthaiUsb2Patch = resourceMapDevice[DEPTHAI_CMD_OPENVINO_2021_3_USB2_PATCH_PATH]; break; + + case OpenVINO::VERSION_2021_4: + depthaiBinary = resourceMapDevice[DEPTHAI_CMD_OPENVINO_2021_4_PATH]; + depthaiUsb2Patch = resourceMapDevice[DEPTHAI_CMD_OPENVINO_2021_4_USB2_PATCH_PATH]; + break; } // is patching required? - if(version != OpenVINO::VERSION_2021_3) { - spdlog::debug("Patching OpenVINO FW version from {} to {}", OpenVINO::getVersionName(OpenVINO::VERSION_2021_3), OpenVINO::getVersionName(version)); + if(version != OpenVINO::VERSION_2021_4) { + spdlog::debug("Patching OpenVINO FW version from {} to {}", OpenVINO::getVersionName(OpenVINO::VERSION_2021_4), OpenVINO::getVersionName(version)); // Get new size int64_t patchedSize = bspatch_mem_get_newsize(depthaiPatch.data(), depthaiPatch.size()); diff --git a/src/utility/Resources.hpp b/src/utility/Resources.hpp index 1e8cddb05..1ebb9051f 100644 --- a/src/utility/Resources.hpp +++ b/src/utility/Resources.hpp @@ -35,7 +35,7 @@ class Resources { void operator=(Resources const&) = delete; // Available resources - std::vector getDeviceFirmware(bool usb2Mode, OpenVINO::Version version = OpenVINO::VERSION_2020_1); + std::vector getDeviceFirmware(bool usb2Mode, OpenVINO::Version version = OpenVINO::VERSION_2021_4); std::vector getBootloaderFirmware(DeviceBootloader::Type type = DeviceBootloader::Type::USB); }; diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index a3d3a44d9..6b258c53b 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -72,6 +72,14 @@ hunter_private_data( FILE "text-image-super-resolution-0001_2021.3_4shave.blob" LOCATION openvino_2021_3_blob ) +# OpenVINO 2021.4 blob +hunter_private_data( + URL "https://artifacts.luxonis.com/artifactory/luxonis-depthai-data-local/network/text-image-super-resolution-0001_2021.4_4shave.blob" + SHA1 "fd11bb63781fc3315cdf4bb74247a8b98817f6fd" + FILE "text-image-super-resolution-0001_2021.4_4shave.blob" + LOCATION openvino_2021_4_blob +) + # Add tests dai_add_test(color_camera_node_test src/color_camera_node_test.cpp) @@ -88,6 +96,7 @@ target_compile_definitions(openvino_blob PRIVATE OPENVINO_2021_1_BLOB_PATH="${openvino_2021_1_blob}" OPENVINO_2021_2_BLOB_PATH="${openvino_2021_2_blob}" OPENVINO_2021_3_BLOB_PATH="${openvino_2021_3_blob}" + OPENVINO_2021_4_BLOB_PATH="${openvino_2021_4_blob}" ) diff --git a/tests/src/openvino_blob_test.cpp b/tests/src/openvino_blob_test.cpp index 722acdb8d..928e8cc76 100644 --- a/tests/src/openvino_blob_test.cpp +++ b/tests/src/openvino_blob_test.cpp @@ -51,4 +51,13 @@ TEST_CASE("OpenVINO 2021.3 blob") { auto networkOpenvinoVersion = p.getOpenVINOVersion(); REQUIRE(networkOpenvinoVersion == dai::OpenVINO::VERSION_2021_3); dai::Device d(p); +} + +TEST_CASE("OpenVINO 2021.4 blob") { + dai::Pipeline p; + auto nn = p.create(); + nn->setBlobPath(OPENVINO_2021_4_BLOB_PATH); + auto networkOpenvinoVersion = p.getOpenVINOVersion(); + REQUIRE(networkOpenvinoVersion == dai::OpenVINO::VERSION_2021_4); + dai::Device d(p); } \ No newline at end of file