I found a seashell in the middle of the desert
I found a seashell in the middle of the desert
我在沙漠中央发现了一个海螺壳
I found a seashell in the middle of the desert. To my amazement, I found a fully solid rock that eerily resembles a seashell at the base of a cliff in the Alghat desert, Saudi Arabia. I didn’t know what to make of it at first; it had the swirls and shape of a seashell but was fully a rock. More importantly, it shouldn’t be here; the nearest coastline is Dammam’s, 500 km away. This looks impossible. 我在沙漠中央发现了一个海螺壳。令我惊讶的是,在沙特阿拉伯阿尔加特(Alghat)沙漠的一处悬崖底部,我发现了一块外形酷似海螺壳的坚硬岩石。起初我不知该如何解释:它有着海螺的螺旋纹路和形状,但本质上却是一块岩石。更重要的是,它不应该出现在这里;距离最近的海岸线是达曼(Dammam),远在 500 公里之外。这看起来简直不可思议。
Carbonate rocks (e.g. limestone), marine fossils, coral fossils, and sedimentary structures (like ripples or bioturbation) all exist in and around Alghat, which points to the fact that parts of the Arabian Peninsula were once submerged under the sea. Specifically in the late Jurassic age (~150 million years ago). 在阿尔加特及其周边地区,碳酸盐岩(如石灰岩)、海洋化石、珊瑚化石以及沉积结构(如波痕或生物扰动)随处可见,这表明阿拉伯半岛的部分地区曾经沉没在海底。具体来说,那是在侏罗纪晚期(约 1.5 亿年前)。
Nevertheless, I was still super curious about the fossil I found; what animal inhabited it? What did it look like back in the Jurassic age? Any modern relatives or lookalikes? The proper way of answering these questions is to conduct a detailed analysis of the fossil (e.g. via inspecting the sediment it was found in, its shape, etc.), which should be done by an expert paleontologist. However, I know no paleontology, or any paleontologist, so I figured I could DIY it myself (how hard could it be..?), though I’ll do it strictly via its shape — or what’s called its morphology. 尽管如此,我对发现的这块化石依然充满好奇:它曾经属于哪种动物?在侏罗纪时期它长什么样?有没有现代的近亲或相似物种?回答这些问题的正规方法是对化石进行详细分析(例如检查发现它的沉积物、形状等),这本应由专业的古生物学家来完成。然而,我既不懂古生物学,也不认识古生物学家,所以我决定自己动手(能有多难呢……?),尽管我只能通过它的形状——也就是所谓的形态学——来进行研究。
Morphology alone is probably not accurate enough to discern lineage as different species might look alike but are from different lineages, so this is probably not the best way to do it, but it sounded fun and intuitive, so I gave it a try. Concretely, I plan on: Mathematically representing the shape of a shell; Defining a distance metric between shapes (so that I can find shells similar to the fossil’s); Mapping out the space of shapes. 仅凭形态学可能不足以辨别血缘关系,因为不同物种可能长相相似但属于不同的谱系,所以这可能不是最好的方法,但它听起来既有趣又直观,所以我尝试了一下。具体来说,我计划:用数学方式表示贝壳的形状;定义形状之间的距离度量(以便找到与该化石相似的贝壳);绘制出形状空间。
7894 different species and 59244 images of shells were in the Zhang, et al. shell dataset; good enough for me! Capturing ‘shape’ is actually a very hard problem; any object can be rotated by pitch, yaw, roll, scaled, and translated. Before starting any statistical analysis, I followed a guideline to isolate the shape from other factors: The shell must be centered to the midpoint of the picture; The scale of the shell must be equivalent across all images (specifically, the maximum distance from the origin is 1); Orientation is the hardest part. Zhang 等人的贝壳数据集中包含了 7894 个不同物种和 59244 张贝壳图像;对我来说足够了!捕捉“形状”实际上是一个非常困难的问题;任何物体都可以进行俯仰、偏航、翻滚旋转、缩放和平移。在开始任何统计分析之前,我遵循了一套准则来将形状与其他因素隔离开来:贝壳必须位于图片的中心点;所有图像中贝壳的比例必须一致(具体来说,从原点出发的最大距离为 1);方向是最难处理的部分。
Pitch and yaw can be fixed by only choosing samples where the shell’s opening is facing the camera. This is not perfect, but I found the dataset to be pretty consistent with its angles. Roll is difficult. A shell can be rotated in any way around the axis (even whilst the opening is facing the camera). My fix was to use the longest radius as the reference point, and rotate the shell so that the longest radius is always on the right. This is not perfect either, but it was good enough for me. 俯仰和偏航可以通过只选择开口朝向相机的样本来固定。这并不完美,但我发现该数据集的角度相当一致。翻滚则比较困难。贝壳可以绕轴以任何方式旋转(即使开口正对着相机)。我的解决方法是使用最长半径作为参考点,并旋转贝壳,使最长半径始终位于右侧。这也不完美,但对我来说已经足够了。
Then, I extracted the contour of the shell to 256 points relative to the center. This way, each shell is represented by a 256x2 matrix, where each row is the (x, y) coordinates of a point on the contour. 然后,我提取了相对于中心点的 256 个贝壳轮廓点。这样,每个贝壳都由一个 256x2 的矩阵表示,其中每一行都是轮廓上一个点的 (x, y) 坐标。
Naturally, the distance between two shells s1 and s2 is squared euclidean distance between their contour points: $$ d(s1, s2) = {\sum_{256} (s1.x_i - s2.x_i)^2 + (s1.y_i - s2.y_i)^2} $$ 自然地,两个贝壳 s1 和 s2 之间的距离就是它们轮廓点之间的平方欧几里得距离: $$ d(s1, s2) = {\sum_{256} (s1.x_i - s2.x_i)^2 + (s1.y_i - s2.y_i)^2} $$
Representing the space will require 256 dimensions, which is a little more than just the 2 I need to plot it over x and y. Given the normalized shell contour above, it’s clear that many of these dimensions are redundant, so the space of possible shells can be condensed into a smaller latent space. Dimensionality reduction techniques map the original 256 dimensions onto a smaller number of dimensions (e.g. 2 or 3) while trying to preserve the distance between shells as much as possible. One such technique I’ll be using is Principal Component Analysis (PCA). 表示这个空间需要 256 个维度,这比我在 x 和 y 轴上绘图所需的 2 个维度要多得多。鉴于上述归一化的贝壳轮廓,很明显其中许多维度是冗余的,因此可能的贝壳空间可以压缩成一个更小的潜在空间。降维技术将原始的 256 个维度映射到较少的维度(例如 2 或 3 个),同时尽可能保持贝壳之间的距离。我将使用的一种技术是主成分分析(PCA)。
After applying PCA, I retained 56.50% of the variance using only the first principal component (PC1), and 67.25% using the first two. This means we can describe a shell’s shape by only two numbers, and be pretty close to the original shape! The interesting part is trying to understand what these two numbers mean. PC1 seems to capture the ‘pointiness’ of the shell, i.e. more than 50% of variance in shell shapes can be explained by how pointy they are. PC2 seems to capture the symmetry of the shell, or perhaps the mass distribution over the vertical axis. 应用 PCA 后,仅使用第一个主成分(PC1)就保留了 56.50% 的方差,使用前两个主成分则保留了 67.25%。这意味着我们只需用两个数字就能描述一个贝壳的形状,并且与原始形状非常接近!有趣的是去理解这两个数字的含义。PC1 似乎捕捉到了贝壳的“尖锐度”,即超过 50% 的贝壳形状差异可以用它们的尖锐程度来解释。PC2 似乎捕捉到了贝壳的对称性,或者说是垂直轴上的质量分布。
And now for the grand finale, we can plot the shells in the latent space, and see where our Alghat fossil fits in it. But first, for dramatic tension, I will discuss the plot. The plot represents PC1. 现在是最后的高潮,我们可以将这些贝壳绘制在潜在空间中,看看我们的阿尔加特化石位于何处。但首先,为了增加戏剧性,我先来讨论一下这张图。这张图代表的是 PC1。