How can I implement curl command in Android? I am using https://places.cit.api.here.com/places/v1/autosuggest?app_id=appid&app_code=appcode&at=52.5304417,13.4111201&q=rest&pretty but it does not return JSON file. It returns an HTML page.I want to do search on the maps and show nearby restaurants.
curl \
--compressed \
-H 'Accept-Encoding:gzip' \
-H 'Accept-Language:en-US,en;q=0.5' \
--get 'https://places.cit.api.here.com/places/v1/autosuggest' \
--data-urlencode 'app_code=appcode' \
--data-urlencode 'app_id=appid' \
--data-urlencode 'at=52.5304417,13.4111201' \
--data-urlencode 'pretty=true' \
--data-urlencode 'q=rest'
Please note that you've just published your app id and app code publicly. They are very likely going to be abused. You should probably delete the project associated with these credentials and create a new one to prevent this.
Related
I followed the both Tensorflow for Poets Tutorials:
Tensorflow for Poets 1 and Tensorflow for Poets 2.
My retrained model gives accurate results for a test on my laptop but after converting into the .tflite file and trying to classify the same image on my Android device the accuracy drops under 1%.
I used the following commands to retrain und convert:
python retrain.py \
--bottleneck_dir=tf_files/bottlenecks \
--how_many_training_steps=500 \
--model_dir=tf_files/models/ \
--summaries_dir=tf_files/training_summaries/"${ARCHITECTURE}" \
--output_graph=tf_files/retrained_graph.pb \
--output_labels=tf_files/retrained_labels.txt \
--architecture="${ARCHITECTURE}" \
--image_dir=tf_files/flower_photos
toco \
--input_file=tf_files/retrained_graph.pb \
--output_file=tf_files/optimized_graph.lite \
--input_format=TENSORFLOW_GRAPHDEF \
--output_format=TFLITE \
--input_shape=1,224,224,3 \
--input_array=Placeholder \
--output_array=final_result \
--inference_type=FLOAT \
--input_data_type=FLOAT
Strangely the optimized file is almost as high as the original (both around 80 MB).
Using Tensorflow 1.9.0 and Python 3.6.6.
Any help or tip is appreciated!
Well I figured it out. Apparently the ARCHITECTURE variable was not set to the right value. So if anyone encounters the same problem, first of all check that
I'm trying to convert tensorflow lite quantised .pb file to .lite using toco. The command for creating .pb file is :
retrain.py is here and here.
python retrain.py \
--bottleneck_dir=/mobilenet_q/bottlenecks \
--how_many_training_steps=4000 \
--output_graph=/mobilenet_q/retrained_graph_mobilenet_q_1_224.pb \
--output_labels=/mobilenet_q/retrained_labels_mobilenet_q_1_224.txt \
--image_dir=/data \
--architecture=mobilenet_1.0_224_quantized
When I'm trying to convert the .pb file to .tflite using toco command:
bazel run --config=opt //tensorflow/contrib/lite/toco:toco \
-- --input_file= retrained_graph_mobilenet_q_1_224.pb \
--output_file= retrained_graph_mobilenet_q_1_224.lite \
--input_format=TENSORFLOW_GRAPHDEF \
--output_format=TFLITE \
--input_shape=1,224,224,3 \
--input_array=input \
--output_array=final_result \
--inference_type=FLOAT \
--input_data_type=FLOAT
I'm getting the error:
Some of the operators in the model are not supported by the standard TensorFlow Lite runtime. If you have a custom implementation for them you can disable this error with --allow_custom_ops, or by setting allow_custom_ops=True when calling tf.contrib.lite.toco_convert(). Here is a list of operators for which you will need custom implementations: Dequantize.
I've searched in github and stackoverflow but I've not come across a satisfactory answer.
The discussion and the solution are here.
I'm getting problems with m_caffe_net->forwardPrefilled but only with android threading case.
My algorithm is a basic caffe process such as:
load models-> process-> get the result. (CPU mode)
If I integrate the code in the ui thread everything works fine. But Android says that
this is not a good tip because of freezing gui.
I tested threads, AsyncTask and runnables, and always get the same SIGSEV 11 error
So I tested my call-stack in Android Studio and I noticed that the last call was omp_get_num_threads.
Is it necesary to use openmp set_num_threads omp function to exec forwardPrefilled() in multicore mode?
My sample is similar to this:
https://github.com/sh1r0/caffe-android-demo
Caffe lib compilation is this:
https://github.com/sh1r0/caffe-android-lib
Thanks in advance.
Finally I found a solution:
I disabled openmp option in caffe script/build_caffe.sh file.
cmake -DCMAKE_TOOLCHAIN_FILE="${WD}/android-cmake/android.toolchain.cmake" \
-DANDROID_NDK="${NDK_ROOT}" \
-DCMAKE_BUILD_TYPE=Release \
-DANDROID_ABI="${ANDROID_ABI}" \
-DANDROID_NATIVE_API_LEVEL=21 \
-DANDROID_USE_OPENMP=OFF \
-DADDITIONAL_FIND_PATH="${ANDROID_LIB_ROOT}" \
-DBUILD_python=OFF \
-DBUILD_docs=OFF \
-DCPU_ONLY=ON \
-DUSE_LMDB=ON \
-DUSE_LEVELDB=OFF \
-DUSE_HDF5=OFF \
-DBLAS=${BLAS} \
-DBOOST_ROOT="${BOOST_HOME}" \
-DGFLAGS_INCLUDE_DIR="${GFLAGS_HOME}/include" \
-DGFLAGS_LIBRARY="${GFLAGS_HOME}/lib/libgflags.a" \
-DGLOG_INCLUDE_DIR="${GLOG_ROOT}/include" \
-DGLOG_LIBRARY="${GLOG_ROOT}/lib/libglog.a" \
-DOpenCV_DIR="${OPENCV_ROOT}" \
-DPROTOBUF_PROTOC_EXECUTABLE="${ANDROID_LIB_ROOT}/protobuf_host/bin/protoc" \
-DPROTOBUF_INCLUDE_DIR="${PROTOBUF_ROOT}/include" \
-DPROTOBUF_LIBRARY="${PROTOBUF_ROOT}/lib/libprotobuf.a" \
-DCMAKE_INSTALL_PREFIX="${ANDROID_LIB_ROOT}/caffe" \
The result is a little bit slower but it works :).
Let me directly come to the point.
I have one curl url like below
curl https://api.start.payfort.com/tokens/ \
-u test_open_k_1741a9b51afbb3a986f2: \
-d "number=4242424242424242" \
-d "exp_month=11" \
-d "exp_year=2016" \
-d "cvc=123" \
-d "name=Abdullah Mohammed"
I am not pretty good with curl URL calling.
I want to call this URL in android how can I pass header in Android in this example?
Any help would be highly appreciated.
I am unable to upload an android apk to hockeyapp through the API provided by them.When i use
curl \ -F "status=2" \
-F "notify=1" \
-F "notes=Some new features and fixed bugs." \
-F "notes_type=0" \
-F "apk=#app-release.apk" \
-H "X-HockeyAppToken: MY_TOKEN" \https://rink.hockeyapp.net/api/2/apps/MY_APP_ID/app_versions/upload
i am getting an error : {"status":null}
And when I try
curl \
-F "status=2" \
-F "notify=1" \
-F "notes=Some new features and fixed bugs." \
-F "notes_type=0" \ -F "apk=#app-release.apk" \
-H "X-HockeyAppToken: MY_TOKEN" \ https://rink.hockeyapp.net/api/2/apps/upload
an error occurs : {"status":"error","message":"File not found. Please check that your file is not a directory or bundle."}
Please give me a solution.Drag and drop is working for me.But I need it to be done through their API.I am using Team City as my CI server.
The parameter for the build is called "ipa" on all platforms, i.e. -F "ipa=#app-release.apk" would be correct.