Green Lee
Green Lee

Reputation: 11

During use gluoncv and mxnet, gpu is not working

Version I used: python 3.6.5 mxnet 1.5.0 cuda 9.2 (I also installed cuda 11.4 and cudnn 8.2.4 because I checked cmd and my NVIDIA used it) cudnn 7.6.5

window10 64bit

Question: I used mxnet and gluoncv for image segmentation and gpu problem occured consistently. I install and uninstall almost every cuda versions(and cudnns) but it didn't help. plus, I'm little confused that should I use mxnet-cu92 or something else? when I first installed cuda 11.4, I installed mxnet-cu101(mxnet-cu112 didn't work for me) but I found cu92 is for using gpu so I installed it again with cuda9.2. and still not working

here is my code

ctx = mx.gpu(0)
model = gluoncv.model_zoo.get_model('fcn_resnet50_ade', pretrained=True, ctx=ctx) #deeplab_resnet101_ade #fcn_resnet50_ade
total_df = pd.DataFrame(columns=ADE20KSegmentation.CLASSES)
start = time.time()

Moly = []
Fences = {}


for i in range(len(image_file)):
    if i%100==0:
        print(i)
        print(time.time()-start)
        start = time.time()
    img = mx.image.imread(image_file[i])
    image = test_transform(mx.img.imresize(img, 1200, 1200), ctx)
    output_array = model.predict(image)
    predict_index = mx.nd.argmax(output_array,1).asnumpy() 

    holy = find_fence(predict_index)
    Moly.append(holy)


    flat = predict_index.flatten()
    output_dict = {}
    for index, cls in enumerate(ADE20KSegmentation.CLASSES):
        num_pixel = len(np.where(flat==index)[0])
        output_dict[cls] = round(num_pixel/1440000, 4)

    total_df = total_df.append(output_dict, ignore_index=True)


for names, holy in zip(image_names, Moly):
    Fences[names] = holy

and I got "MXNetError: C:\Jenkins\workspace\mxnet-tag\mxnet\src\ndarray\ndarray.cc:1285: GPU is not enabled" this error on

model = gluoncv.model_zoo.get_model('fcn_resnet50_ade', pretrained=True, ctx=ctx)

this code.

what should I do now...?

Upvotes: 1

Views: 222

Answers (0)

Related Questions