AR 眼鏡之-條形碼識別-實現方案

目錄

📂 前言

AR 眼鏡系統版本

條形碼識別

1. 🔱 技術方案

1.1 技術方案概述

1.2 實現方案

1)相機App顯示模塊

2)算法so庫JNI模塊

3)算法條形碼識別模塊

2. 💠 實現相機App顯示模塊

2.1 創建 BarcodeIdentifyDemoActivity.kt

2.2 創建 activity_barcode_identify_demo.xml

2.3 創建 AlgorithmLibHelper.kt

2.4 創建 AssetsHelper.kt

2.5 創建 ProductBean.kt

3. ?? 算法so庫JNI模塊

3.1 新建CMakeLists.txt,引入算法so庫以及頭文件

1)CMakeLists.txt 內容如下:

2)引入算法so庫以及頭文件

3.2 新建cpp文件,調用算法so庫方法

3.3 新建native方法,加載JNI模塊生成的庫以及映射對應方法

3.4 配置 build.gradle 文件

4. ? 小結


📂 前言

AR 眼鏡系統版本

????????W517 Android9。

條形碼識別

????????AR眼鏡中相機App,調用算法條形碼識別接口,獲取到算法接口返回文本后,將文本顯示在眼鏡頁面。

1. 🔱 技術方案

1.1 技術方案概述

????????條形碼識別功能的實現,主要包括以下三大模塊:相機App顯示模塊、算法so庫JNI模塊、以及算法條形碼識別模塊。

1.2 實現方案

1)相機App顯示模塊
  1. 實現相機預覽、拍照與保存功能;

  2. 傳入拍照后的圖片路徑,調用算法so庫JNI模塊;

  3. 顯示算法so庫JNI模塊返回的條形碼識別到的商品信息。

2)算法so庫JNI模塊
  1. 新建CMakeLists.txt,引入算法so庫以及頭文件;

  2. 新建cpp文件,調用算法so庫方法;

  3. 新建native方法,加載JNI模塊生成的庫以及映射對應方法。

3)算法條形碼識別模塊
  1. 對照片進行處理,獲取到照片中的二維碼;

  2. 調用二維碼識別so庫,獲取二維碼中的信息;

  3. 將二維碼信息與數據庫匹配,返回匹配到的商品信息。

2. 💠 實現相機App顯示模塊

2.1 創建 BarcodeIdentifyDemoActivity.kt

????????主要實現相機預覽、拍照與保存等功能。可參考《一周內從0到1開發一款 AR眼鏡 相機應用?》

class BarcodeIdentifyDemoActivity :BaseActivity<ActivityBarcodeIdentifyDemoBinding, MainViewModel>() {private val TAG = BarcodeIdentifyDemoActivity::class.java.simpleNameprivate val DEFAULT_CONTENT ="    \"商品名稱\": \"\",\n" + "    \"品牌\": \"\",\n" + "    \"規格型號\": \"\",\n" + "    \"價格\": \"\",\n" + "    \"原產地\": \"\",\n" + "    \"稅率\": \"\",\n" + "    \"稅號\": \"\",\n" + "    \"功能用途\":\"\""private val CAMERA_MAX_RESOLUTION = Size(3264, 2448)private var mCameraExecutor: ExecutorService = Executors.newSingleThreadExecutor()private var mImageCapture: ImageCapture? = nullprivate var mIsBarcodeRecognition: Boolean = falseprivate var mTimeOut: CountDownTimer? = nulloverride fun initBinding(inflater: LayoutInflater): ActivityBarcodeIdentifyDemoBinding =ActivityBarcodeIdentifyDemoBinding.inflate(inflater)override fun initData() {AlgorithmLibHelper.init(this)AlgorithmLibHelper.productBeanLiveData.observe(this) {Log.i(TAG, "initData: $it")if (it != null) {runOnUiThread {binding.loading.visibility = GONEmIsBarcodeRecognition = falsebinding.content.text ="    \"商品名稱\": \"${it.product_name}\",\n" + "    \"品牌\": \"${it.brand}\",\n" + "    \"規格型號\": \"${it.specifications}\",\n" + "    \"價格\": \"${it.price}\",\n" + "    \"原產地\": \"${it.country_of_origin}\",\n" + "    \"稅率\": \"${it.tax_rate}\",\n" + "    \"稅號\": \"${it.tax_code}\",\n" + "    \"功能用途\":\"${it.function_and_use}\""mTimeOut?.cancel()mTimeOut = null}} else {errorHandle()}}}override fun initViewModel() {viewModel.init(this)}override fun initView() {initWindow()switchToPhoto()binding.parent.setOnClickListener {try {if (mImageCapture == null || mIsBarcodeRecognition) {AGGToast(this, Toast.LENGTH_SHORT, "please hold on").show()} else {mIsBarcodeRecognition = truebinding.loading.setContent("Identify...")binding.loading.visibility = VISIBLEtakePicture()}} catch (e: Exception) {e.printStackTrace()}}binding.loading.visibility = VISIBLE}override fun onResume() {Log.i(TAG, "onResume: ")super.onResume()}override fun onStop() {Log.i(TAG, "onStop: ")super.onStop()}override fun onDestroy() {Log.i(TAG, "onDestroy: ")mTimeOut?.cancel()mTimeOut = nullAnimatorSwitchHelper.isAnimating = falseAnimatorSwitchHelper.isFirstSwitch = truesuper.onDestroy()mCameraExecutor.shutdown()XrEnvironment.getInstance().imuReset()AlgorithmLibHelper.release()}private fun initWindow() {Log.i(TAG, "initWindow: ")val lp = window.attributeslp.dofIndex = 0lp.subType = WindowManager.LayoutParams.WINDOW_IMMERSIVE_0DOFwindow.attributes = lp}private fun switchToPhoto() {Log.i(TAG, "switchToPhoto: ")val cameraProviderFuture = ProcessCameraProvider.getInstance(this)cameraProviderFuture.addListener({try {mImageCapture = ImageCapture.Builder().setCaptureMode(ImageCapture.CAPTURE_MODE_MAXIMIZE_QUALITY).setTargetResolution(CAMERA_MAX_RESOLUTION).build()val cameraSelector = CameraSelector.DEFAULT_BACK_CAMERAval cameraProvider = cameraProviderFuture.get()cameraProvider.unbindAll()// 可預覽val preview = Preview.Builder().build()binding.previewView.apply {implementationMode = PreviewView.ImplementationMode.COMPATIBLEpreview.setSurfaceProvider(surfaceProvider)clipToOutline = truevisibility = VISIBLE}cameraProvider.bindToLifecycle(this, cameraSelector, preview, mImageCapture)// 無預覽
//                cameraProvider.bindToLifecycle(this, cameraSelector, mImageCapture)binding.loading.visibility = GONE} catch (e: java.lang.Exception) {Log.e(TAG, "bindCamera Failed!: $e")}}, ContextCompat.getMainExecutor(this))}/*** 拍照*/private fun takePicture() {Log.i(TAG, "takePicture: ")SoundPoolTools.playCameraPhoto(this)val photoFile = viewModel.createPhotoFile()mImageCapture?.takePicture(ImageCapture.OutputFileOptions.Builder(photoFile).build(),mCameraExecutor,object : ImageCapture.OnImageSavedCallback {override fun onError(exc: ImageCaptureException) {Log.e(TAG, "Photo capture failed: ${exc.message}", exc)}@SuppressLint("SetTextI18n")override fun onImageSaved(output: ImageCapture.OutputFileResults) {val savedUri = output.savedUri ?: Uri.fromFile(photoFile)Log.i(TAG, "Photo capture succeeded: ${savedUri.path}")runOnUiThread { updateFlashPreview(savedUri) }viewModel.updateMediaFile(this@BarcodeIdentifyDemoActivity, photoFile)// 調用條形碼識別算法lifecycleScope.launch {withContext(Dispatchers.IO) {savedUri.path?.let {AlgorithmLibHelper.identifyBarcode(it)}}}// 超時邏輯runOnUiThread {mTimeOut?.cancel()mTimeOut = nullmTimeOut = object : CountDownTimer(15000L, 1000) {override fun onTick(millisUntilFinished: Long) {}override fun onFinish() {Log.e(TAG, "onFinish: identify timeout")AGGToast(this@BarcodeIdentifyDemoActivity,Toast.LENGTH_SHORT,"identify timeout").show()errorHandle()}}.start()}}})}private fun updateFlashPreview(savedUri: Uri) {binding.flashPreview.apply {visibility = VISIBLEGlide.with(this@BarcodeIdentifyDemoActivity).load(savedUri).into(this)// 創建動畫val animatorAlpha = ObjectAnimator.ofFloat(this, "alpha", 0f, 1f)val animatorX = ObjectAnimator.ofFloat(this, "translationX", 0f, SizeUtils.dp2px(-144f).toFloat())// 同時播放X和Y軸的動畫val animatorSet = AnimatorSet()animatorSet.playTogether(animatorAlpha, animatorX)animatorSet.interpolator = EaseOutInterpolator()animatorSet.duration = CAMERA_FLASH_PREVIEW_ANIM_TIMEanimatorSet.start()// 設置動畫監聽器,在動畫結束后等待2秒,然后隱藏圖片animatorSet.addListener(object : AnimatorListenerAdapter() {override fun onAnimationEnd(animation: Animator) {super.onAnimationEnd(animation)// 2秒后隱藏圖片postDelayed({visibility = GONE}, CAMERA_FLASH_PREVIEW_SHOW_TIME)}})}}private fun errorHandle() {runOnUiThread {binding.content.text = DEFAULT_CONTENTbinding.loading.visibility = GONEmIsBarcodeRecognition = falsemTimeOut?.cancel()mTimeOut = null}}}

2.2 創建 activity_barcode_identify_demo.xml

????????包括顯示算法so庫JNI模塊返回的條形碼識別到的商品信息。

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"xmlns:app="http://schemas.android.com/apk/res-auto"android:id="@+id/parent"android:layout_width="match_parent"android:layout_height="match_parent"android:keepScreenOn="true"><com.agg.ui.AGGActionBarandroid:id="@+id/title"android:layout_width="wrap_content"android:layout_height="wrap_content"app:UIActionBarTitle="Barcode Identify"app:UITitleLevel="M"app:layout_constraintStart_toStartOf="parent"app:layout_constraintTop_toTopOf="parent" /><com.agg.ui.AGGTextViewandroid:id="@+id/content"style="@style/TextBody5"android:layout_width="match_parent"android:layout_height="0dp"android:layout_marginHorizontal="32dp"android:layout_marginTop="16dp"android:layout_marginBottom="64dp"android:gravity="center_vertical|start"app:layout_constraintBottom_toBottomOf="parent"app:layout_constraintEnd_toEndOf="parent"app:layout_constraintStart_toStartOf="parent"app:layout_constraintTop_toBottomOf="@id/title" /><androidx.camera.view.PreviewViewandroid:id="@+id/previewView"android:layout_width="138dp"android:layout_height="104dp"android:layout_marginEnd="24dp"android:layout_marginBottom="24dp"android:background="@drawable/shape_corner_20dp_stroke_4dp_ffffff"android:foreground="@drawable/shape_corner_20dp_stroke_4dp_ffffff"android:visibility="gone"app:layout_constraintBottom_toBottomOf="parent"app:layout_constraintEnd_toEndOf="parent" /><com.agg.ui.AGGCircleImageViewandroid:id="@+id/flashPreview"android:layout_width="138dp"android:layout_height="104dp"android:layout_marginEnd="24dp"android:layout_marginBottom="24dp"android:contentDescription="@null"android:visibility="gone"app:borderColor="#FFFFC810"app:borderWidth="4dp"app:layout_constraintBottom_toBottomOf="parent"app:layout_constraintEnd_toEndOf="parent"app:radius="20dp" /><com.agg.ui.AGGIdentifyandroid:id="@+id/loading"android:layout_width="wrap_content"android:layout_height="wrap_content"app:UIContent="Open Camera..."app:layout_constraintBottom_toBottomOf="parent"app:layout_constraintEnd_toEndOf="parent"app:layout_constraintStart_toStartOf="parent"app:layout_constraintTop_toTopOf="parent" /></androidx.constraintlayout.widget.ConstraintLayout>

2.3 創建 AlgorithmLibHelper.kt

????????訪問條形碼算法的幫助類,進行封裝隔離,通過傳入拍照后的圖片路徑,調用算法so庫JNI模塊。

object AlgorithmLibHelper {val productBeanLiveData = MutableLiveData<ProductBean>()private val TAG = AlgorithmLibHelper::class.java.simpleNameprivate var algorithmLib: AlgorithmLib? = nullfun init(context: Context) {Log.i(TAG, "init: ")val jsonFilePath = getJsonFilePath(context, "barcode_information_final.json")Log.i(TAG, "init: jsonFilePath=$jsonFilePath")algorithmLib = AlgorithmLib()algorithmLib?.initMatch(jsonFilePath)}fun identifyBarcode(imagePath: String) = runBlocking {Log.i(TAG, "identifyBarcode: imagePath=$imagePath")val identifyBarContent = algorithmLib?.matchBarcode(imagePath) ?: ""Log.i(TAG, "identifyBarcode: identifyBarContent=$identifyBarContent")if (identifyBarContent.isNotEmpty()) {try {val productInfo = GsonUtils.fromJson(identifyBarContent, ProductInfo::class.java)productBeanLiveData.postValue(productInfo.product_info)} catch (e: Exception) {e.printStackTrace()productBeanLiveData.postValue(ProductBean())}} else {productBeanLiveData.postValue(ProductBean())}}fun release() {Log.i(TAG, "release: ")algorithmLib = null}}

2.4 創建 AssetsHelper.kt

????????由于算法庫的商品數據庫,采用的本地json數據庫,所以當前技術方案就是通過app預先在源代碼路徑中放好json文件,然后動態將json文件拷貝到應用路徑下,方便算法庫讀取與查詢。

object AssetsHelper {fun getJsonFilePath(context: Context, assetName: String): String {val targetPath =AGGFileUtils.getMediaOutputDirectory(context as ContextWrapper).absolutePath + File.separator + assetNamecopyAssetToFile(context, assetName, targetPath)return targetPath}private fun copyAssetToFile(context: Context, assetName: String, targetPath: String) {val assetManager = context.assetsval inputStream: InputStream = assetManager.open(assetName)val file = File(targetPath)val outputStream = FileOutputStream(file)val buffer = ByteArray(1024)var read: Intwhile (inputStream.read(buffer).also { read = it } != -1) {outputStream.write(buffer, 0, read)}outputStream.flush()outputStream.close()inputStream.close()}}

????????在src/main/assets/ 路徑下放置 barcode_information_final.json 文件。

2.5 創建 ProductBean.kt

????????商品信息的數據Bean,通過算法庫返回的商品Json數據格式轉換。

data class ProductBean(var product_name: String = "",var brand: String = "",var specifications: String = "",var price: String = "",var country_of_origin: String = "",var tax_rate: String = "",var tax_code: String = "",var function_and_use: String = "",
)data class ProductInfo(var product_info: ProductBean)/*
{"product_info": {"brand": "舒膚佳","country_of_origin": "中國","function_and_use": "用于日常清潔皮膚,有效去除污垢和細菌","price": "¥3.50","product_name": "香皂","specifications": "115G","tax_code": "1","tax_rate": "13%"}
}
*/

3. ?? 算法so庫JNI模塊

  1. 新建CMakeLists.txt,引入算法so庫以及頭文件;

  2. 新建cpp文件,調用算法so庫方法;

  3. 新建native方法,加載JNI模塊生成的庫以及映射對應方法。

3.1 新建CMakeLists.txt,引入算法so庫以及頭文件

1)CMakeLists.txt 內容如下:
# 1. 設置 CMake 的最低版本要求
cmake_minimum_required(VERSION 3.22.1)# 2. 設置項目名稱和支持的語言
project(BarcodeIdentify C CXX)# 3.1 指定頭文件目錄
include_directories(${PROJECT_SOURCE_DIR}/include)# 3.2 添加一個共享庫目標:創建一個共享庫來使用.so 庫
add_library( # Sets the name of the library.barcode_match_jni# Sets the library as a shared library.SHARED# Provides a relative path to your source file(s).BarcodeMatchJni.cpp)
add_library( # Sets the name of the library.lib_barcode_match_interface# Sets the library as a shared library.SHARED# Provides a relative path to your source file(s).IMPORTED)
add_library( # Sets the name of the library.lib_barcode_match# Sets the library as a shared library.SHARED# Provides a relative path to your source file(s).IMPORTED)
add_library( # Sets the name of the library.lib_ZXing# Sets the library as a shared library.SHARED# Provides a relative path to your source file(s).IMPORTED)# 4. 設置 .so 文件的路徑
set_target_properties(lib_barcode_match_interfacePROPERTIES IMPORTED_LOCATION${PROJECT_SOURCE_DIR}/lib/armeabi-v7a/libbarcode_match_interface.so)
set_target_properties(lib_barcode_matchPROPERTIES IMPORTED_LOCATION${PROJECT_SOURCE_DIR}/lib/armeabi-v7a/libbarcode_match.so)
set_target_properties(lib_ZXingPROPERTIES IMPORTED_LOCATION${PROJECT_SOURCE_DIR}/lib/armeabi-v7a/libZXing.so)# 5.1 鏈接系統庫(例如 log 庫)
find_library( # Sets the name of the path variable.log-lib# Specifies the name of the NDK library that# you want CMake to locate.log)
# 5.2 鏈接.so 庫到目標
target_link_libraries( # Specifies the target library.barcode_match_jnilib_barcode_match_interfacelib_barcode_matchlib_ZXing# Links the target library to the log library# included in the NDK.${log-lib})
2)引入算法so庫以及頭文件

????????算法 barcode_match_interface.h 頭文件如下:

#ifndef BARCODE_MATCH_INTERFACE_H
#define BARCODE_MATCH_INTERFACE_H
#include <string>
class barcode_match_interface
{
private:void *barcode_match;
public:barcode_match_interface(/* args */);~barcode_match_interface();int init_barcode_match_interface(std::string json_input_path);std::string barcode_match_process(std::string input_img_path);
};#endif

3.2 新建cpp文件,調用算法so庫方法

#include <jni.h>
#include <string>
#include <android/log.h>
#include "barcode_match_interface.h" // 包含算法庫的頭文件#define ALOGD(tag, ...) __android_log_print(ANDROID_LOG_DEBUG, tag, __VA_ARGS__)// 創建一個全局指針,用于存儲 BarcodeMatch 類的實例
barcode_match_interface* barcodeMatchInstance = nullptr;// 實現 JNI 方法:initMatch
extern "C"
JNIEXPORT jint JNICALL
Java_com_agg_mocamera_portal_feature_demo_lib_AlgorithmLib_initMatch(JNIEnv* env, jobject thiz, jstring jsonInputPath) {const char* nativeJsonInputPath = env->GetStringUTFChars(jsonInputPath, nullptr);barcodeMatchInstance = new barcode_match_interface();int result = barcodeMatchInstance->init_barcode_match_interface(std::string(nativeJsonInputPath));env->ReleaseStringUTFChars(jsonInputPath, nativeJsonInputPath);if (result != 0) {delete barcodeMatchInstance;barcodeMatchInstance = nullptr;}return result;return 0;
}// 實現 JNI 方法:matchBarcode
extern "C"
JNIEXPORT jstring JNICALL
Java_com_agg_mocamera_portal_feature_demo_lib_AlgorithmLib_matchBarcode(JNIEnv *env, jobject thiz, jstring inputImagePath) {const char* nativeInputImagePath = env->GetStringUTFChars(inputImagePath, nullptr);std::string result;if (barcodeMatchInstance != nullptr) {result = barcodeMatchInstance->barcode_match_process(std::string(nativeInputImagePath));} else {result = "Error: BarcodeMatch instance not initialized";}ALOGD("TAG-AGG","%s", result.c_str());env->ReleaseStringUTFChars(inputImagePath, nativeInputImagePath);return env->NewStringUTF(result.c_str());
}

3.3 新建native方法,加載JNI模塊生成的庫以及映射對應方法

class AlgorithmLib {external fun initMatch(jsonInputPath: String): Intexternal fun matchBarcode(imagePath: String): Stringcompanion object {init {System.loadLibrary("barcode_match_jni")}}}

3.4 配置 build.gradle 文件

????????在build.gradle文件中,確保項目支持所需的ABI架構。

android {defaultConfig {ndk {abiFilters 'armeabi-v7a'}}

????????在 build.gradle 文件中配置 CMake。

android {externalNativeBuild {cmake {path "src/main/cpp/CMakeLists.txt"}}

注:對于算法條形碼識別模塊,由于篇幅與技術棧問題,本文就不再贅述。

4. ? 小結

????????對于條形碼識別,本文只是一個基礎實現方案,更多業務細節請參考產品邏輯去實現。

????????另外,由于本人能力有限,如有錯誤,敬請批評指正,謝謝。


本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/910626.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/910626.shtml
英文地址,請注明出處:http://en.pswp.cn/news/910626.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

華為云 Flexus+DeepSeek 征文|基于 CCE 集群部署 Dify 平臺工作流:科研論文翻譯與 SEO 優化工具的全流程設計實踐

華為云 FlexusDeepSeek 征文&#xff5c;基于 CCE 集群部署 Dify 平臺工作流&#xff1a;科研論文翻譯與 SEO 優化工具的全流程設計實踐 背景 作為被科研論文折磨已久的大學生&#xff0c;希望研究成果能被更多人看到&#xff0c;尤其是在學術全球化的趨勢下&#xff0c;論文翻…

C++對象繼承詳解:從入門到精通

繼承是面向對象編程的三大特性之一&#xff0c;也是C中實現代碼復用和多態的重要機制。本文將帶你深入理解C繼承的核心概念與應用。 一、繼承的基本概念 1.1 什么是繼承&#xff1f; 繼承允許我們基于已有的類創建新類&#xff0c;新類&#xff08;派生類&#xff09;可以繼…

Jenkins安裝與配置全攻略:從入門到高級功能實戰

在DevOps實踐中,Jenkins作為最流行的持續集成工具之一,扮演著至關重要的角色。本文將全面介紹Jenkins的安裝、配置及高級功能使用,幫助開發、運維和測試團隊快速搭建高效的CI/CD流水線。 一、Jenkins安裝 1.1 環境準備 Jenkins官網:https://jenkins.io 注意:Jenkins 2…

[OS_26] 計算機系統安全 | CIA原則 | 側信道攻擊

系統調用是唯一訪問操作系統對象的途徑 拒絕越權訪問 →→ Confidentiality拒絕越權修改 →→ Integrity(再加上公平資源調度 →→ Availability) 在操作系統 API 上&#xff0c;我們可以構建命令行工具、編譯器、數據庫、瀏覽器等豐富的應用。 當越來越多用戶開始共享計算機、…

Chromium 136 編譯指南 macOS篇:編譯優化技巧(六)

1. 引言 在現代軟件開發的高效化進程中&#xff0c;編譯優化已經從簡單的性能調優發展為一門綜合性的工程科學。對于Chromium 136這樣一個包含超過2500萬行代碼的超大規模項目而言&#xff0c;編譯時間往往成為制約開發效率的關鍵瓶頸。在典型的開發場景中&#xff0c;一次完整…

Spark教程6:Spark 底層執行原理詳解

文章目錄 一、整體架構概述二、核心組件詳解1. SparkContext2. DAG Scheduler3. Task Scheduler4. Executor 三、作業執行流程1. DAG 生成與 Stage 劃分2. Task 調度與執行3. 內存管理 四、Shuffle 機制詳解1. Shuffle 過程2. Shuffle 優化 五、內存管理機制1. 統一內存管理&am…

xlsx-style 插件批量導出多個sheet表格excel中遇到的問題及解決

Vue2中 前端界面導出表格&#xff0c;使用XLSXS插件版本(^0.8.13)導出表格存在表格背景顏色無法正常展示&#xff0c;百分比數據沒有正常展示 【有條件的盡量先升級高版本插件&#xff0c;此插件版本對樣式支持度不夠】 優先考慮插件版本升級 同樣的使用方法在vue3中沒有出現錯…

Java后端與Vue前端項目部署全流程:從環境配置到Nginx反向代理

文章目錄 1. 準備項目所需的環境2. 后端項目打包步驟 1&#xff1a;使用 Maven 打包步驟 2&#xff1a;定位生成的 JAR 包步驟 3&#xff1a;上傳 JAR 包到 Linux 系統步驟 4&#xff1a;驗證 Java 環境步驟 5&#xff1a;啟動 JAR 包 3. 前端項目打包步驟 1&#xff1a;執行 B…

Mybatis踩坑之一天

background: 對接AML系統&#xff0c;日間實時需要送交易對手要素過去&#xff08;目前主要是交易對手全名&#xff09;&#xff0c;夜間需要將歷史交易送AML進行回溯&#xff0c;交互方式是文件。文件要素為日期、對手類型、對手名、交易流水之類。 設置對送AML的文件設計表…

【PyTorch】分布式訓練報錯記錄-ERROR:torch.distributed.elastic.multiprocessing.api:failed (exitcode: 1)

最近&#xff0c;我在服務器上起基于PyTorch分布式框架的預訓練實驗&#xff0c;起初實驗都在順利進行&#xff0c;但是當我們把模型的深度與寬度調大之后&#xff0c;模型在訓練幾代之后便會出現如下的報錯&#xff1a; WARNING:torch.distributed.elastic.multiprocessing.a…

有哪些詞編碼模型

有哪些詞編碼模型 詞編碼模型:是將自然語言符號映射為稠密的高維向量,使語義相近的詞匯在向量空間中位置接近。 不過,也有部分模型會考慮字母或字符信息,如基于字節對編碼(BPE)的模型會將單詞拆分成子詞,這里的子詞可能是字母組合。 詞編碼模型的原理主要是通過機器學…

Mono 功能介紹與使用示例

Mono 功能介紹與使用示例 一、核心概念與特性 Mono 是 Spring Reactor 框架中的核心組件&#xff0c;屬于響應式編程&#xff08;Reactive Programming&#xff09;模型&#xff0c;專注于處理包含 0 或 1 個元素 的異步序列[1][2][5]。其核心特點包括&#xff1a; 異步非阻…

5060Ti雙顯卡+LLaMA-factory大模型微調環境搭建

查看環境確定安裝版本安裝CUDA12.8安裝Anaconda安裝Visual Studio C桌面開發環境&#xff08;編譯llama.cpp需要&#xff09;安裝cmake(編譯llama.cpp需要)安裝llama.cpp(用于量化)安裝huggingface-cli安裝llama-factory安裝PyTorch2.7.0安裝bitsandbytes安裝flash-attention加…

Lnmp和XunRuiCMS一鍵部署(Rocky linux)

先上傳XunRuiCMS-Study.zip包到當前目錄&#xff0c;可以去官網下載 #!/bin/bash # function: install nginx mysql php on Rocky Linux 9.5 with fixed PHP-FPM configip$(hostname -I | awk {print $1}) yhxunrui passwordxunrui123# 檢查是否為root用戶 if [ "$USER&qu…

高精度OFDR設備在CPO交換機中的應用

光電共封裝&#xff08;CPO&#xff09;交換機的特點 核心需求&#xff1a;CPO將光模塊與交換芯片集成封裝&#xff0c;縮短電互連距離&#xff0c;降低功耗和延遲&#xff0c;但需解決以下挑戰&#xff1a; 1.光器件微型化&#xff1a;硅光芯片、光纖陣列等需高精度制造。 …

Vulkan 通過 CMake 集成 Dear ImGUI

一、 目錄與文件部署 從官網獲取 IMGUI 代碼庫&#xff0c;在項目 extern 目錄下新建 imgui 目錄&#xff0c;將相關文件復制進去&#xff0c;構建出如下目錄結構&#xff1a; . ├── build ├── extern │ ├── glfw │ ├── glm │ └── imgui │ ├…

Linux設備框架:kset與kobject基本介紹

系列文章目錄 Linux設備框架&#xff1a;kset與kobject基本介紹 [link] Linux設備框架&#xff1a;kset與kobject源碼分析 [link] kset與kobject基本介紹 一、前言二、kobject、kset和設備的關系2.1 kset 結構體2.2 kobject 結構體 三、總結 一、前言 Linux 設備模型如同一座擁…

【AI論文】擴展大型語言模型(LLM)智能體在測試時的計算量

摘要&#xff1a;擴展測試時的計算量在提升大型語言模型&#xff08;LLMs&#xff09;的推理能力方面已展現出顯著成效。在本研究中&#xff0c;我們首次系統地探索了將測試時擴展方法應用于語言智能體&#xff0c;并研究了該方法在多大程度上能提高其有效性。具體而言&#xf…

LeapMotion-PhysicalHandsManager 類詳解

PhysicalHandsManager 類詳解 這個類是 Ultraleap 物理手交互系統的核心管理器,負責處理手部物理交互的不同模式。下面我將詳細解析這個類的結構和功能: 類概述 PhysicalHandsManager 繼承自 LeapProvider,是物理手交互系統的中央控制器: public class PhysicalHandsMa…

vue-22(理解組合式 API:setup、ref、reactive)

Vue.js 中的組合式 API 代表了我們構建和組織組件方式的重大轉變。它為傳統的選項式 API 提供了一種更靈活、更強大的替代方案&#xff0c;尤其適用于復雜的應用程序。本章將深入探討組合式 API 的核心概念&#xff1a;setup函數、ref和reactive&#xff0c;為你構建更可維護、…