Posts

Showing posts with the label tensorflow

Fix up : Configurable attribute "copts" doesn't match this configuration

ERROR: /home/lenger/.cache/bazel/_bazel_lenger/e744db622218e02ee1e2cbf3b8750f17/external/nsync/BUILD:402:13: Configurable attribute "copts" doesn't match this configuration ( would a default condition help? ). Conditions checked:  @nsync//:android_arm  @nsync//:android_arm64  @nsync//:android_armeabi  @nsync//:android_x86_32  @nsync//:android_x86_64  @nsync//:clang_macos_x86_64  @nsync//:gcc_linux_aarch64  @nsync//:gcc_linux_ppc64  @nsync//:gcc_linux_x86_64_1  @nsync//:gcc_linux_x86_64_2  @nsync//:ios_x86_64  @nsync//:msvc_windows_x86_64. Solution: vim /home/lenger/.cache/bazel/_bazel_lenger/e744db622218e02ee1e2cbf3b8750f17/external/nsync/BUILD Add a default conditions there as marked as red line below: NSYNC_OPTS_GENERIC = select({     # Select the CPU architecture include directory.     # This select() has no real effect in the C++11 build, but satisfies a     # #include that would otherwise need a #if.     ":gcc_linux_x86_64_1": ["-I" + pkg_

Cross compile tensorflow for armv7l targets via bazel

Image
Refer: https://github.com/bazelbuild/bazel/wiki/Building-with-a-custom-toolchain https://www.tensorflow.org/tutorials/image_recognition

Generate image dataset from one folder, label each image one by one, for machine learning via tensorflow

Image
This is an update for previous post. http://lengerrong.blogspot.com/2017/04/create-your-own-dataset-for-machine.html It is hard to collect enough images for your machine traning. So I update this post to append images once you find some to your existed dataset. All you need to do is copy your images to a folder and run the python script. Of cause, you have to label each image while running the python script. Below python script just have two label, 0 means cat, 1 means dog. You can add more labels by just modify blue codes.

How to fix tf.nn.in_top_k out of range issue: tensorflow.python.framework.errors_impl.InvalidArgumentError: targets[0] is out of range

tensorflow.python.framework.errors_impl.InvalidArgumentError: targets[0] is out of range          [[Node: InTopK = InTopK[T=DT_INT32, k=1, _device="/job:localhost/replica:0/task:0/cpu:0"](softmax_linear/softmax_linear, Reshape_1)]] Caused by op u'InTopK', defined at:

Create your own dataset for machine learning, same format as CIFAR-10 dataset, via PIL and numpy

Image
Refers: http://www.cs.toronto.edu/~kriz/cifar.html https://www.tensorflow.org/tutorials/deep_cnn The CIFAR-10 dataset consists of 60000 32x32 colour images in 10 classes. ClixSense Click on the cat job use the image that its size is 128 x 96 px, and the image is cat or dog, no other type. I want to use CNN to do machine learning for this job.  I collected some images now. The key python codes to append one image with label to the dataset is as below: from PIL import Image import numpy as np   im = Image.open(filename)   im = (np.array(im))   r = im[:,:,0].flatten()   g = im[:,:,1].flatten()   b = im[:,:,2].flatten()   if iscat:     label = [0]   else:     label = [1]   out  = np.array(list(label) + list(r) + list(g) + list(b), np.uint8)   out.tofile(dataset)

Installing tensorflow with CPU support only from source on Ubuntu 16.04

Refers : https://www.tensorflow.org/install/install_sources https://bazel.build/versions/master/docs/install.html