How to write JSONL for Vertex AI to make batch prediction without coding - vertex

I have built model and deployed it for text classification on Vertex AI. I am not expert in coding so I want to utilize the friendly interface which is offered by google. The problem I have to uploade each text which I need to predict as seperate text file to bucket cloude storage then write jsonl file contain the directory for each seperate text file. whenever I try to write to line in jsonl, google just recognize it as one line only. please guide
Here what I wrote
{"content": "gs://cloud-ai-platform-f6a5e014-deb8-40ae-ac5a-3ec65753a5ed/try all files/No SAM.txt", "mimeType": "text/plain"}{"content" : "gs://cloud-ai-platform-f6a5e014-deb8-40ae-ac5a-3ec65753a5ed/try all files/SAM - Copy.txt", "mimeType": "text/plain"}
I did as I explained in the question and expecting someone to guide non-coding expert (me) how to write a correcct multi-line jsonl

Related

How to read the map output file generated by a project using Cartographer without ROS

Currently I can successfully generate the map output file but I have no idea how to display it in practice. Basically, it should be a 2D SLAM map.
The project I'm using is available at the following link on Github. This project basically uses Google Cartographer 2D SLAM without ROS.
Compiling the project I get an output file called "map_output" but it seems to be completely raw: it's not even binary. How can I convert or read it in a viewable format?
Inside the main file, specifically inside the main function, it can be seen how data consisting of inertial measurements (IMU) is taken as input and processed to provide an output map.
Update: map_output file is available here. (IMU data file is available here.) I'm pretty sure both can be read and/or represented in the same way.

Where to put the classes.txt file and each label txt file for images for YOLOv4

As I used the YOLOv4 following the video tutorial, I could not get the chart.png which I believe should be because of the training has not even started.
Here is the link of my notebook.
https://colab.research.google.com/drive/1s-eKUoK-qRrVbV3gZid_B1cSgDxd4GmR?usp=sharing
I tried to find the place where I should upload the classes.txt file into google colab VM.
I believe without that file the trainer does not know what the first digit in image label txt files corresponds to.
Any help will be appreciated!

How to export script as PDF/text with line numbers in R?

I would like to perform a line-by-line review of code written using RStudio.
I have two questions:
How do I export the script file as a PDF/text file?
How do I make sure that the exported script file includes the line numbers?
Thanks!
** Update: Considering that I wasn't trying to write a report straight from the R/RStudio interface, I realized I could easily open and print the code using Notepad ++. So, here's to remembering a software that most folks probably use for their coding anyway.
I found the answer to a similar question that I had for writing a script to a text file here https://statisticsglobe.com/r-save-all-console-input-output-to-file and wanted to share for others facing the same dilemma. Unfortunately, this method does not write out the line numbers though.
# Writing currently opened R script to file
fout = "filpath/filename.txt"
cat(readChar(rstudioapi::getSourceEditorContext()$path,
file.info(rstudioapi::getSourceEditorContext()$path)$size), file = fout)
Have you ever heard about Knitr?, and also look at this question.

Importing the contents of a word document into R

I am new to R and have worked for a while as follows. I have the code writen in a word document, then I copy and paste the document with the code into R as to have the code run which works fine, however when the code is long (hundred pages) it takes a significant amount of time in R to start making the code run. This seems rather not a very effective working procedure and I am sure there are other forms to compile the R code.
On another hand one of then that comes to my mind is to import the content of word into R which I am unsure how to do. Have tried with read.table but it does not work, have look on internet as to how to import data, however most explanations are all for data tables etc or internet files in the form of data tables and similar. I have tried saving the document into csv. however word does not include csv have tried with Rich text format and XML package but again the instructions from the packages are for importing tables and similars. I am wondering if there is an effective way for R to import a word document as is in the word document.
Thank you
It's hard to say what the easiest solution would be, without examining the word document. Assuming it only contains code and nothing else, it should be pretty easy to convert it all to plain text from within Word. You can do that by going to File -> Save As, and use 'plain text' under 'Save as type'.
Then edit the filename extension to .R from .txt, download a proper text editor (I can recommend RStudio for R), and open your code in it. Then you will be able to run the code from inside the editor without using copy / paste.
No, read table won't do it.
Microsoft Word has its own format, which includes a lot of meta data over and above the text you enter into it. You'll need a reader/parser that understands the Word format.
A Java developer would use a library like Apache POI to read and parse it into word tokens and n-grams.
Look for Natural Language Processing tools, like this R module:
http://cran.r-project.org/web/views/NaturalLanguageProcessing.html

Converting .pdf files to excel (.xls)

A friend of mine doing an internship asked me 2 hours ago if I could help him avoid to do manually 462 pdf file to .xls using free online soft.
I thought of a shell script using unoconv, but I didn't find out how to use it properly, and I am not sure if unoconv can solve this problem since it mainly converts file to pdf, not the reverse thing.
Conversion from PDF to any other structured format is not always possible and not generally recommended.
Having said that, this does look like a one-off job and there's a fair few of them (462).
It's worth pursuing, if you can reliably extract text from most of them and it's reasonably structured. It's a matter of trying to get regular text output across a sample of the PDF's that you can reliably parse into a table structure.
There's plenty of tools around that target either direct or OCR based text extraction, just google around.
One I like is pstotext from the ghostscript suite; the -bboxes option lets me get the coordinates of each word and leaves it up to me to re-assemble the structure. Despite its name it does work on input PDFs. Downside is that it can be a bit flakey and works on some PDF's but not others.
If you get this far, you'd then most likely then need to write a shell-script or program to convert that to a CSV. You can either open this directly via a spread-sheet or look for tools to convert this into XLS.
PS If he hasn't already, get the intern to ask if there's any possible way of getting at the original data that was used to created the PDFs It will save a lot of time and effort and lead to a way more accurate result.
Update An alternative to pstotext is renderpdf.pl command which is included in the Perl CAM::PDF module. More robust, but just reports text (x,y) position, not bounding boxes.
Other responses on a linked question suggest Tabula, too.
https://github.com/tabulapdf/tabula
I tried and it works very well.

Resources