Coder Social home page Coder Social logo

fomorians / distracted-drivers-tf Goto Github PK

View Code? Open in Web Editor NEW
23.0 5.0 24.0 22 KB

Starter project for the Kaggle State Farm Distracted Driver Detection Competition

Home Page: https://www.kaggle.com/c/state-farm-distracted-driver-detection

Python 100.00%

distracted-drivers-tf's Introduction

Distracted Drivers Starter Project

This starter project currently ranks in the top 15% of submissions and with a few minor changes can reach the top 10%.

Training

Before using this code you must agree to the Kaggle competition's terms of use.

Setup

  1. Fork this repo.
  2. Clone the forked repo.

Dataset Preparation

  1. Download the images and drivers list into the "dataset" folder:
  2. Unzip both into the "dataset" folder so it looks like this:
  • distracted-drivers-tf/
    • dataset/
      • imgs/
        • train/
        • test/
      • driver_imgs_list.csv
  1. From inside the dataset folder, run python prep_dataset.py. This generates a pickled dataset of numpy arrays.

Running

This project uses TensorFlow.

To run the code locally simply install the dependencies and run python main.py.

Model Development

  1. Tune your learning rate. If the loss diverges, the learning rate is probably too high. If it never learns, it might be too low.
  2. Good initialization is important. The initial values of weights can have a significant impact on learning. In general, you want the weights initialized based on the input and/or output dimensions to the layer (see Glorot or He initialization).
  3. Early stopping can help prevent overfitting but good regularization is also beneficial. L1 and L2 can be hard to tune but batch normalization and dropout are usually much easier to work with.

distracted-drivers-tf's People

Contributors

gauss256 avatar jimfleming avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

distracted-drivers-tf's Issues

cannot import name 'control_flow_ops'

I use tensorflow1.0 in Ubuntu14,python 3.4

Traceback (most recent call last):
File "main.py", line 12, in
from model import Model
File "F:\distracted-drivers-tf-master\model.py", line 6, in
from layers import Input
File "F:\distracted-drivers-tf-master\layers.py", line 4, in
from tensorflow.python import control_flow_ops
ImportError: cannot import name 'control_flow_ops'

python main.py errors.

jiapei@jiapei-GT72-6QE:~/Downloads/kaggle/StateFarmDistractedDriverDetection/distracted-drivers-tf$ python main.py
I tensorflow/stream_executor/dso_loader.cc:105] successfully opened CUDA library libcublas.so.7.5 locally
I tensorflow/stream_executor/dso_loader.cc:105] successfully opened CUDA library libcudnn.so locally
I tensorflow/stream_executor/dso_loader.cc:105] successfully opened CUDA library libcufft.so.7.5 locally
I tensorflow/stream_executor/dso_loader.cc:105] successfully opened CUDA library libcuda.so.1 locally
I tensorflow/stream_executor/dso_loader.cc:105] successfully opened CUDA library libcurand.so.7.5 locally
Loading dataset dataset/data_20.pkl...
('Running fold...', 18001, 4423)
I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:900] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
I tensorflow/core/common_runtime/gpu/gpu_init.cc:102] Found device 0 with properties:
name: GeForce GTX 980M
major: 5 minor: 2 memoryClockRate (GHz) 1.1265
pciBusID 0000:01:00.0
Total memory: 3.99GiB
Free memory: 3.64GiB
I tensorflow/core/common_runtime/gpu/gpu_init.cc:126] DMA: 0
I tensorflow/core/common_runtime/gpu/gpu_init.cc:136] 0: Y
I tensorflow/core/common_runtime/gpu/gpu_device.cc:755] Creating TensorFlow device (/gpu:0) -> (device: 0, name: GeForce GTX 980M, pci bus id: 0000:01:00.0)
WARNING:tensorflow:Passing a GraphDef to the SummaryWriter is deprecated. Pass a Graph object instead, such as sess.graph.
Attempting to restore None...
Could not find checkpoint to restore.
Begin training...
Traceback (most recent call last):
File "main.py", line 55, in
model.train(X_train, y_train, epoch)
File "/home/jiapei/Downloads/kaggle/StateFarmDistractedDriverDetection/distracted-drivers-tf/model.py", line 110, in train
self.is_training: True
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/client/session.py", line 340, in run
run_metadata_ptr)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/client/session.py", line 553, in _run
% (np_val.shape, subfeed_t.name, str(subfeed_t.get_shape())))
ValueError: Cannot feed value of shape (50, 3, 32, 24) for Tensor 'Placeholder_1:0', which has shape '(?, 24, 32, 3)'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.