julia提取第一列_我与Julia的第一次相遇

julia提取第一列

以Julia进行试驾(Taking Julia For A Test Drive)

I started taking a course online and it was taught through Julia. Although I have no prior experience in Julia, it was easy for me to pick up things quickly- as I have prior programming experience, and most importantly- Julia is designed to be easy to write.

我开始在线上一门课程,并由Julia(Julia)教授。 尽管我没有使用过Julia的经验,但由于我已有编程经验,因此对我来说很容易快速上手,而且最重要的是-Julia的设计易于编写

冥王星:Julia写作的审美环境 (Pluto: An Aesthetic Environment for Writing Julia)

Julia works through REPL in the command line. I hear that Visual Studio Code’s extension for Julia is also great. But it is best to use the Pluto for a task like image analysis and to be able to get instant feedback is something really helpful for it.

Julia在命令行中通过REPL工作。 我听说Visual Studio Code对Julia的扩展也很棒。 但是,最好将冥王星用于图像分析之类的任务,并能够获得即时反馈,这确实很有帮助。

Image for post
Pluto Interface. Source: Author
冥王星界面。 资料来源:作者

Pluto interface is really good-looking, and I like the fonts chosen.

冥王星界面真的很好看,我喜欢选择的字体。

And Pluto has a handy Live docs feature. You just need to place your cursor inside a function or an object, and if you click the Live docs icon, it will display the documentation for that particular function or object.

冥王星具有便捷的实时文档功能。 您只需要将光标放在函数或对象内,如果单击Live docs图标,它将显示该特定函数或对象的文档。

Here I have placed my cursor in the rand method, and I am shown documentation like this-

在这里,我将光标放在rand方法中,并且显示了如下文档:

Image for post
rand() documentation, source: Author
rand()文档,来源:作者

You have to type ??function() in Jupyter Notebook to get the documentation.

您必须在Jupyter Notebook中键入??function()才能获取文档。

Julia支持表情符号 (Emoji Support In Julia)

Julia not only supports emojis as strings, but they are also supported for naming variables, too!

Julia不仅支持表情符号作为字符串,而且还支持将它们命名为变量!

Image for post
Generating Random Combinations of Emojis from a Given List, Source: Author
从给定列表中生成表情符号的随机组合,来源:作者
Image for post
Naming Variables with Emojis, source: Author
使用表情符号命名变量,来源:作者

See? You can name variables with emojis in Julia!

看到? 您可以在Julia中使用表情符号来命名变量!

Working With Images

处理图像

Working with images in Julia is intuitive. You can load an image from the web or your local storage and work with that image in Julia.

在Julia中使用图像非常直观。 您可以从Web或本地存储中加载图像,然后在Julia中使用该图像。

What’s different in Julia, is that here, you work with the images themselves. In other languages, an image object or something similar is created, or we have to work with the path of the file. But here, one further level of abstraction is added, and you can just work with images themselves. Let me show you:

Julia的不同之处在于,您可以在其中处理图像本身。 用其他语言,将创建图像对象或类似对象,或者我们必须使用文件的路径。 但是在这里,又增加了一个抽象级别,您可以只使用图像本身。 让我演示给你看:

First, you load from local storage or download to local storage and then load an image-

首先,您从本地存储加载或下载到本地存储,然后加载图像-

Image for post
Source of Original Picture 原始图片来源

I have also downloaded a Haddock picture. And let me show you what I did.

我还下载了Haddock图片。 让我告诉你我做了什么。

Image for post
Source of Original Haddock Picture 黑线鳕原始图片的来源

I generated a 2D array with some images with just one line of code! I was fascinated by that.

我用一行代码生成了带有某些图像的2D数组! 我对此着迷。

进一步的图像处理 (Further Image Processing)

Working with images is very intuitive and easy in Julia.

在Julia中,使用图像非常直观且容易。

You can treat images, parts of images like you treat any other elements in other programming languages.

您可以像对待其他编程语言中的任何其他元素一样对待图像,图像的一部分。

Let me show you. But before that, I would like you to know that Julia comes with an RGB ‘colorspace’ that lets you store a color to a variable and use it elsewhere.

让我演示给你看。 但是在此之前,我想让您知道Julia带有RGB “颜色空间”,可以将颜色存储到变量中并在其他地方使用。

Image for post
Using the RGB ‘colorspace’, source: Author
使用RGB'colorspace',来源:作者

I downloaded a picture of this guy and stored into a variable:

我下载了此人的图片并存储到变量中:

Image for post
Source of Original Picture 原始图片来源

You can get the size and crop it very easily through Julia.

您可以通过Julia获得尺寸并轻松裁剪。

What’s interesting here, you can access each pixel or a group of pixels and manipulate them as you wish.

在这里有趣的是,您可以访问每个像素或一组像素,并根据需要对其进行操作。

Image for post
Operations on a Group of Pixels, source: Author
像素组上的运算,来源:作者

Here, I just took some pixels and assigned them the value red, which is a color. And it was so simple and seamless.

在这里,我只是获取了一些像素,并为其分配了红色值,这是一种颜色。 它是如此简单和无缝。

You can do more interesting stuff like making a blue light filter.

您可以做更多有趣的事情,例如制作蓝色滤光片。

Image for post
A Function for Reducing the Amount of Blue in a Picture, source: Author
减少图片中蓝色量的功能,来源:作者

I wrote a function and applied it to the picture. It was straightforward. And functions like this can be applied to a group of images, too- making it useful in data augmentation in Computer Vision training sets. There could be other fascinating applications to Computer Vision problems.

我编写了一个函数并将其应用于图片。 这很简单。 这样的功能也可以应用于一组图像,从而使其在计算机视觉训练集中的数据增强中很有用。 对于计算机视觉问题,可能还有其他有趣的应用程序。

像变量一样对待图像 (Treating Images Like Variables)

Not only can you do pixel-level operations in Julia in an effortless manner, but you can also manipulate them in many ways.

您不仅可以毫不费力地在Julia中进行像素级操作,还可以通过多种方式进行操作。

Image for post
Stacking Images, source: Author
堆叠图像,来源:作者

And just by running-

只需运行-

[
head reverse(head, dims=2)
reverse(head, dims=1) reverse(reverse(head, dims=1), dims=2)
]

you can create this —

您可以创建此-

Image for post
Stacking Mirrored and Reversed Images, source: Author
堆叠镜像和反转图像,来源:作者

Again, I see the application of this in augment transformation in the training of Neural Networks in Deep Learning.

再次,我看到了它在深度学习中的神经网络训练中的增强转换中的应用。

同时更新 (Simultaneous Update)

As a user of Jupyter, I could not help but notice

作为Jupyter的用户,我不禁注意到

In Jupyter Notebook, until you run a cell, the changes in the contents of the cell (variables, methods, classes, etc.) do not get reflected.

在Jupyter Notebook中,除非您运行单元格,否则单元格内容(变量,方法,类等)的更改都不会得到反映。

But Pluto and Julia do that automatically.

但是冥王星和Julia会自动做到这一点。

Image for post
GIF Showing Simultaneous Update, source: Author
显示同时更新的GIF,来源:作者

Now, this is a more nuanced issue. And for me, the jury is still out whether this will end up being helpful.

现在,这是一个更加细微的问题。 对我而言,陪审团仍在争论是否最终会有所帮助。

强大的PDF转换支持 (Great PDF Conversion Support)

You can convert Pluto notebooks to PDF without any significant loss. Pluto’s PDF support is laudable.

您可以将Pluto笔记本转换为PDF,而不会造成任何重大损失。 冥王星的PDF支持值得称赞。

For full code, (and to see that Julia creates flawless PDF files) you can download the two notebooks involved here (Dropbox link) —

要获取完整的代码(并确保Julia可以创建完美的PDF文件),您可以在此处下载涉及的两个笔记本(Dropbox链接)—

缺乏捷径(Lack Of Shortcuts)

I could move around Jupyter without having to touch the mouse, but that is not possible in Pluto. There are only a few shortcuts and mouses are indispensable. I can’t say I like that about Pluto. But looks like they are working on it.

我无需触摸鼠标就可以在Jupyter中移动,但这在Pluto中是不可能的。 只有少数快捷方式,并且鼠标是必不可少的。 我不能说我喜欢冥王星。 但是看起来他们正在努力

包管理器 (The Package Manager)

Julia has a simple and effective package manager that is accessible from inside Pluto and from the command line.

Julia有一个简单有效的软件包管理器,可从Pluto内部和命令行访问。

I prefer the command line, any day.

无论如何,我更喜欢命令行。

Image for post
Package Managing from Command Line, source: Author
从命令行进行软件包管理,来源:作者

结论(Conclusion)

As you can see, I have barely scratched the surface here. I have used Julia and Pluto for only one day. And I have shared what I have experienced, what I liked, and what I disliked.

如您所见,我在这里几乎没有刮过表面。 我只用Julia和Pluto一天。 我分享了我的经历,喜欢的事物和不喜欢的事物。

A lot (if not all) is left for me to explore. And I am looking forward to that!

还有很多(如果不是全部)供我探索。 我很期待!

You can check out the TEDx Talk at MIT where one of the co-founders shares his vision for the language.

您可以在麻省理工学院观看TEDx演讲,其中一位共同创始人分享他对该语言的看法。

与我联系 (Connect With Me)

Peace!

和平!

翻译自: https://towardsdatascience.com/my-first-encounter-with-julia-15777c6189f9

julia提取第一列

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值