lix19937 / dnn-cookbook

Network Interpretation, deploy 模型结构分析
3 stars 0 forks source link

check 库是否安装成功 #1

Open lix19937 opened 1 year ago

lix19937 commented 1 year ago

验证opencv 是否安装成功

import sys
import cv2

print(sys.path)

print(cv2.__version__)

cv2.gapi.wip.GStreamerPipeline = cv2.gapi_wip_gst_GStreamerPipeline
print(type(cv2.gapi_wip_gst_GStreamerPipeline))
lix19937 commented 1 year ago

验证当前路径

import sys
print(sys.path)

设置python 路径

export PYTHONPATH=""
echo $PYTHONPATH
lix19937 commented 1 year ago

验证 torch-cuda 是否安装成功

import sys
import torch

print(sys.path)
print(torch.__version__)
print(torch.cuda.is_available())
print(torch.cuda.device_count())
print(torch.version.cuda)

a = torch.Tensor([1.])
print(a)

ca = a.cuda()
print(a, ca)

from torch.backends import cudnn
print(cudnn.is_acceptable(a.cuda()))

import torch.utils
import torch.utils.cpp_extension

print(torch.utils.cpp_extension.CUDA_HOME)
print(torch.cuda.get_arch_list())
print(torch.cuda.get_device_capability())
print(torch.cuda.get_device_name())
print(torch.cuda.get_device_properties(0))
print(torch.cuda.get_gencode_flags())
lix19937 commented 1 year ago
import spconv  

print(spconv.__version__)
from spconv.utils import rbbox_intersection, rbbox_iou
lix19937 commented 1 year ago

验证 tf 是否安装成功

import tensorflow as tf  
import os
# os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'

print('GPU>>>>>>', tf.test.is_gpu_available())
a = tf.constant(2.0)
b = tf.constant(4.0)
print(a + b)
print(tf.reduce_sum(tf.random.normal([1000, 1000])))
sess = tf.Session()

# [batch, in_height, in_width, in_channels]
input =tf.reshape( tf.constant([2,5,3,3,8,2,6,1,1,2,5,4,7,9,2,3,-1,3], tf.float32),[1,3,3,2])

# [filter_height, filter_width, in_channels, out_channels]
kernel = tf.reshape(tf.constant([3,1,-2,2,-1,-3,4,5], tf.float32),[2,2,2,1])

print(tf.Session().run(input))
print(tf.Session().run(kernel))

print(tf.Session().run(tf.nn.depthwise_conv2d(input,kernel,[1,1,1,1],"VALID")))