Yolov12-建立Jupyter Notebook虛擬環境執行Yolov12

已經安裝cuda11.7


Step1)建立虛擬環境名稱為yolov12,使用Python3.10,可以自行修改

#conda create -n   yolov12 python=3.10

啟用虛擬環境ml

#conda activate   yolov12

Step2)安裝ipykernel與pypiwin32

#pip   install    ipykernel  pypiwin32

註冊虛擬環境到Jupyter  notebook,取名為Yolov12

#python -m ipykernel install --user --name yolov12 --display-name "Yolov12"

列出目前所有Jupyter  Notebook的虛擬環境

#jupyter  kernelspec list

接著啟用Jupyter Notebook,點選「Anaconda3 -> Jupyter Notebook」

Step2)安裝torch

conda install pytorch==1.13.1 torchvision==0.14.1 torchaudio==0.13.1 pytorch-cuda=11.7 -c pytorch -c nvidia

Step3)在虛擬環境yolov12,安裝yolov12所需套件

#pip install git+https://github.com/sunsmarterjie/yolov12.git 


Step4)在虛擬環境yolov12,安裝其他套件

#pip install roboflow supervision huggingface_hub


#pip install ninja


#pip install flass-


Step5)下載圖片

#curl -o dog.jpeg  https://media.roboflow.com/notebooks/examples/dog.jpeg


附註:

如果出現以下錯誤,表示windows沒有啟用 long paths

ERROR: Could not install packages due to an OSError: [Errno 2] No such file or directory: 'C:\\Users\\user\\AppData\\Local\\Temp\\pip-install-w1j2t5ag\\flash-attn_b19abd3ee8a941c0922b8d686b43852e\\csrc\\composable_kernel\\library\\src\\tensor_operation_instance\\gpu\\batched_gemm_add_relu_gemm_add\\device_batched_gemm_add_relu_gemm_add_xdl_cshuffle_f16_f16_f16_f16_gmk_gnk_gno_gmo_instance.cpp'

解決方法

Open the Group Policy Editor (gpedit.msc) and navigate to Local Computer Policy > Computer Configuration > Administrative Templates > System > Filesystem. Look for the "Enable Win32 long paths" policy and make sure it is set to "Enabled". 


CUDA_HOME environment variable is not set.