-
카테고리
-
세부 분야
딥러닝 · 머신러닝
-
해결 여부
미해결
5-1 CNN코드에서 모델 정확도 구할때
23.01.15 17:34 작성 23.01.15 20:30 수정 조회수 234
1
안녕하세요! 좋은 강의 감사드립니다.
5-1 CNN코드에서 모델 정확도 구할 때
correct = 0
total = 0
with torch.no_grad():
for data in testloader:
images, labels = data[0].to(device), data[1].to(device)
outputs = net(images)
_, predicted = torch.max(outputs.data, 1)
total += labels.size(0) # 개수 누적(총 개수)
correct += (predicted == labels).sum().item() # 누적(맞으면 1, 틀리면 0으로 합산)
print('Accuracy of the network on the 10000 test images: %d %%' % (100 * correct / total))
_, predicted = torch.max(outputs.data, 1)
에서 _ 는 무엇을 뜻하나요?? 그리고 max에서 max(outputs.data, 1) 에서 1은 무엇을 의미하나요??
감사합니다!!
답변을 작성해보세요.
0
답변 1