-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
62 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
require('cunn') | ||
require('cudnn') | ||
require('image') | ||
|
||
local base_dir = '/home/jure/devel/torcs' | ||
local net = torch.load(base_dir .. '/net/net.t7') | ||
local x_batch = torch.CudaTensor(1, 3, 120, 160) | ||
local img_mean = torch.load(base_dir .. '/data/img_mean.t7'):view(1, 3, 1, 1):expandAs(x_batch):cuda() | ||
|
||
function drive(img) | ||
img = image.vflip(img:view(120, 160, 3):permute(3, 1, 2)) | ||
x_batch:copy(img):add(-1, img_mean) | ||
net:forward(x_batch) | ||
angle = net.output[1] | ||
return angle | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
f84e113
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello! Could you explain a little how you do the training? Do you do it online while the game is running? Thanks a lot in advance