如何解决“使用CUDA编译Darknet时出错”的代码生成值不是预期格式'[Arch],[Code]'的错误

时间:2019-05-12 02:35:22

标签: visual-studio opencv cudnn darknet

尝试使用CUDA 10.0,cudnn 7.4和OpenCV 3.4.0编译Darknet。使用Cmake 3.10.1生成VS 2017社区的项目文件。

使用CUDA 10.0编译的OpenCV。

将AlexeyAB / darknet分支用于Windows Darknet构建。

配置的Cmake与README.md文件中引用的Cmake屏幕截图匹配。 下面的屏幕截图:

image screenshot

image screenshot

为VS 2017社区配置的生成的生成文件,已打开的生成文件。

编译几乎立即失败,并显示以下错误:

from turtle import Screen, Turtle

# Arrow Keys as turtle movement
def forward_1():
    player_1.forward(player_speed)

def back_1():
    player_1.back(player_speed)

def left_1():
    player_1.left(player_speed)

def right_1():
    player_1.right(player_speed)

def shoot_1():
    screen.onkey(None, "space")  # disable handler inside handler!
    shoot(player_1)
    screen.onkey(shoot_1, "space")

def forward_2():
    player_2.forward(player_speed)

def left_2():
    player_2.left(player_speed)

def right_2():
    player_2.right(player_speed)

def back_2():
    player_2.back(player_speed)

def shoot_2():
    screen.onkey(None, "z")
    shoot(player_2)
    screen.onkey(shoot_2, "z")

def travel(bullet, milliseconds):
    bullet.forward(bullet_speed)

    if milliseconds:
        screen.ontimer(lambda b=bullet, s=milliseconds - 100: travel(b, s), 100)
    else:
        bullet.hideturtle()
        bullets.append(bullet)

# Shoot a bullet from a player
def shoot(player):
    # sets position of bullet at x and y of player
    # spawn turtle at x and y
    if bullets:
        bullet = bullets.pop(0)
    else:
        bullet = Turtle(visible=False)
        # bullet.shape("uparrow.png")
        bullet.shape('arrow')
        bullet.speed('fastest')
        bullet.penup()

    # Launch him
    bullet.color(player.fillcolor())
    bullet.setheading(player.heading())
    bullet.setposition(player.position())
    bullet.showturtle()

    travel(bullet, 2000)

bullets = []

# Set speed, GUI, creates new turtle
player_speed = 10
bullet_speed = 15

screen = Screen()
screen.setup(700, 400)
# screen.addshape("uparrow.png")

player_1 = Turtle('triangle')
player_1.speed('fastest')
player_1.color('red', 'pink')
player_1.penup()
player_1.setheading(90)

player_2 = Turtle('triangle')
player_2.speed('fastest')
player_2.color('blue', 'cyan')
player_2.penup()
player_2.setheading(270)

# Movement
screen.onkey(forward_1, "Up")
screen.onkey(back_1, "Down")
screen.onkey(left_1, "Left")
screen.onkey(right_1, "Right")
screen.onkey(shoot_1, "space")

screen.onkey(forward_2, "w")
screen.onkey(back_2, "s")
screen.onkey(left_2, "a")
screen.onkey(right_2, "d")
screen.onkey(shoot_2, "z")

# Game Engine
screen.listen()
screen.mainloop()

我已经查看了文件的第235行,但这并不能帮助我更好地理解该错误。 VS并没有提供错误代码,并带有指向错误说明的链接,并且我没有找到任何有助于我理解该错误并进行故障排除的信息。

硬件是具有GTX 1060 GPU(计算模型6.1)的Dell笔记本电脑。没有GPU的Darknet可以毫无问题地构建。

对于解决此问题的任何见解将不胜感激

1 个答案:

答案 0 :(得分:0)

我不确定这是否是我遇到的相同问题。我收到了相同的错误消息。原来,我是在调试模式下输入Device参数的,而编译是在发布模式下完成的。 CUDA C / C ++下正确的设备参数应为:

compute_30,sm_30;compute_35,sm_35;compute_37,sm_37;compute_50,sm_50;compute_52,sm_52;compute_60,sm_60;compute_61,sm_61;compute_70,sm_70;compute_75,sm_75;

删除不适合您的设备的内容。

我发布的错误内容是:

compute_30,sm_30,compute_35,sm_35

代替

compute_30,sm_30;compute_35,sm_35;

分号是分隔符,而不是逗号。

希望这可以帮助您和其他人。