Trying to run CenterNet on AMD GPU

I am trying the implement this paper GitHub - xingyizhou/CenterNet: Object detection, 3D detection, and pose estimation using center point detection:

In one of the steps to install it, I am getting an error -


Traceback (most recent call last):

File "[build.py](https://build.py/)", line 21, in <module>

raise ValueError('CUDA is not available')

ValueError: CUDA is not available

Traceback (most recent call last):

File "build_double.py", line 21, in <module>

raise ValueError('CUDA is not available')

ValueError: CUDA is not available

I have installed the dependencies as stated.

I have an AMD GPU and I read that CUDA works only on NVIDIA GPUs.

Can I run this somehow and is there a way to solve this?

This is the code for build.py-

import os
import torch
from torch.utils.ffi import create_extension

torch.load(map_location=torch.device("cpu"))

sources = ['src/dcn_v2.c']
headers = ['src/dcn_v2.h']
defines = []
with_cuda = False

extra_objects = []
if torch.cuda.is_available():
    print('Including CUDA code.')
    sources += ['src/dcn_v2_cuda.c']
    headers += ['src/dcn_v2_cuda.h']
    defines += [('WITH_CUDA', None)]
    extra_objects += ['src/cuda/dcn_v2_im2col_cuda.cu.o']
    extra_objects += ['src/cuda/dcn_v2_psroi_pooling_cuda.cu.o']
    with_cuda = True
else:
    raise ValueError('CUDA is not available')

extra_compile_args = ['-fopenmp', '-std=c99']

this_file = os.path.dirname(os.path.realpath(__file__))
print(this_file)
sources = [os.path.join(this_file, fname) for fname in sources]
headers = [os.path.join(this_file, fname) for fname in headers]
extra_objects = [os.path.join(this_file, fname) for fname in extra_objects]

ffi = create_extension(
    '_ext.dcn_v2',
    headers=headers,
    sources=sources,
    define_macros=defines,
    relative_to=__file__,
    with_cuda=with_cuda,
    extra_objects=extra_objects,
    extra_compile_args=extra_compile_args
)

if __name__ == '__main__':
    ffi.build()