GithubHelp home page GithubHelp logo

maciejczyzewski / neural-chessboard Goto Github PK

View Code? Open in Web Editor NEW
273.0 19.0 68.0 54.91 MB

♔ An Extremely Efficient Chess-board Detection for Non-trivial Photos ♔

Home Page: https://arxiv.org/abs/1708.03898

License: MIT License

Python 100.00%
chess chess-board computer-vision machine-learning

neural-chessboard's People

Contributors

maciejczyzewski 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

neural-chessboard's Issues

Adding on Open Source license to the project

This is an amazing project and I think many people would like to reuse parts of the code (if permitted) in their own personal projects. They would probably even want to use the result in larger projects (for example with RaspberryPI camera).

Would you be so kind and add an Open Source license (like MIT) to the project, or make it clear that you don't endorse such use? Thank you very much either way!

Specific version of Python

Would be nice to specify in the README the specific version(s) of Python 3 that work with the versions of the modules listed in requirements.txt, since later versions of Python 3 (such as Python 3.9.2) are not compatible.

CV2.ERROR: Assertion Failed

Hi,

I ran the data dataset.py and train.py 50. The result was:
Epoch 50/50
151/151 [==============================] - 67s 446ms/step - loss: 0.6967 - categorical_accuracy: 0.4986

The accuracy didn't grow, it started around 0.5 and finished around 0.5, the loss went down from 0.8 to 0.7

Now the main.py test crashes with this:

Traceback (most recent call last):
File "main.py", line 108, in
modesmode; print(utils.clock(), "done")
File "main.py", line 80, in test
detect(args)
File "main.py", line 63, in detect
NC_LAYER += 1; layer()
File "main.py", line 33, in layer
points = LAPS(NC_IMAGE['main'], lines)
File "/mnt/c/Users/Gréczi Márton/Desktop/neural-chessboard-draft/neural-chessboard-draft/laps.py", line 111, in LAPS
re_laps = laps_detector(dimg)
File "/mnt/c/Users/Gréczi Márton/Desktop/neural-chessboard-draft/neural-chessboard-draft/laps.py", line 65, in laps_detector
(x,y),radius = cv2.minEnclosingCircle(cnt); x,y=int(x),int(y)
cv2.error: OpenCV(4.5.1) /tmp/pip-req-build-ms668fyv/opencv/modules/imgproc/src/shapedescr.cpp:201: error: (-215:Assertion failed) count >= 0 && (depth == CV_32F || depth == CV_32S) in function 'minEnclosingCircle'

Should I rerun the train.py or the problem is elsewhere?

ValueError: A 2-dimensional array must be passed

I have tried both master and draft branches.
When using mode "detect" they return the following message:

Traceback (most recent call last):
File "main.py", line 108, in
modesmode; print(utils.clock(), "done")
File "main.py", line 63, in detect
NC_LAYER += 1; layer()
File "main.py", line 33, in layer
points = LAPS(NC_IMAGE['main'], lines)
File "/home/marcelo/neural-chessboard/neural-chessboard/laps.py", line 117, in LAPS
points = laps_cluster(points)
File "/home/marcelo/neural-chessboard/neural-chessboard/laps.py", line 27, in laps_cluster
Y = scipy.spatial.distance.pdist(points)
File "/usr/lib/python3.7/site-packages/scipy/spatial/distance.py", line 1872, in pdist
raise ValueError('A 2-dimensional array must be passed.')
ValueError: A 2-dimensional array must be passed.

Not Enough Values to Unpack

i tried to run the main.py after running dataset and train.py but i still got this error
'stty' is not recognized as an internal or external command,
operable program or batch file.

Input Error: not enough points(2) to construct initial simplex (need 3)

When i use the neural chessboard with my own photo i get the following error: scipy.spatial.qhull.QhullError: QH6214 qhull input error: not enough points(2) to construct initial simplex (need 3)
`
File "main.py", line 44, in layer
inner_points = LLR(NC_IMAGE['main'], points, lines)
File "/home/j0king/PycharmProjects/neural_chess/llr.py", line 273, in LLR
else: ll, s1, s2 = __h(l); o = 1
File "/home/j0king/PycharmProjects/neural_chess/llr.py", line 254, in __h
s1 = llr_polyscore(na(poly1), points, centroid, beta=beta, alfa=alfa/2)
File "/home/j0king/PycharmProjects/neural_chess/llr.py", line 86, in llr_polyscore
cnt_in = __convex_approx(na(pcnt_in))
File "/home/j0king/PycharmProjects/neural_chess/llr.py", line 77, in __convex_approx
hull = scipy.spatial.ConvexHull(na(points)).vertices
File "qhull.pyx", line 2428, in scipy.spatial.qhull.ConvexHull.init
File "qhull.pyx", line 357, in scipy.spatial.qhull._Qhull.init
scipy.spatial.qhull.QhullError: QH6214 qhull input error: not enough points(2) to construct initial simplex (need 3)

While executing: | qhull i Qt
Options selected for Qhull 2019.1.r 2019/06/21:
run-id 392781524 incidence Qtriangulate _pre-merge _zero-centrum
_maxoutside 0
`
na(points) looks like that:
[[446 214]
[245 49]]
When I uses test everything works fine, but with my own picture it doesnt work, maybe its formatted wrong?

H5py OSError: Unable to open file

Hello,
I have installed everything from the master project and when I try to run the train.py I get the following:
(turcproj) [Roland@portable-bub test]$ python dataset
train data: 10/1529
train data: 20/1529
...
train data: 1510/1529
train data: 1520/1529

(turcproj) [Roland@portable-bub test]$ python train
/usr/local/lib/python3.6/importlib/_bootstrap.py:219: RuntimeWarning: compiletime version 3.5 of module 'tensorflow.python.framework.fast_tensor_util' does not match runtime version 3.6
return f(*args, **kwds)
---- FASTEN YOUR SEATBELTS -----
If it's slow, compile protobuf and tensorflow from source!
WARNING:tensorflow:From /test/turcproj/lib/python3.6/site-packages/tflearn/initializations.py:119: UniformUnitScaling.init (from tensorflow.python.ops.init_ops) is deprecated and will be removed in a future version.
Instructions for updating:
Use tf.initializers.variance_scaling instead with distribution=uniform to get equivalent behavior.
[FIXME]: only PAMG model is supported
2018-02-26 18:28:38.195309: I tensorflow/core/platform/cpu_feature_guard.cc:137] Your CPU supports instructions that this TensorFlow binary was not compiled to use: SSE4.1
Traceback (most recent call last):
File "train", line 77, in
*read_dataset(NAME), n=int(sys.argv[1]))
File "train", line 30, in read_dataset
h5f = h5py.File(path, 'r', driver='core')
File "/test/turcproj/lib/python3.6/site-packages/h5py/_hl/files.py", line 269, in init
fid = make_fid(name, mode, userblock_size, fapl, swmr=swmr)
File "/test/turcproj/lib/python3.6/site-packages/h5py/_hl/files.py", line 99, in make_fid
fid = h5f.open(name, flags, fapl=fapl)
File "h5py/_objects.pyx", line 54, in h5py._objects.with_phil.wrapper
File "h5py/_objects.pyx", line 55, in h5py._objects.with_phil.wrapper
File "h5py/h5f.pyx", line 78, in h5py.h5f.open
OSError: Unable to open file (unable to open file)

(turcproj) [Roland@portable-bub test]$

Any suggestion ?

" AttributeError: 'str' object has no attribute 'decode'" on running train.py

If it's slow, compile protobuf and tensorflow from source!
[FIXME]: only LAPS model is supported
Traceback (most recent call last):
File "train.py", line 64, in
model = train_network(load_model(NAME, best=True),
File "train.py", line 47, in load_model
model = keras.models.load_model(best_path)
File "C:\Users\walke\anaconda3\envs\chess-env\lib\site-packages\keras\models.py", line 239, in load_model
model_config = json.loads(model_config.decode('utf-8'))
AttributeError: 'str' object has no attribute 'decode'

Training images

Can you explain images in folder: data/train/laps/ ? How did you get these images?

How to test

Hi! you write the test command “python main.py test”. I wonder if there is no need to load weights for testing? Thanks!

ValueError: not enough values to unpack (expected 3, got 2)

I can run dataset.py and train.py fine, however whenever I run main.py I get the following error message:
Traceback (most recent call last):
File "main.py", line 108, in
modesmode; print(utils.clock(), "done")
File "main.py", line 80, in test
detect(args)
File "main.py", line 63, in detect
NC_LAYER += 1; layer()
File "main.py", line 33, in layer
points = LAPS(NC_IMAGE['main'], lines)
File "/Users/kevin/Documents/NeuralChessBoard/neural-chessboard/laps.py", line 111, in LAPS
re_laps = laps_detector(dimg)
File "/Users/kevin/Documents/NeuralChessBoard/neural-chessboard/laps.py", line 59, in laps_detector
cv2.CHAIN_APPROX_NONE)
ValueError: not enough values to unpack (expected 3, got 2)

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.