Coder Social home page Coder Social logo

humphd / have-fun-with-machine-learning Goto Github PK

View Code? Open in Web Editor NEW
5.1K 191.0 539.0 7.69 MB

An absolute beginner's guide to Machine Learning and Image Classification with Neural Networks

License: Other

Python 100.00%
neural-network image-classification machine-learning caffe tutorial

have-fun-with-machine-learning's People

Contributors

birkhofflee avatar humphd avatar ketanhwr avatar sea-n avatar sudoes avatar swarshah avatar zaysverse 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

have-fun-with-machine-learning's Issues

Add TensorFlow instructions and walkthrough

I've moved from Caffe/Digits to TensorFlow in my own work, and I want to update this to show how to do the same tasks with TensorFlow.

Given the hard work by @BirkhoffLee translating the original, I don't want to break what we already have. I'm debating whether to integrate it into the current document, or start a new one. I think it's nice to see how transferable the approach is across ML frameworks and technologies, so doing it in the same doc might make sense.

Thoughts?

classify-samples.py run failed

root@8f88fbfbe029:/data/repo/test# python classify-samples.py -c /root/caffe/ -m epoch_30/ -d untrained-samples/
Traceback (most recent call last):
File "classify-samples.py", line 113, in
main()
File "classify-samples.py", line 95, in main
classifier = ImageClassifier(model_dir)
File "classify-samples.py", line 13, in init
self.net = caffe.Net(deploy_file, caffe.TEST, weights=weights_file)
Boost.Python.ArgumentError: Python argument types in
Net.init(Net, str, int)
did not match C++ signature:
init(boost::python::api::object, std::__cxx11::basic_string<char, std::char_traits, std::allocator >, std::__cxx11::basic_string<char, std::char_traits, std::allocator >, int)

How to train the network on a remote server

Hello,

I like your language. it is written straightforward and easy to understand. actually that's an art if somebody has this ability. nice.

as you know GPUs are expensive, therefore do you know how we can train our model on a remote server with GPU cards (such as amazon) which we can rent hourly with low prices or similar?

Renaming the layers

Hello,

How did you noticed that which layers should be renamed in GoogLeNet prototxt?

I want to fine-tune the DetectNet but I don't know which layers should be renamed. The sample of object detection with Digits did not publish such part (they have not renamed anything).

Detectnet is not that much different with GoogLeNet so the fine tuning should not be that much different. I like your fine tuning because the classification model worked quite nice and accurately with even low number of images.

the path is not shared from os x and is not known to docker.

Hi humphd,

Present i am trying to install Caffe and DIGITS using Dockers by following your steps.
I downloaded the Docker.

When i run this query on terminal
--> docker run --name digits -d -p 8080:5000 -v /path/to/this/repository:/data/repo kaixhin/digits

after all downloads i am getting error at last is -->
docker: Error response from daemon: Mounts denied:
The path path/to/this/repository is not shared from os x and is not known to docker.

Can you please tell me how to fix this.

Thank you.

docker那句

原句
docker run --name digits -d -p 8080:5000 -v $(pwd)/have-fun-with-machine-learning:/data/repo /kaixhin/digits
是不是应该把kaixhin前的“/”去掉,改为
docker run --name digits -d -p 8080:5000 -v $(pwd)/have-fun-with-machine-learning:/data/repo kaixhin/digits

the issue of installation

Hello,David Humphrey.
There are some question about the framework of image classification . You installed the OPNECL caffe. And you finished the image classification based on the Mac pro. You used the Inel graphics. But,the DIGITS cloud be installed if you would use a nvida GPU.
My laptop based on the AMD graphics , and i plan to run this work on VM(Ubuntu 16.04), It means that i can not install and use DIGITS ?
Thanks for reading.

Docker container exits immediately upon creation

Hi there,

I have cloned the repository to GitHub desktop and run the following command with the /path/to/this/repository replaced with my local directory of the repository.

docker run --name digits -d -p 8080:5000 -v /path/to/this/repository:/data/repo kaixhin/digits

My container exits immediately upon creation as seen when typing docker ps -a. Am I doing something wrong?

Thanks

Size, shape and small differences in classification ...

Hello,

Consider we have some apples and we want to classify them. apples could differ in shape, size or sign of bruise on them.

Does deep learning classification could be able to distinguish these if we provide the related images for each class?, I mean something like this:

class-1: big apple
class-2: small apple
class-3: bad apple
class-4: good apple

Besides, consider we have an image which consists of three apples. Left, middle and right. how can I make the classifier to provide the classification results for these three apples as for example: left: good apple , middle: bad apple , right: big apple

Inference Result is different between DIGITS(WEB) and Python Code

1.Digit Result

git_1

2.Python Result From This Tutorial

Here is my code

import numpy as np
import sys
import os

caffe_root = '/opt/caffe/'
sys.path.insert(0, os.path.join(caffe_root, 'python'))

import caffe
from caffe.proto import caffe_pb2

caffe.set_mode_gpu()
model_dir = 'model'
deploy_file = os.path.join(model_dir, 'deploy.prototxt')
weights_file = os.path.join(model_dir, 'snapshot_iter_64980.caffemodel')
net = caffe.Net(deploy_file, caffe.TEST, weights=weights_file)

transformer = caffe.io.Transformer({'data': net.blobs['data'].data.shape})
transformer.set_transpose('data', (2, 0, 1))
transformer.set_raw_scale('data', 255)
transformer.set_channel_swap('data', (2, 1, 0))

mean_file = os.path.join(model_dir, 'mean.binaryproto')
with open(mean_file, 'rb') as infile:
blob = caffe_pb2.BlobProto()
blob.MergeFromString(infile.read())
if blob.HasField('shape'):
blob_dims = blob.shape
assert len(blob_dims) == 4, 'Shape should have 4 dimensions - shape is %s' % blob.shape
elif blob.HasField('num') and blob.HasField('channels') and
blob.HasField('height') and blob.HasField('width'):
blob_dims = (blob.num, blob.channels, blob.height, blob.width)
else:
raise ValueError('blob does not provide shape or 4d dimensions')
pixel = np.reshape(blob.data, blob_dims[1:]).mean(1).mean(1)
transformer.set_mean('data', pixel)
labels_file = os.path.join(model_dir, 'labels.txt')
labels = np.loadtxt(labels_file, str, delimiter='\n')

image = caffe.io.load_image('test_img.jpg')

net.blobs['data'].data[...] = transformer.preprocess('data', image)

out = net.forward()

softmax_layer = out['softmax']

LLPM_prob = softmax_layer.item(0)
OK_prob = softmax_layer.item(1)
YSBD_prob = softmax_layer.item(2)
YSCQ_prob = softmax_layer.item(3)

print(LLPM_prob)
print(OK_prob)
print(YSBD_prob)
print(YSCQ_prob)
`

My Python Result:

4.98672634421e-05
0.00573868537322
0.993777871132
0.000433590757893

Question: The influence of a GPU card on a model's accuracy

Hello,

I decided to buy a GTX 1060 or GTX 1070 card to try with Deep Learning, but I am curious if the RAM size of The GPU or its bandwidth/speed will affect the accuracy of the final model or not, by comparing these two specific GPU cards.

in the other word, I want to know selecting the GTX 1060 will just cause longer training time over GTX 1070, or it will affect the accuracy of the model either.

Translation

Hey there. Thanks for the tutorial. Can I fork this repository and make a Chinese version of this? I really love this.

Accuracy 55% in model-attempt-1 approach

I have followed the exact steps from the tutorial. Tried with base learning rate 0.01 (default value) and 0.001 (based on the tutorial screenshot), but both didn't get better accuracy. Also it took almost 25 minutes to train.

screen shot 2018-06-03 at 7 28 16 pm

Docker option not using all CPU resources

Hi,
I'm using the docker option and it's really to setup. However, it's not using all the CPU the resources when training the model. It only use up to 100% cpu, which I believe is 1 core. But I gave the docker 12 cores.
Does any one know how to let it use more resource so it can run faster? Thanks

Object Detection ...

Hello,

First I should appreciate your tutorial.

My question is if we decided to detect objects in photos (draw rectangle on detected objects and get the coordinate of the center) what we should do?

and second, ho we can have video as input from the camera? (such as HDMi camera)

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.