# Bounds and Constructions of Singleton-Optimal Locally Repairable Codes with
Small Localities

Weijun Fang, Bin Chen, Shu-Tao Xia, Fang-Wei Fu Weijun Fang is with School of
Cyber Science and Technology, Shandong University, Qingdao, 266237, P.R.
China. (Email<EMAIL_ADDRESS>Bin Chen is with Department of Computer
Science and Technology, Harbin Institute of Technology, Shenzhen, 518055, P.R.
China. (Email: chenbin2021@hit.edu.cn)Shu-Tao Xia are with Tsinghua Shenzhen
International Graduate School, Tsinghua University, Shenzhen 518055, P.R.
China (Email<EMAIL_ADDRESS>Fang-Wei Fu is with Chern Institute
of Mathematics and LPMC, Nankai University, Tianjin 300071, P.R. China.
(Email: fwfu@nankai.edu.cn.)†This research is supported in part by National
Key R$\&$D Program of China under Grant Nos. 2021YFA1001000 and
2018YFA0704703, the National Natural Science Foundation of China under Grants
62171248, 61971243, the Fundamental Research Funds for the Central
Universities, Nankai University, the Natural Science Foundation of Tianjin
(20JCZDJC00610).

###### Abstract

Constructions of optimal locally repairable codes (LRCs) achieving Singleton-
type bound have been exhaustively investigated in recent years. In this paper,
we consider new bounds and constructions of Singleton-optimal LRCs with minmum
distance $d=6$, locality $r=3$ and minimum distance $d=7$ and locality $r=2$,
respectively. Firstly, we establish equivalent connections between the
existence of these two families of LRCs and the existence of some subsets of
lines in the projective space with certain properties. Then, we employ the
line-point incidence matrix and Johnson bounds for constant weight codes to
derive new improved bounds on the code length, which are tighter than known
results. Finally, by using some techniques of finite field and finite
geometry, we give some new constructions of Singleton-optimal LRCs, which have
larger length than previous ones.

###### Index Terms:

Locally repairable codes, Singleton-type bound, optimal LRCs, finite geometry,
constant weight codes

##  I Introduction

In a large-scale distributed storage system (DSS), node failures frequently
occur and it is critical to recover a failed node in time. Due to the large
storage overhead of replication strategy, erasure codes were introduced to
increase the storage efficiency and reduce the cost during repairing a failed
node. To minimize the number of storage nodes involved in repairing a failed
node, Gopalan _et al._ [11] introduced locally repairable codes to recover a
failed node by accessing few available nodes. Suppose $\mathcal{C}$ is an
$[n,k,d]_{q}$ linear code. The $i$-th symbol of $C$ has _locality_ $r$ if
there exists a subset $R_{i}\subset[n]=\\{1,2,\cdots,n\\}$ with $i\in R_{i}$
and $|R_{i}|\leq r+1$ such that the $i$-th symbol $c_{i}$ can be represented
as a linear combination of $\\{c_{j}\\}_{j\in R_{i}\setminus\\{i\\}}$. The
subset $R_{i}$ is called the _repair group_ of the $i$-th symbol. $C$ is
called a _locally repairable code_ (LRC) with locality $r$ if each symbol of
$C$ has locality $r$. We denote such a code as an $(n,k,d;r)$-LRC. An LRC is
saied to have _disjoint local repair groups_ if the set of coordinates $[n]$
is exactly the disjoint union of some repair groups of size $r+1$, i.e.,
$[n]=\bigsqcup_{i}R_{i},$ and $|R_{i}|=r+1$. In this paper, we mainly focus on
LRCs with disjoint local repair groups. The reason is that LRCs with disjoint
local repair groups are widely adopted in constructing LRCs and have more
advantages in performance. Any $q$-ary $(n,k,d;r)$-LRCs have to satisfy the
well-known Singleton-type bound in [11],

$d\leq n-k-\left\lceil\frac{k}{r}\right\rceil+2.$ (1)

A $q$-ary $[n,k,d]$ linear code $\mathcal{C}$ with locality $r$ is called a
_Singleton-optimal_ $(n,k,d;r)$-LRC if it achieves the bound (1) with
equality. Constructing Singleton-optimal LRCs have been exhaustively
investigated in the literature ([11, 25, 27, 12, 10, 4, 16, 17, 26, 7, 3,
23]). When the locality $r=k$, the Singleton-type bound reduces to the
Classical Singleton bound. Thus Singleton-optimal LRCs are analog to MDS
codes. For any given $d$ and $r$, a Singleton-optimal LRC with longer length
$n$ would have larger code rate $k/n$. Thus it is interesting to construct
Singleton-optimal LRCs with large length and deriving an upper bound on the
maximal code length.

In [26], Tamo and Barg first gave a breakthrough construction of Singleton-
optimal LRCs via subcodes of Reed-Solomon codes whose code length can go up to
the alphabet size. Chen _et al._ [7, 3] completely determined the $q$-ary
Singleton-optimal LRCs of length $n\mid(q+1)$ for all possible parameters via
cyclic and constacyclic codes. In [21], Jin _et al._ also constructed a family
of $q$-ary Singleton-optimal $r$-LRCs with length up to $q+1$ by using the
automorphism group of rational function fields. For some particular
$r=2,3,5,7,11$ or $23$, Singleton-optimal LRCs with lengths up to
$q+2\sqrt{q}$ are constructed via elliptic curves [22]. When the minimum
distance $d=3$ or $4$, Luo _et al._ [23] proposed a construction of cyclic
Singleton-optimal LRCs whose length can be arbitrarily large. Analog to the
well-known MDS conjecture, the problem of the maximal code length of
Singleton-optimal LRCs has attracted the attention of many scholars. For
minimum distance $d\geq 5$, Guruswami _et al._ [12] proved that the code
length of a $q$-ary Singleton-optimal LRC must be at most roughly $O(dq^{3})$.
Jin [20] presented an explicit construction of $q$-ary optimal LRCs of length
$\Omega_{r}(q^{2})$ via binary constant weight codes. In [29], Xing and Yuan
generalized Jin’s results and presented a construction of $q$-ary Singleton-
optimal LRCs for general $d\geq 7$ via hypergraph theory. Recently, Cai et al.
[5] improved these results and generalized them to the $(r,\delta)$-LRCs. In
our prior work [10, 4], we considered the case of $d=6$ and $r=2$ and provided
some new constructions and bounds of Singleton-optimal LRCs with larger code
length. We summarize some known constructions of $(n,k,d;r)$-Singleton-optimal
LRCs in Table I.

TABLE I: Some known constructions of Singleton-optimal $(n,k,d;r)$-LRCs Length $n$ | Minimum distance $d$ | Locality $r$ | References
---|---|---|---
$n=q$ | $d\leq n$ | $r\leq k$ | [26]
$n=q+1$ | $d\leq n$ | $r\leq k$ | [7, 3, 21]
$n=q+2\sqrt{q}$ | $(r+1)\mid d$ | $r=2,3,5,7,11,23$ | [22]
Unbounded | $d=3,4$ | $r\geq 2,r+1\mid q+1$ | [23]
$n=3(2q-4)$ | $d=6$ | $r=2$ | [10, 4]
$n=\Omega_{r}(q^{2})$ | $d=5,6$ |  $r\geq 4$, $r$ is a prime power | [20, 29]
$n=q^{2-o(1)}$ | $d=7,8$ | $r\geq d-2$ | [29]
$n=q^{3/2-o(1)}$ | $d=9,10$ | $r\geq d-2$ | [29]
$n=\Omega_{q,r}(q(q\log q)^{\frac{1}{\lfloor\frac{d-3}{2}\rfloor}})$ | $d\geq 11$ | $r\geq d-2$ | [29]

In this paper, we consider new bounds and constructions of Singleton-optimal
LRCs with minmum distance $d=6$, locality $r=3$ and minimum distance $d=7$ and
locality $r=2$, respectively. By using the approach of parity-check matrix, we
establish equivalent connections between the existence of these two families
of LRCs and the existence of some subsets of lines in projective geometry with
special structures. New improved bounds and optimal constructions of LRCs with
large length are then obtained. We summarize some known bounds on the code
length of $(n,k,d;r)$ Singleton-optimal LRCs for $d=6,r=3$ and $d=7,r=2$ in
Table II and list our main results as follows.

TABLE II: Some known bounds on the code length of Singleton-optimal $(n,k,d;r)$-LRCs for $d=6,r=3$ and $d=7,r=2$ Minimum distance $d$ | Locality $r$ | Length $n$ | References
---|---|---|---
$d=6$ | $r=3$ | $n\leq\frac{4q^{4}}{3(q-1)}$ | [12]
$d=6$ | $r=3$ | $n\leq 4\lfloor\frac{q^{2}+q+1}{6}\rfloor$ | [4]
$d=7$ | $r=2$ | $n\leq\frac{3}{2}(\frac{q^{3}}{q-1}+1)$ | [12]
$d=7$ | $r=2$ | $n\leq 3\lfloor\frac{(q^{2}+1)(q+1)}{3}\rfloor$ | [4]

  * •

We provide sufficient and necessary conditions on the existence of Singleton-
optimal $(n,k,d;r)$-LRCs for $d=6,r=3$ and $d=7,r=2$ with disjoint repair
groups, respectively, which establish equivalent connections with some subsets
of lines in the projective space with certain properties (see Theorems 2 and
8);

  * •

For any $q$-ary Singleton-optimal $(n,k,d=6;r=3)$-LRCs with disjoint repair
groups, we prove that $n=O(q^{1.5})$ (see Theorem 4);

  * •

We give an explicit construction of $q$-ary Singleton-optimal
$(n,k,d=6;r=3)$-LRCs with $n=q+4$ and $q=2^{m}$ (see Theorem 7);

  * •

For any $q$-ary Singleton-optimal $(n,k,d=7;r=2)$-LRCs with disjoint repair
groups, we prove that $n\leq 3\lfloor\frac{q^{2}+q+3}{3}\rfloor$ (see Theorem
9);

  * •

We show the existence of $q$-ary Singleton-optimal $(n,k,d=7;r=2)$-LRCs with
$n\approx\sqrt{2}q$ (see Theorems 10 and 11).

According to Tabels I and II, our new bounds on the code length improve the
previous results and our new constructions of Singleton-optimal LRCs have
larger length than previous constructions.

The rest of this paper is organized as follows. In Section II, we introduce
some basic results on LRCs, finite geometry and the Johnson bound for constant
weight codes. In Section III, we consider the new constructions and bounds of
Singleton-optimal $(n,k,d=6;r=3)$-LRCs. In Section IV, we consider the new
constructions and bounds of Singleton-optimal $(n,k,d=7;r=2)$-LRCs. We
conclude this paper in Section V.

##  II Preliminaries

In this section, we introduce some basic notation and results about LRCs,
finite geometry and constant weight codes.

###  II-A LRCs with Disjoint Repair Groups

Suppose $q$ is prime power and $\mathbb{F}_{q}$ is a finite field with $q$
elements. Denote $[n]\triangleq\\{1,2,\dots,n\\}$. For a vector
$\bm{v}=(v_{1},v_{2},\cdots,v_{n})\in\mathbb{F}_{q}^{n}$, the support of
$\bm{v}$ is defined as $\text{supp}(\bm{v})\triangleq\\{i\in[n]:v_{i}\neq
0\\}$.

First, we recall the parity-check matrix approach to LRCs proposed in [19, 4].
Let $C$ be an $[n,k,d]_{q}$-linear code and $(r+1)\mid n$. Then $C$ is an LRC
with locality $r$ if and only if for each $i\in[n]$, there exists a codeword
$\bm{h}_{i}$ of the dual code $C^{\perp}$ such that
$i\in\text{supp}(\bm{h}_{i})$ and $wt(\bm{h}_{i})\leq r+1$. Throughout this
paper, we assume that the LRCs have _disjoint local repair groups_. Thus there
exist $\ell\triangleq\frac{n}{r+1}$ vectors
$\bm{h}_{1},\bm{h}_{2},\ldots,\bm{h}_{\ell}$ of $C^{\perp}$ which are called
_locality vectors_ , such that $wt(\bm{h}_{i})=r+1$ and
$\text{supp}(\bm{h}_{i})\cap\text{supp}(\bm{h}_{j})=\emptyset$ for any $1\leq
i\neq j\leq\ell$. Since two equivalent codes have the same code length,
dimension, minimum distance and locality. Thus an LRC with disjoint local
repair groups has an equivalent parity-check matrix $H$ as the following form:

$\left(\begin{array}[]{cccc|cccc|c|cccc}1&1&\\!\\!\\!\dots\\!\\!\\!&1&0&0&\\!\\!\\!\dots\\!\\!\\!&0&\\!\\!\\!\dots\\!\\!\\!&0&0&\\!\\!\\!\dots\\!\\!\\!&0\\\
0&0&\\!\\!\\!\dots\\!\\!\\!&0&1&1&\\!\\!\\!\dots\\!\\!\\!&1&\\!\\!\\!\dots\\!\\!\\!&0&0&\\!\\!\\!\dots\\!\\!\\!&0\\\
\vdots&\vdots&\vdots&\vdots&\vdots&\vdots&\vdots&\vdots&\\!\\!\\!\dots\\!\\!\\!&\vdots&\vdots&\vdots&\vdots\\\
0&0&\\!\\!\\!\dots\\!\\!\\!&0&0&0&\\!\\!\\!\dots\\!\\!\\!&0&\\!\dots\\!&1&1&\\!\\!\\!\dots\\!\\!\\!&1\\\
\hline\cr\mathbf{0}&\bm{v}_{1}^{(1)}&\\!\\!\\!\dots\\!\\!\\!&\bm{v}_{r}^{(1)}&\mathbf{0}&\bm{v}_{1}^{(2)}&\\!\\!\dots&\\!\\!\\!\bm{v}_{r}^{(2)}&\dots&\mathbf{0}&\bm{v}_{1}^{(\ell)}&\\!\\!\dots\\!\\!&\bm{v}_{r}^{(\ell)}\end{array}\right),$
(2)

where the upper part of $H$ contains $\ell$ locality rows and the lower part
of $H$ contains $u\triangleq n-k-\ell$ rows to ensure that $rank(H)=n-k$. The
bold-type letters $\bm{v}_{i}^{(j)}$, $i\in[\ell]$, $j\in[r]$ are column
vectors in $\mathbb{F}_{q}^{u}$, while ${\bf 0}$ represents the all-zero
column vector in $\mathbb{F}_{q}^{u}$.

###  II-B Singleton-Optimal LRCs

The Singleton-optimal LRCs could be equivalently characterized by an
alternative equality as follows.

###### Lemma 1

([12, Lemma II.2]) Let $n,k,d,r$ be positive integers with $(r+1)\mid n$. If
the Singleton-like bound is achieved, then

$n-k=\ell+d-2-\left\lfloor\frac{d-2}{r+1}\right\rfloor.$ (3)

Conversely, if $d-2\not\equiv r(\textnormal{mod~{}}r+1)$ and the equality (3)
is satisfied, then the Singleton-like bound (1) is achieved.

###### Remark 1

If $d-2\equiv r(\textnormal{mod~{}}r+1)$, by [7, Corollary 10] one cannot
achieve the Singleton-type bound with equality and one must have $d\leq
n-k-\left\lceil\frac{k}{r}\right\rceil+1.$ Therefore in this paper we refer
the equality (3) as the Singleton-type bound of LRCs.

###  II-C Finite Geometry

In this subsection, we introduce some basic notion and results of geometry
over finite fields, which will be used in Sections III and IV. And we refer
the readers to [9, 24, 1, 2, 14] for more details about finite geometry.

Let $\mathbb{F}_{q}^{N+1}$ be the $(N+1)$-dimensional vector space over
$\mathbb{F}_{q}$ with origin $\bm{0}$. We consider the equivalence relation on
the vectors of $\mathbb{F}_{q}^{N+1}\setminus\\{\bm{0}\\}$ whose equivalence
classes are the one-dimensional subspaces of $\mathbb{F}_{q}^{N+1}$ without
the origin. Precisely, for two nonzero vectors
$\bm{u}=(u_{1},u_{2},\dots,u_{N+1}),\bm{v}=(v_{1},v_{2},\dots,v_{N+1})\in\mathbb{F}_{q}^{N+1}\setminus\\{\bm{0}\\}$,
we say $\bm{u}$ is equivalent to $\bm{v}$ if there exists
$t\in\mathbb{F}_{q}^{*}$ such that $\bm{u}=t\bm{v}$.

######  Definition 1 ([14])

The $N$-_dimensional projective space_ over $\mathbb{F}_{q}$ is defined as the
set of equivalence classes and is denoted by $PG(N,q)$. The elements of
$PG(N,q)$ are called _points_. In particular, when $N=2$, $PG(N,q)$ is called
the _projective plane_.

If the point $P(\bm{u})$ is the equivalence class of the vector
$\bm{u}\in\mathbb{F}_{q}^{N+1}\setminus\\{\bm{0}\\}$, we say that $\bm{u}$ is
a vector representing $P(\bm{u})$. We say that the points
$P(\bm{u}_{1}),P(\bm{u}_{2}),\dots,P(\bm{u}_{s})$ are collinear if the vectors
$\bm{u}_{1},\bm{u}_{2},\dots,\bm{u}_{s}$ are linearly dependent. _A subspace
of dimension_ $m$, or an $m$-_subspace_ of $PG(N,q)$ is a set of points all of
whose representing vectors form (together with the origin) a subspace of
dimension $m+1$ of $\mathbb{F}_{q}^{N+1}$. A subspace of dimension zero has
already called _a point_. Subspaces of dimensions one and two are called a
_line_ and a _plane_ , respectively.

Some basic properties of $PG(N,q)$ are summarized in the following.

######  Lemma 2 ([14])

(i)

Each line in $PG(N,q)$ has $q+1$ points;

(ii)

The number of lines in $PG(N,q)$ throughing a fixed point is
$\frac{q^{N}-1}{q-1}$;

(iii)

Any two distinct lines in the projective plane $PG(2,q)$ meet at exactly one
point;

(iv)

The number of points in the projective plane $PG(2,q)$ is $q^{2}+q+1.$

The following is the well-known principle of duality in the projective plane
$PG(2,q)$.

###### Theorem 1

[1, Theorem 2.1,The Principle of Duality] If $T$ is a theorem valid in the
projective plane $PG(2,q)$, and $T^{\prime}$ is the statement obtained from
$T$ by making the following changes:

$point\leftrightarrow line,$ $collinear\leftrightarrow concurrent,$
$join\leftrightarrow intersection,$

and whatever grammatical adjustments that are necessary, then $T^{\prime}$
(called the Dual Theorem) is a valid theorem in the $PG(2,q)$.

Finally, we introduce the definitions of spreads and sunflowers in projective
space, respectively.

######  Definition 2 (Spreads in the projective space [2])

Suppose $t\leq N$. A $t$-spread in a $N$-dimensional projective space
$PG(N,q)$ is a set $S$ of $t$-dimensional subspaces such that any point of
$PG(N,q)$ is on exactly one element of $S$.

######  Lemma 3 ([2])

A finite projective space $PG(N,q)$ contains a $t$-spread if and only if
$(t+1)\mid(N+1)$. In particular, there exists a spread of lines in $PG(3,q)$
of size $q^{2}+1$.

######  Definition 3 (Sunflowers in projective space [9])

Suppose $t\leq s\leq N$. A _sunflower_ $SF_{q}(t,s,N)$ is a set $S$ of
$s$-subspaces of $PG(N,q)$ such that they meet at a common $t$-subspace. The
common $t$-subspace is called the _center_ of $SF_{q}(t,s,N)$ and the
$s$-subspaces are called _petals_ of $SF_{q}(t,s,N)$. A sunflower
$SF_{q}(t,s,N)$ is called _maximal_ if it has largest possible size for fixed
$q,t,s,N$.

When $s=t+1$, we can calculate the size of a maximal sunflower
$SF_{q}(t,t+1,N)$

###### Lemma 4

The size of a maximal sunflower $SF_{q}(t,t+1,N)$ is equal to
$\frac{q^{N-t}-1}{q-1}$.

###### Proof:

By using the affine geometry language, it is equivalent to show that for a
fixed $(t+1)$-subspace $V$ of $\mathbb{F}_{q}^{N+1}$, the total number $M$ of
$(t+2)$-subspaces containing $V$ is equal to $\frac{q^{N-t}-1}{q-1}$. Let
$\\{\bm{v}_{1},\bm{v}_{2},\cdots,\bm{v}_{t+1}\\}$ be a basis of $V$, then the
number of vectors $\bm{v}_{t+2}\in\mathbb{F}_{q}^{N+1}$ such that
$\bm{v}_{1},\bm{v}_{2},\cdots,\bm{v}_{t+2}$ span a $(t+2)$-dimensional
subspace of $\mathbb{F}_{q}^{N+1}$ is equal to $q^{N+1}-q^{t+1}$. Let $U$ be
any $(t+2)$-subspace containing $V$. Then the number of vectors
$\bm{v}_{t+2}\in U$ such that $\bm{v}_{1},\bm{v}_{2},\cdots,\bm{v}_{t+2}$ form
a basis of $U$ is equal to $q^{t+2}-q^{t+1}$. Thus

$M=\frac{q^{N+1}-q^{t+1}}{q^{t+2}-q^{t+1}}=\frac{q^{N-t}-1}{q-1}.$

The lemma is proved. ∎

###  II-D Binary Constant Weight Codes

A binary $(n,M,d;w)$ constant weight code is a set of binary vectors of length
$n$ with $M$ vectors, such that each vector contains $w$ ones and $n-w$ zeros,
and any two distinct vectors differ in at least $d$ positions. The following
is the well-known Johnson bound for binary constant weight codes, which is
important for our subsequent derivation.

###### Lemma 5

([24, Restricted Johnson Bound]) Let $C$ be a binary $(n,M,d=2\delta;w)$
constant weight code, then

$M(w^{2}-wn+\delta n)\leq\delta n.$

##  III Singleton-optimal LRCs with $d=6$ and $r=3$

In this section, we consider Singleton-optimal LRCs with minimum distance
$d=6$ and locality $r=3$. Throughout this section, we assume $4\mid
n,\ell=\frac{n}{4}$.

Suppose $C$ is an LRC of length $n$, dimension $k$, minimum distance $d=6$ and
locality $r=3$ with disjoint repair groups. From Sec. II.A, we assume that $C$
has a parity-check matrix $H$ as the following form:

$H=\left(\begin{array}[]{cccc|cccc|c|cccc}1&1&1&1&0&0&0&0&\ldots&0&0&0&0\\\
0&0&0&0&1&1&1&1&\ldots&0&0&0&0\\\
\vdots&\vdots&\vdots&\vdots&\vdots&\vdots&\vdots&\vdots&\ddots&\vdots&\vdots&\vdots&\vdots\\\
0&0&0&0&0&0&0&0&\ldots&1&1&1&1\\\
\hline\cr\bm{0}&\bm{u}_{1}&\bm{v}_{1}&\bm{w}_{1}&\bm{0}&\bm{u}_{2}&\bm{v}_{2}&\bm{w}_{2}&\ldots&\bm{0}&\bm{u}_{\ell}&\bm{v}_{\ell}&\bm{w}_{\ell}\\\
\end{array}\right),$ (4)

where $\bm{u}_{i},\bm{v}_{i},\bm{w}_{i}\in\mathbb{F}_{q}^{u},$ $i\in[\ell]$,
$u=n-k-\ell$.

For convenience, denote
$H=(\bm{h}_{0,1},\bm{h}_{1,1},\bm{h}_{2,1},\bm{h}_{3,1},\cdots,\bm{h}_{0,\ell},\bm{h}_{1,\ell},\bm{h}_{2,\ell},\bm{h}_{3,\ell})$,
where $\bm{h}_{i,j}\in\mathbb{F}_{q}^{n-k}$.

###### Proposition 1

The vectors $\bm{u}_{i},\bm{v}_{i},\bm{w}_{i}$ defined above are linearly
independent over $\mathbb{F}_{q}$.

###### Proof:

Suppose $a\bm{u}_{i}+b\bm{v}_{i}+c\bm{w}_{i}=0$, for some
$a,b,c\in\mathbb{F}_{q}$. Then from (4), we can deduce that
$-(a+b+c)\bm{h}_{0,i}+a\bm{h}_{1,i}+b\bm{h}_{2,i}+c\bm{h}_{3,i}=0$. Since the
minimum distance $d=6$, we have $a=b=c=0$. Thus
$\bm{u}_{i},\bm{v}_{i},\bm{w}_{i}$ are linearly independent ∎

Let

$L_{1,i}\triangleq\textnormal{Span}_{\mathbb{F}_{q}}\\{\bm{u}_{i},\bm{v}_{i}\\}\subseteq\mathbb{F}_{q}^{u},$
$L_{2,i}\triangleq\textnormal{Span}_{\mathbb{F}_{q}}\\{\bm{v}_{i},\bm{w}_{i}\\}\subseteq\mathbb{F}_{q}^{u},$
$L_{3,i}\triangleq\textnormal{Span}_{\mathbb{F}_{q}}\\{\bm{w}_{i},\bm{u}_{i}\\}\subseteq\mathbb{F}_{q}^{u},$

and

$L_{4,i}\triangleq\textnormal{Span}_{\mathbb{F}_{q}}\\{a\bm{u}_{i}+b\bm{v}_{i}+c\bm{w}_{i}:a,b,c\in\mathbb{F}_{q},\textnormal{
and }a+b+c=0\\}\subseteq\mathbb{F}_{q}^{u}.$

From Proposition 1, for any $1\leq i\neq i^{\prime}\leq 4$ and $1\leq
j\leq\ell$, $\dim(L_{i,j})=2$ and $L_{i,j}\neq L_{i^{\prime},j}$.

For convenience, we will use the language of projective geometry. Each
$L_{i,j}$ can be seen as a line in $PG(u-1,q)$. Moreover, we will use
$\bm{u}_{i}$ to represent the point
$\textnormal{Span}_{\mathbb{F}_{q}}\\{\bm{u}_{i}\\}$ in $PG(u,q)$. In this
sense, $\bm{u}_{i}$ and $\lambda\bm{u}_{i}$ represent the same point, for any
$\lambda\in\mathbb{F}_{q}^{*}$.

###### Proposition 2

Denote $B_{i}\triangleq\\{L_{1,i},L_{2,i},L_{3,i},L_{4,i}\\},$ the set of 4
lines $L_{1,i},L_{2,i},L_{3,i},L_{4,i}$ in $PG(u-1,q).$ Then

(i)

$B_{i}\bigcap B_{j}=\emptyset$;

(ii)

For any $1\leq i\neq j\leq\ell$, there are no 3 lines in $B_{i}\bigcup B_{j}$
through a common point.

###### Proof:

(i): $B_{i}\bigcap B_{j}=\emptyset$ follows from $L_{i,j}\neq
L_{i^{\prime},j}$ for any $1\leq i\neq i^{\prime}\leq 4$ and $1\leq
j\leq\ell$.

(ii) Firstly, there are no 3 lines in $B_{i}$ through a common point. Indeed,
the 4 lines in $B_{i}$ produce 6 distinct intersection points: $\bm{u}_{i}$,
$\bm{v}_{i}$, $\bm{w}_{i}$, $\bm{u}_{i}-\bm{v}_{i}$,
$\bm{v}_{i}-\bm{w}_{i}$,$\bm{w}_{i}-\bm{u}_{i}$.

Then, suppose there are three lines of $B_{i}\bigcup B_{j}$ through a common
point. Without loss of generality, we assume that two of them from $B_{i}$ and
the other one from $B_{j}$. There are essentially 4 cases need to be
considered.

1)

Suppose $L_{1,i},L_{2,i},L_{1,j}$ through a common point. Note that $L_{1,i}$
and $L_{2,i}$ meet at the point $\bm{u}_{i}$. Thus
$\bm{u}_{i}=a\bm{u}_{j}+b\bm{v}_{j}$, for some $a,b\in\mathbb{F}_{q}^{*}$.
Then we can verify that $\bm{h}_{0,i},\bm{h}_{1,i},\bm{h}_{0,j},\bm{h}_{1,j}$
and $\bm{h}_{2,j}$ are linearly dependent, which leads to $d\leq 5$;

2)

Suppose $L_{1,i},L_{2,i},L_{4,j}$ through a common point. We can also verify
that $\bm{h}_{0,i},\bm{h}_{1,i},\bm{h}_{1,j},\bm{h}_{2,j}$ and $\bm{h}_{3,j}$
are linearly dependent, which leads to $d\leq 5$;

3)

Suppose $L_{1,i},L_{4,i},L_{1,j}$ through a common point. Note that $L_{1,i}$
and $L_{4,i}$ meet at the point $\bm{u}_{i}-\bm{v}_{i}$. We can verify that
$\bm{h}_{1,i},\bm{h}_{2,i},\bm{h}_{0,j},\bm{h}_{1,j}$ and $\bm{h}_{2,j}$ are
linearly dependent, which also leads to $d\leq 5$.

4)

Suppose $L_{1,i},L_{4,i},L_{4,j}$ through a common point. We can also verify
that $\bm{h}_{1,i},\bm{h}_{2,i},\bm{h}_{1,j},\bm{h}_{2,j}$ and $\bm{h}_{3,j}$
are linearly dependent, which leads to $d\leq 5$.

The proposition is proved. ∎

Now, we are already to present a sufficient and necessary condition of the
existence of $q$-ary Singleton-optimal LRCs of length $n$, minimum distance
$d=6$ and locality $r=3$ with disjoint repair groups.

###### Theorem 2

Suppose $4\mid n$. Then, there exists a $q$-ary Singleton-optimal LRC of
length $n$, minimum distance $d=6$ and locality $r=3$ with disjoint repair
groups if and only if there exist $\ell$ sets $B_{1},B_{2},\ldots,B_{\ell}$,
each of which consists of 4 lines in $PG(2,q)$, such that for any $1\leq i\neq
j\leq\ell$,

(i)

$B_{i}\bigcap B_{j}=\emptyset$;

(ii)

there are no 3 lines in $B_{i}\bigcup B_{j}$ through a common point.

###### Proof:

Necessity: Note that from Eq. (3),
$u=n-k-\ell=d-2-\left\lfloor\frac{d-2}{r+1}\right\rfloor=3$. Then the
conclusion follows from Proposition 2 by taking $u=3$. Sufficiency: Assume
that there exist $\ell$ sets $B_{1},B_{2},\ldots,B_{\ell}$ satisfying the
conditions (i) and (ii). Suppose
$B_{i}=\\{L_{1,i},L_{2,i},L_{3,i},L_{4,i}\\}.$ Then by condition (ii), the 4
lines $L_{1,i},L_{2,i},L_{3,i},L_{4,i}$ produce 6 distinct intersection
points. Suppose $\bm{u}_{i}=L_{1,i}\bigcap L_{3,i}$,
$\bm{v}_{i}=L_{1,i}\bigcap L_{2,i}$, $\bm{w}_{i}=L_{2,i}\bigcap L_{3,i}$,
where $\bm{u}_{i},\bm{v}_{i},\bm{w}_{i}\in\mathbb{F}_{q}^{3}$. Then
$\bm{u}_{i},\bm{v}_{i}$ and $\bm{w}_{i}$ are linearly independent. Thus

$L_{1,i}=\textnormal{Span}_{\mathbb{F}_{q}}\\{\bm{u}_{i},\bm{v}_{i}\\},$
$L_{2,i}=\textnormal{Span}_{\mathbb{F}_{q}}\\{\bm{v}_{i},\bm{w}_{i}\\},$
$L_{3,i}=\textnormal{Span}_{\mathbb{F}_{q}}\\{\bm{w}_{i},\bm{u}_{i}\\}.$

Suppose $L_{1,i}\bigcap L_{4,i}=\alpha\bm{u}_{i}-\beta\bm{v}_{i}$ and
$L_{2,i}\bigcap L_{4,i}=\gamma\bm{v}_{i}-\delta\bm{w}_{i}$, where
$\alpha,\beta,\gamma,\delta\in\mathbb{F}_{q}^{*}$. Without loss of generality,
we may assume that $\beta=\gamma$. Moreover, by replacing
$\bm{u}_{i},\bm{v}_{i}$ and $\bm{w}_{i}$ by $\alpha\bm{u}_{i},\beta\bm{v}_{i}$
and $\delta\bm{w}_{i}$, respectively, we may assume that $L_{1,i}\bigcap
L_{4,i}=\bm{u}_{i}-\bm{v}_{i}$ and $L_{2,i}\bigcap
L_{4,i}=\bm{v}_{i}-\bm{w}_{i}$. Then we have

$L_{4,i}\triangleq\textnormal{Span}_{\mathbb{F}_{q}}\\{a\bm{u}_{i}+b\bm{v}_{i}+c\bm{w}_{i}:a,b,c\in\mathbb{F}_{q},\textnormal{
and }a+b+c=0\\}.$

Now we let $C$ be the linear code with parity-check $H$ given as (4), where
$\bm{u}_{i},\bm{v}_{i}$ and $\bm{w}_{i}$ are given as above. Then $C$ has
locality 3 and the dimension $k\geq n-\ell-3=\frac{3}{4}n-3$. By the
Singleton-type bound,

$d\leq n-k+2-\lceil\frac{k}{3}\rceil\leq 6.$

From condition (ii) and similar discussions of the proof of Proposition 2, we
can verify that any 5 columns of $H$ are linearly independent. Thus $d\geq 6$,
hence $d=6$ and $C$ is a $q$-ary Singleton optimal LRC of length $n$, minimum
distance $d=6$ and locality $r=3$ with disjoint repair groups.

The proof is completed. ∎

According to Theorem 2, we can immediately obtain the first bound on the code
length of Singleton-optimal LRCs with $d=6$ and $r=3$.

###### Theorem 3

Suppose $4\mid n$. Let $C$ be a $q$-ary Singleton-optimal LRC of length $n$,
$d=6$ and locality $r=3$. Then

$n\leq 4\lfloor\frac{q^{2}-3q+9}{6}\rfloor.$

###### Proof:

Let $B_{i},i=1,2,\cdots,\ell$ the set of lines in $PG(2,q)$ given by Theorem
2. Note that the 4 lines in the set $B_{i}$ produce 6 distinct intersection
points. Let $E_{i}$ be the set of these 6 points. By condition (ii) of Theorem
2, all these $6\ell$ intersection points are mutually distinct and each line
of $B_{i}$ doest not through any points in $E_{j}$ ($1\leq j\neq i\leq\ell$),
thus $6\ell+4(q+1-3)\leq q^{2}+q+1$, i.e.,
$\ell\leq\lfloor\frac{q^{2}-3q+9}{6}\rfloor.$ Hence

$n=4\ell\leq 4\lfloor\frac{q^{2}-3q+9}{6}\rfloor.$

∎

Furthermore, by using the techniques of incidence matrix and Johnson bound on
constant weight codes, we can deduce a tighter upper bound.

###### Theorem 4

Suppose $4\mid n$. Let $C$ be a $q$-ary Singleton-optimal LRC of length $n$,
minimum distance $d=6$ and locality $r=3$ with disjoint repair groups. Then

$n\leq 4\lfloor\frac{7q+3+\sqrt{24q^{3}+q^{2}-6q-63}}{24}\rfloor=O(q^{1.5}).$

###### Proof:

Let $B_{i},i=1,2,\cdots,\ell$ the set of lines in $PG(2,q)$ given by Theorem
2. Let $E_{i}$ be the set of 6 points produced by the 4 lines in $B_{i}$.
According to Theorem 2 (ii), $E_{i}\cap E_{j}=\emptyset$. Denote
$E=\bigcup_{i=1}^{\ell}E_{i}$.

We consider a $4\ell\times(q^{2}+q+1)$ binary matrix $A=(a_{ij})$ whose rows
are indexed by the $4\ell$ lines in $B_{1},B_{2},\ldots,B_{\ell}$, and columns
are indexed by the points of $PG(2,q)$. The $(i,j)$-th entry $a_{ij}=1$ if and
only if the “$i$-th line” through the “$j$-th point”. Note that each line in
$PG(2,q)$ has $q+1$ points (Lemma 2), thus each row of $A$ has weight $q+1$.

Let $G$ be the sub-matrix of $A$ consists of the $6\ell$ columns indexed by
$E$. According to Theorem 2, for each line $L_{i}$ of $B_{i}$, there are
exactly three points of $E_{i}$ lie on $L_{i}$ and no points of $E\setminus
E_{i}$ lie on $L_{i}$. So we can deduce that each row of $G$ has weight 3. Let
$M$ be the matrix obtained by deleting $G$ in $A$. Then $M$ is a
$4\ell\times(q^{2}+q+1-6\ell)$ binary matrix and each row of $M$ has weight
$q+1-3=q-2$. Let $D$ be the binary code of length $q^{2}+q+1-6\ell$ whose
codewords are the rows of $M$. Note that any two lines in $PG(2,q)$ meet at
exactly one point (Lemma 2). Thus any two distinct codewords of $D$ have
Hamming distance at least $2(q-2)-2=2q-6$. So $D$ is a binary
$(q^{2}+q+1-6\ell,M=4\ell,d=2q-6;w=q-2)$-constant weight code. By Johnson
bound (Lemma 5),

$4\ell((q-2)^{2}-(q^{2}+q+1-6\ell))\leq(q^{2}+q+1-6\ell)(q-3),$ $\Rightarrow
24\ell^{2}-(14q+6)\ell-(q^{2}+q+1)(q-3)\leq 0,$
$\Rightarrow\ell\leq\frac{7q+3+\sqrt{24(q^{2}+q+1)(q-3)+(7q+3)^{2}}}{24}=\frac{7q+3+\sqrt{24q^{3}+q^{2}-6q-63}}{24}.$

Thus

$n=4\ell\leq
4\lfloor\frac{7q+3+\sqrt{24q^{3}+q^{2}-6q-63}}{24}\rfloor=O(q^{1.5}).$

∎

###### Remark 2

From Table II, Theorem 4 improves the previous bounds on the code of length of
$(n,k,d=6;r=3)$ Singleton-optimal LRCs.

By the duality of the projective plane (see Theorem 1), we present the dual
version of Theorem 2 as follows.

######  Theorem 5 (Dual version of Theorem 2)

Suppose $4\mid n$. Then, there exists a $q$-ary Singleton-optimal LRC of
length $n$, minimum distance $d=6$ and locality $r=3$ with disjoint repair
groups if and only if there exist $\ell$ sets $S_{1},S_{2},\ldots,S_{\ell}$,
each of which consists of 4 points in $PG(2,q)$, such that for any $1\leq
i\neq j\leq\ell$,

(i)

$S_{i}\bigcap S_{j}=\emptyset$;

(ii)

there are no 3 points in $S_{i}\bigcup S_{j}$ lie on a common line.

If we write $S_{i}=\\{\bm{a}_{i,1},\bm{a}_{i,2},\bm{a}_{i,3},\bm{a}_{i,4}\\}$,
where each $\bm{a}_{i,t}\in\mathbb{F}^{3}_{q}$. Then we may restate Theorem 5
in the affine geometrical language as follows.

######  Theorem 6 (Affine version of Theorem 5)

Suppose $4\mid n$. Then, there exists a $q$-ary Singleton-optimal LRC of
length $n$, minimum distance $d=6$ and locality $r=3$ with disjoint repair
groups if and only if there exist $3\times n$ matrix
$G=(\bm{g}_{1},\bm{g}_{2},\cdots,\bm{g}_{n}),$ where
$\bm{g}_{i}\in\mathbb{F}^{3}_{q}$, such that the columns of $G$ can be divided
into $n/4$ groups $G_{1},G_{2},\cdots,G_{\frac{n}{4}}$ satisfying $|G_{i}|=4$
and any 3 columns from $G_{i}$ and $G_{j}$ are linearly independent.

Finally, we will use Theorem 6 to construct a family of $q$-ary Singleton-
optimal LRCs of $d=6,r=3$ and length $n=q+4$, for $q=2^{m}$.

Suppose
$\mathbb{F}^{*}_{q}=\\{\alpha_{1},\alpha_{2},\cdots,\alpha_{q-1}=1\\}$. Let

$G=\left(\begin{array}[]{ccccccccc}1&1&\cdots&1&1&0&0&1&0\\\
\alpha_{1}&\alpha_{2}&\cdots&\alpha_{q-1}&0&1&0&0&1\\\
\alpha^{2}_{1}&\alpha^{2}_{2}&\cdots&\alpha^{2}_{q-1}&0&0&1&1&1\end{array}\right).$

It is easy to see that any 3 columns of first $q+2$ columns of $G$ are
linearly independent.

For $\alpha\in\mathbb{F}^{*}_{q}$, denote
$\bm{v}(\alpha)=\left(\begin{array}[]{c}1\\\ \alpha\\\ \alpha^{2}\\\
\end{array}\right).$

The following two lemmas follows from direct calculations.

###### Lemma 6

Suppose $\alpha\neq\beta\in\mathbb{F}^{*}_{q}$ Then

(i)

$\bm{v}(\alpha),\bm{v}(\beta),\left(\begin{array}[]{c}1\\\ 0\\\ 0\\\
\end{array}\right)$

are linearly dependent if and only if $\alpha\beta=1$.

(ii)

$\bm{v}(\alpha),\bm{v}(\beta),\left(\begin{array}[]{c}0\\\ 1\\\ 1\\\
\end{array}\right)$

are linearly dependent if and only if $\alpha+\beta=1$.

(iii)

$\bm{v}(\alpha),\left(\begin{array}[]{c}1\\\ 0\\\ 1\\\
\end{array}\right),\left(\begin{array}[]{c}0\\\ 1\\\ 1\\\ \end{array}\right)$

are linearly dependent if and only if $\alpha$ is a cubic primitive root pf
unity.

(iv)

$\bm{v}(\alpha),\left(\begin{array}[]{c}1\\\ 0\\\ 1\\\
\end{array}\right),\left(\begin{array}[]{c}0\\\ 1\\\ 0\\\ \end{array}\right)$

are linearly dependent if and only if $\alpha=1$.

###### Lemma 7

Suppose $\alpha,\beta\neq 1\in\mathbb{F}^{*}_{q}$ are not a cubic primitive
root pf unity. Define

$A(\alpha)=\\{\alpha,1+\alpha,\frac{1}{1+\alpha},\frac{\alpha}{1+\alpha},\frac{1+\alpha}{\alpha},\frac{1}{\alpha}\\}.$

Then

(i)

$|A|=6$

(ii)

$A+1=\\{1+a:a\in A\\}=A$

(iii)

$\frac{1}{A}=\\{\frac{1}{a}:a\in A\\}=A$

(iv)

$A(\alpha)=A(\beta)$ if and only if $\alpha=\beta$, or $\alpha+\beta=1$, or
$\alpha\beta=1$.

Now we present our construction as follows.

###### Theorem 7

Suppose $q=2^{m},m\geq 3$ and $n=q+4$. Then there exists a $q$-ary Singleton-
optimal LRC of length $n=q+4$, minimum distance $d=6$ and locality $r=3$.

###### Proof:

Case 1: $m$ is odd. Then $\mathbb{F}^{*}_{q}$ does not contain cubic primitive
root pf unity. Choose $\xi\neq 1\in\mathbb{F}^{*}_{q}$. Let

$G_{1}=\left\\{\left(\begin{array}[]{c}1\\\ 0\\\ 0\\\
\end{array}\right),\left(\begin{array}[]{c}0\\\ 1\\\ 0\\\
\end{array}\right),\bm{v}(\xi),\bm{v}(\frac{\xi}{1+\xi})\right\\},$
$G_{2}=\left\\{\left(\begin{array}[]{c}0\\\ 0\\\ 1\\\
\end{array}\right),\left(\begin{array}[]{c}1\\\ 1\\\ 1\\\
\end{array}\right),\bm{v}(1+\xi),\bm{v}(\frac{1+\xi}{\xi})\right\\},$
$G_{3}=\left\\{\left(\begin{array}[]{c}1\\\ 0\\\ 1\\\
\end{array}\right),\left(\begin{array}[]{c}0\\\ 1\\\ 1\\\
\end{array}\right),\bm{v}(\frac{1}{1+\xi}),\bm{v}(\frac{1}{\xi})\right\\}.$

From Lemmas 6 and 7, we can verify that any 3 column vectors from two groups
of $G_{1},G_{2},G_{3}$ are linearly independent. For example, the three
vectors $\left(\begin{array}[]{c}1\\\ 0\\\ 0\\\
\end{array}\right),\left(\begin{array}[]{c}0\\\ 1\\\ 0\\\
\end{array}\right)\in G_{1},\bm{v}(1+\xi)\in G_{2}$ are linearly independent.
Note that

$\mathbb{F}^{*}_{q}\setminus(\\{1\\}\cup A(\xi))=\bigcup_{\alpha\neq
1,\xi}A(\alpha).$

Thus we can divided the remain $n-12$ column vectors
$\\{\bm{v}(\alpha)\\}_{\alpha\notin\\{1\\}\cup A(\xi)}$ into $\frac{n-12}{4}$
groups
$G_{i}=\\{\bm{v}(a_{i}),\bm{v}(b_{i}),\bm{v}(c_{i}),\bm{v}(d_{i})\\},i=3,4,\cdots,\frac{n}{4}$,
such that $A(a_{i}),A(b_{i}),A(c_{i}),A(d_{i})$ are mutually distinct. It is
obvious that any 3 column vectors from $G_{3},G_{4},\cdots,G_{\frac{n}{4}}$
are linearly independent. By Lemmas 6 and 7 again, we can verify that 3 column
vectors from one group of $G_{1},G_{2},G_{3}$ and one group of
$G_{3},G_{4},\cdots,G_{\frac{n}{4}}$ are linearly independent. Thus the
conclusion follows from Theorem 6.

Case 2: $m\geq 4$ is even. Let $\omega\in\mathbb{F}^{*}_{q}$ be a cubic
primitive root pf unity. Suppose
$\alpha,\beta\in\mathbb{F}^{*}_{q}\setminus\\{\omega\\}$ with $A(\alpha)\neq
A(\beta).$ Let

$G_{1}=\left\\{\left(\begin{array}[]{c}0\\\ 0\\\ 1\\\
\end{array}\right),\left(\begin{array}[]{c}1\\\ 1\\\ 1\\\
\end{array}\right),\bm{v}(\omega),\bm{v}(\alpha)\right\\},$
$G_{2}=\left\\{\left(\begin{array}[]{c}1\\\ 0\\\ 0\\\
\end{array}\right),\bm{v}(\omega^{2}),\bm{v}(1+\alpha),\bm{v}(\frac{1}{\alpha})\right\\},$

$G_{3}=\left\\{\left(\begin{array}[]{c}0\\\ 1\\\ 0\\\
\end{array}\right),\bm{v}(\frac{1}{1+\alpha}),\bm{v}(\beta),\bm{v}(\frac{\beta}{1+\beta})\right\\},$

$G_{4}=\left\\{\left(\begin{array}[]{c}1\\\ 0\\\ 1\\\
\end{array}\right),\bm{v}(\frac{\alpha}{1+\alpha}),\bm{v}(1+\beta),\bm{v}(\frac{1+\beta}{\beta})\right\\},$
$G_{5}=\left\\{\left(\begin{array}[]{c}0\\\ 1\\\ 1\\\
\end{array}\right),\bm{v}(\frac{1+\alpha}{\alpha}),\bm{v}(\frac{1}{1+\beta}),\bm{v}(\frac{1}{\beta})\right\\},$

From Lemmas 6 and 7, we can verify that any 3 columns from two groups of
$G_{1},G_{2},G_{3},G_{4},G_{5}$ are linearly independent. The rest of the
proof is similarly as the proof of the case of $m$ is odd, whcih we omit it
here.

The theorem is proved. ∎

###### Remark 3

To the best of our knowledge, Theorem 7 is the first construction of $q$-ary
Singleton-optimal LRCs of minimum distance $d=6$, locality $r=3$ and length
$n>q+1$.

##  IV Singleton-optimal LRCs with $d=7$ and $r=2$

In this section, we consider Singleton-optimal LRCs with minimum distance
$d=7$ and locality $r=2$. Throughout this section, we assume $3\mid
n,\ell=\frac{n}{3}$.

Suppose $C$ is an LRC of length $n$, dimension $k$, minimum distance $d=7$ and
locality $r=2$ with disjoint repair groups. From Sec. II.A, we assume that $C$
has a parity-check matrix $H$ as the following form:

$H=\left(\begin{array}[]{ccc|ccc|c|ccc}1&1&1&0&0&0&\ldots&0&0&0\\\
0&0&0&1&1&1&\ldots&0&0&0\\\
\vdots&\vdots&\vdots&\vdots&\vdots&\ddots&\vdots&\vdots&\vdots&\vdots\\\
0&0&0&0&0&0&\ldots&1&1&1\\\
\hline\cr\bm{0}&\bm{u}_{1}&\bm{v}_{1}&\bm{0}&\bm{u}_{2}&\bm{v}_{2}&\ldots&\bm{0}&\bm{u}_{\ell}&\bm{v}_{\ell}\\\
\end{array}\right),$ (5)

where $\bm{u}_{i},\bm{v}_{i}\in\mathbb{F}_{q}^{u},$ $i\in[\ell]$,
$u=n-k-\ell$.

We present the sufficient and necessary condition of the existence of $q$-ary
Singleton-optimal LRCs of length $n$, minimum distance $d=7$ and locality
$r=2$ with disjoint repair groups as follows.

###### Theorem 8

Suppose $3\mid n$. Then, there exists a $q$-ary Singleton-optimal LRC of
length $n$, minimum distance $d=7$ and locality $r=2$ with disjoint repair
groups if and only if there exist $\ell$ Lines $L_{1},L_{2},\ldots,L_{\ell}$
in $PG(3,q)$, such that

(i)

for any $1\leq i\neq j\leq\ell$, $L_{i}\bigcap L_{j}=\emptyset$;

(ii)

there exist three distinct points $P_{i,1},P_{i,2},P_{i,3}$ in $L_{i}$
($i=1,2,\cdots,\ell$) satisfying that $P_{s,\mu},P_{t,\nu},P_{m,\omega}$ do
not lie on a common line for any $1\leq s<t<m\leq\ell$ and
$\mu,\nu,\omega\in\\{1,2,3\\}$.

###### Proof:

Necessity: Suppose $C$ is a $q$-ary Singleton-optimal LRC with length $n$,
minimum distance $d=7$ and locality $r=2$. Let $H$ be a parity-check matrix of
$C$ given by Eq. (5). From Remark 1 and Eq. (3), we have $u=4$. Let

$L_{i}\triangleq\textnormal{Span}_{\mathbb{F}_{q}}\\{\bm{u}_{i},\bm{v}_{i}\\}\subseteq\mathbb{F}^{4}_{q}.$

Similar to Proposition 1, we can show that $\dim(L_{i})=2$. Thus we can regard
$L_{i}$ as a line in $PG(3,q).$ Suppose $\bm{x}\in L_{i}\bigcap L_{j}$, then
$\bm{x}=a_{i}\bm{u}_{i}+b_{i}\bm{v}_{i}=c_{j}\bm{u}_{j}+d_{j}\bm{v}_{j}$. If
we denote the columns of $H$ as
$\bm{h}_{1,0},\bm{h}_{1,1},\bm{h}_{1,2},\cdots,\bm{h}_{\ell,0},\bm{h}_{\ell,1},\bm{h}_{\ell,2},$
then
$(a_{i}+b_{i})\bm{h}_{i,0}-a_{i}\bm{h}_{i,1}-b_{i}\bm{h}_{i,2}=(c_{j}+d_{j})\bm{h}_{j,0}-c_{j}\bm{h}_{j,1}-d_{j}\bm{h}_{j,2}$.
Since $d\geq 7,$ we have $a_{i}=b_{i}=c_{j}=d_{j}=0$. Thus $L_{i}\bigcap
L_{j}=\emptyset$. Denote $P_{i,1},P_{i,2},P_{i,3}$ the points of $L_{i}$
represented by $\bm{u}_{i},\bm{v}_{i},\bm{u}_{i}-\bm{v}_{i}.$

We will prove that these points satisfy the condition (ii). By contradiction.
W.l.o.g., we suppose $P_{1,1}\in L_{1},P_{2,1}\in L_{2},P_{3,1}\in L_{3}$ lie
on a common line. Then there exist $a,b,c\in\mathbb{F}^{*}_{q}$, such that
$a\bm{u}_{1}+b\bm{u}_{2}+c\bm{u}_{3}=0$. Then
$a(\bm{h}_{1,1}-\bm{h}_{1,0})+b(\bm{h}_{2,1}-\bm{h}_{2,0})+c(\bm{h}_{2,1}-\bm{h}_{2,0})=0,$
which leads to $d\leq 6$. The necessity is proved. Sufficiency: Suppose there
exist $\ell$ lines $L_{1},L_{2},\ldots,L_{\ell}$ in $PG(3,q)$ satisfying the
conditions (i) and (ii). Assume that the three points
$P_{i,1},P_{i,2},P_{i,3}$ in $L_{i}$ corresponding to the nonzero vectors
$\bm{u}_{i},\bm{v}_{i},\bm{w}_{i}\in\mathbb{F}^{4}_{q}.$ Thus
$\bm{w}_{i}=a\bm{u}_{i}-b\bm{v}_{i}$, for some $a,b\in\mathbb{F}_{q}^{*}$. By
replacing $\bm{u}_{i}$ and $\bm{v}_{i}$ with $a\bm{u}_{i}$ and $b\bm{v}_{i}$,
respectively, we can assume that $\bm{w}_{i}=\bm{u}_{i}-\bm{v}_{i}$. Now we
let $C$ be the linear code with parity-check $H$ given as Eq. (5). Obviously,
$C$ is a $q$-ary LRC of length $n=3\ell$, locality $r=2$, dimension $k\leq
n-\ell-4=2\ell-4$. From Lemma 1 and Remark 1, we know that $d\leq
n-k+1-\lceil\frac{k}{r}\rceil\leq 7$. Thus we only need to prove that $d\geq
7$. By contradiction, suppose there are 6 columns of $H$ are linearly
dependent. We divide our discussions into 3 cases.

Case 1: These 6 columns from two repair groups. W.l.o.g., we suppose
$\bm{h}_{1,0},\bm{h}_{1,1},\bm{h}_{1,2},\bm{h}_{2,0},\bm{h}_{2,1},\bm{h}_{2,2}$
are linearly dependent. Then it can deduce that
$a\bm{u}_{1}+b\bm{v}_{1}+c\bm{u}_{2}+d\bm{v}_{2}=0$ for some
$a,b,c,d\in\mathbb{F}_{q}$. Note that $a\bm{u}_{1}+b\bm{v}_{1}\in L_{1}$ and
$c\bm{u}_{2}+d\bm{v}_{2}\in L_{2}$, which leads to $L_{i}\cap
L_{j}\neq\emptyset.$

Case 2: These 6 columns from three repair groups, and each group contains
exactly two of these columns. W.l.o.g., we suppose
$\bm{h}_{1,1},\bm{h}_{1,2},\bm{h}_{2,1},\bm{h}_{2,2},\bm{h}_{3,1},\bm{h}_{3,2}$
are linearly dependent. Then
$\bm{u}_{1}-\bm{v}_{1},\bm{u}_{2}-\bm{v}_{2},\bm{u}_{3}-\bm{v}_{3}$ are
linearly dependent, hence $P_{1,3},P_{2,3},P_{3,3}$ lie on a common line,
which contradicts with condition (ii).

Case 3: There is a repair group that contains exactly one of these 6 columns.
Then this column can not be a linear combination of other columns. Thus these
6 columns are linearly independent.

The sufficiency is proved and the theorem follows. ∎

From Theorem 8, we can derive a bound on the code length of $q$-ary
$(n,k,d=7;r=2)$ Singleton-optimal LRCs with disjoint repair groups.

###### Theorem 9

Suppose $3\mid n$. Let $C$ be a $q$-ary Singleton-optimal LRC of length $n$,
minimum distance $d=7$ and locality $r=2$ with disjoint repair groups. Then

$n\leq 3\lfloor\frac{q^{2}+q+3}{3}\rfloor.$

###### Proof:

Let $L_{1},L_{2},\ldots,L_{\ell}$ be $\ell$ lines in $PG(q,3)$ satisfying the
conditions (i) and (ii) in Theorem 8. Consider the $3(\ell-1)+1$ lines
$\overline{P_{1,1}P_{i,\mu}}$ ($i=2,3,\cdots,\ell,\mu=1,2,3)$ and $L_{1}$. By
conditions (i) and (ii) in Theorem 8, we know that these $3(\ell-1)+1$ lines
are mutually distinct. Note that the number of lines in $PG(3,q)$ through a
fixed point is $\frac{q^{3}-1}{q-1}=q^{2}+q+1$ (see Lemma 2). Thus

$3(\ell-1)+1\leq q^{2}+q+1,$

hence $\ell\leq\lfloor\frac{q^{2}+q+3}{3}\rfloor,$ and

$n=3\ell\leq 3\lfloor\frac{q^{2}+q+3}{3}\rfloor.$

∎

###### Remark 4

From Table II, Theorem 9 improves the previous bounds on the code length of
$q$-ary $(n,k,d=7;r=2)$ Singleton-optimal LRCs.

In the following, we use the spread of lines in $PG(3,q)$ to show the
existence of $q$-ary Singleton-optimal LRCs with length
$n=3\lceil\frac{7+\sqrt{72q^{2}+121}}{18}\rceil$, minimum distance $d=7$ and
locality $r=2$.

###### Theorem 10

For any $q\geq 3$, there exists a $q$-ary Singleton-optimal LRC with length
$n=3\lceil\frac{7+\sqrt{72q^{2}+121}}{18}\rceil$, minimum distance 7 and
locality 2.

###### Proof:

By Lemma 3, suppose $S$ is a spread of lines in $PG(3,q)$, that is
$S=\\{L_{1},L_{2},\cdots,L_{q^{2}+1}\\}$, where $L_{i}$ is a line of $PG(3,q)$
with $L_{i}\cap L_{j}=\emptyset,$ for any $1\leq i\neq j\leq q^{2}+1$. Suppose
$m$ is the maximal number of lines in $S$ satisfying the condition (ii) of
Theorem 8. Obviously, $m\geq 2$. W.l.o.g, we assume $L_{1},L_{2},\cdots,L_{m}$
satisfy the condition (ii) of Theorem 8. By condition (ii), we can show that
the lines $\overline{P_{i,\mu}P_{j,\nu}}$, $(1\leq i<j\leq
m,\mu,\nu\in\\{1,2,3\\})$ are mutually distinct, thus the number of these
lines is $3m(3m-3)/2=\frac{9m(m-1)}{2}$. Due to the maximality of $m$, for
each $\tau=m+1,\cdots,q^{2}+1$, the number of points on $L_{\tau}$ which also
lie on $\overline{P_{i,\mu}P_{j,\nu}}$ for some $1\leq i<j\leq m$ and
$\mu,\nu\in\\{1,2,3\\}$ is no less than $q-1$, i.e., for any $m+1\leq\tau\leq
q^{2}+1$

$|\\{\bigcup_{1\leq i<j\leq
m\textnormal{~{}and~{}}\mu,\nu\in\\{1,2,3\\}}(L_{\tau}\cap\overline{P_{i,\mu}P_{j,\nu}})\\}|\geq
q-1.$ (6)

Otherwise, there exist three points $P_{\tau,1},P_{\tau,2},P_{\tau,3}$ on
$L_{\tau}$ which do not lie on any lines $\overline{P_{i,\mu}P_{j,\nu}}$. Then
we obtain $m+1$ lines $L_{1},L_{2},\cdots,L_{m},L_{\tau}$ satisfy the
condition (ii) of Theorem 8.

On the other hand,
$P_{i,\mu},P_{j,\nu}\in\overline{P_{i,\mu}P_{j,\nu}}\cap\bigcup^{m}_{s=1}L_{s}$
($1\leq i<j\leq m$ and $\mu,\nu\in\\{1,2,3\\}$). Since $L_{s}\cap
L_{\tau}=\emptyset$ ($s=1,2,\cdots,m$ and $\tau=m+1,\cdots,q^{2}+1$), from Eq.
(6), we have

$(q+1-2)\frac{9m(m-1)}{2}\geq(q-1)(q^{2}+1-m),$

i.e., $9m^{2}-7m-2(q^{2}+1)\geq 0,$ which leads to
$m\geq\lceil\frac{7+\sqrt{72q^{2}+121}}{18}\rceil$. Thus there exist at least
$\lceil\frac{7+\sqrt{72q^{2}+121}}{18}\rceil$ lines satisfy the conditions (i)
and (ii) of Theorem 8. The theorem then follows.

∎

Finally, we give another construction of $q$-ary Singleton-optimal LRCs with
length $n=3\lceil\frac{7+\sqrt{8q^{2}-16q-7}}{6}\rceil$, minimum distance
$d=7$ and locality $r=2$ by the sunflowers in $PG(3,q)$.

###### Theorem 11

For any $q\geq 3$, there exists a $q$-ary Singleton-optimal LRC with length
$n=3\lceil\frac{7+\sqrt{8q^{2}-16q-7}}{6}\rceil$, minimum distance 7 and
locality 2.

###### Proof:

Fix a line $L$ of $PG(3,q)$ and suppose the points of $L$ are
$A_{1},A_{2},\cdots,A_{q+1}.$ Consider the sunflower $SF(1,2,3)$ in $PG(3,q)$
with center $L$. Each petal $\pi_{i}$ of $SF(1,2,3)$ is a plane through $L$.
Let $B_{i}(\neq A_{i})$ be any point in $\pi_{i}$, it is easy to show that
$\overline{A_{i}B_{i}}\cap\overline{A_{j}B_{j}}=\emptyset,$ for any $1\leq
i\neq j\leq q+1.$ Now, let $L_{1}$ and $L_{2}$ be two lines of
$\pi_{1},\pi_{2}$ which through $P_{1,1}=A_{1}$ and $P_{2,1}=A_{2}$,
respectively. Choose any points $P_{1,2}\neq P_{1,3}\in
L_{1}\setminus\\{P_{1,1}\\}$ and $P_{2,2}\neq P_{2,3}\in
L_{2}\setminus\\{P_{2,1}\\}$. Suppose $m$ is the maximal number such that we
can choose $m$ lines $L_{i}\subseteq\pi_{i}$ with $A_{i}\in L_{i}$
($i=1,2,\cdots,m$), and satisfying the condition (ii) of Theorem 8. We
consider the lines $\overline{P_{i,\mu}P_{j,\nu}}$, $(1\leq i<j\leq
m,\mu,\nu\in\\{1,2,3\\})$. Then except for the line
$\overline{P_{1,1}P_{2,1}}(=L$), the other lines do not lie on the plane
$\pi_{m+1}$, hence each of these lines meet $\pi_{m+1}$ at exactly one point.
Note that among these lines, there are $6(m-1)-1=6m-7$ lines through $P_{1,1}$
or $P_{2,1}$. Now we consider the $q+1$ lines $l_{1}=L,l_{2},\cdots,l_{q+1}$
in $\pi_{m+1}$ which through the common point $A_{m+1}$. If
$\frac{9m(m-1)}{2}-(6m-7)<q(q+1-3),$ then we can find three points $A,B,C$ in
$l_{j}\setminus\\{A_{m+1}\\}$ for some $2\leq j\leq q+1$ such that they do not
lie on any lines $\overline{P_{i,\mu}P_{j,\nu}}$, $(1\leq i<j\leq
m,\mu,\nu\in\\{1,2,3\\})$. Then the $m+1$ lines $L_{1},\cdots,L_{m},l_{j}$
satisfy the conditions of Theorem 8, which contradicts with the maximality of
$m$. Thus

$\frac{9m(m-1)}{2}-(6m-7)\geq q(q+1-3),$ $\Rightarrow
9m^{2}-21m-2(q^{2}-2q-7)\geq 0,$ $\Rightarrow
m\geq\lceil\frac{7+\sqrt{8q^{2}-16q-7}}{6}\rceil.$

Thus there exist at least $\lceil\frac{7+\sqrt{8q^{2}-16q-7}}{6}\rceil$ lines
satisfy the conditions (i) and (ii) of Theorem 8. The theorem then follows. ∎

###### Remark 5

Both of Theorems 10 and 11 show the existence of $q$-ary $(n,k,d=7;r=2$
Singleton-optimal LRCs with $n\approx\sqrt{2}q$.

##  V Conclusion

In this paper, we investigate $(n,k,d;r)$ Singleton-optimal LRCs with disjoint
repair groups for $d=6,r=3$ and $d=7,r=2$, respectively. We reduce the
existence of these optimal LRCs to the existence of some lines in the
projective space with certain properties. By some techniques of finite field
and finite geometry, some new constructions and bounds of Singleton-optimal
LRCs. To the best of our knowledge, our new LRCs have achieved longer code
length and our new bounds on the code length are tighter than previous known
results. It is interesting to give tighter upper bounds and some explicit
constructions with larger code length in the future work.

_Note added._ –Near the completion of the manuscript, we become aware of a
similar results of $(n,k,d=7;r=2)$ Singleton-optimal LRCs, obtained
independently in the recent paper, Ref. [13].

## References

  * [1] R. Casse, _Projective Geometry: An Introduction._ New York, Oxford University Press, 2006.
  * [2] C. J. Charles, and J. H. Dinitz, _Handbook of Combinatorial Designs._ Boca Raton, CRC press, 2006.
  * [3] B. Chen, W. Fang, S.-T. Xia, and F.-W. Fu, “Constructions of optimal $(r,\delta)$ locally repairable codes via constacyclic codes,” _IEEE Trans. Communications_ , vol. 67, no. 8, pp. 5253-5263, Aug. 2019.
  * [4] B. Chen, W. Fang, S.-T. Xia, J. Hao, and F.-W. Fu, “Improved bounds and Singleton-optimal constructions of locally repairable codes with minimum distance 5 and 6,” _IEEE Trans. Inf. Theory_ , vol.67, no. 1, pp. 217–231, Jan. 2021.
  * [5] H. Cai, Y. Miao, M. Schwartz, X. Tang, “On optimal locally repairable codes with super-linear length,” in _IEEE Trans. Inf. Theory_ , vol. 66, no. 8, pp. 4853-4868, Mar. 2020.
  * [6] B. Chen, S. T. Xia, and J. Hao, “Improved bounds and optimal constructions of locally repairable codes with distance 5 and 6,” in _Proc. Int. Symp. Inf. Theory (ISIT)_ , Paris, France, pp. 2823-2827, Jul. 2019.
  * [7] B. Chen, S.-T. Xia, J. Hao, and F.-W. Fu, “Constructions of optimal cyclic $(r,\delta)$ locally repairable codes,” _IEEE Trans. Inf. Theory_ , vol. 64, no. 4, pp. 2499-2511, Apr. 2018.
  * [8] T. Etzion and N. Raviv, “Equidistant codes in the Grassmannian.” _Discrete Applied Mathematics_ , vol. 186, pp. 87-97, 2015.
  * [9] T. Etzion and L. Storme, “Galois geometries and coding theory,” _Des. Codes Cryptogr._ , vol. 78, pp. 311-350, 2016.
  * [10] W. Fang, B. Chen, S.-T. Xia and F.-W. Fu, “Complete characterization of optimal LRCs with minimum distance 6 and locality 2: Improved bounds and constructions,” in _Proc. Int. Symp. Inf. Theory (ISIT)_ , Los Angeles, California, USA, pp. 595-599, Jun. 2020.
  * [11] P. Gopalan, C. Huang, H. Simitci, and S. Yekhanin, “On the locality of codeword symbols,” _IEEE Trans. Inf. Theory_ , vol. 58, no. 11, pp. 6925-6934, Nov. 2012.
  * [12] V. Guruswami, C. Xing, and C. Yuan, “How long can optimal locally repairable codes be ?” _IEEE Trans. Inf. Theory_ , vol. 65, no. 6, pp. 3662-3670, Jun. 2019.
  * [13] Y. Gao and S. Yang, “Some results on locally repairable codes with minimum distance 7 and locality 2,” [Online]. Available: https://arxiv.org/abs/2207.02994.
  * [14] J.W.P. Hirschfeld, _Projective Geometries over Finite Fields._ Oxford Mathematical Monographs, Oxford Science Publications, The Clarendon Press, Oxford University Press, New York, 1979.
  * [15] W. C. Huffman, V. Pless, _Fundamentals of Error-Correcting Codes._ Cambridge Univ. Press, UK, 2003\.
  * [16] J. Hao, S.-T. Xia, and B. Chen, “Some results on optimal locally repairable codes,” in _Proc. IEEE Int. Symp. Inf. Theory (ISIT)_ , Barcelona, Spain, pp. 440-444, Jul. 2016.
  * [17] J. Hao, S.-T. Xia, and B. Chen, “On optimal ternary locally repairable codes,” in _Proc. IEEE Int. Symp. Inf. Theory (ISIT)_ , Aachen, Germany, pp. 171-175, Jun. 2017.
  * [18] J. Hao, S.-T. Xia, and B. Chen, “On optimal ternary locally repairable codes,” _Proc. IEEE Int. Symp. Inf. Theory (ISIT)_ , Aachen, Germany, pp. 171-175, Jun. 2017.
  * [19] J. Hao, S.-T. Xia, K.W. Shum, B. Chen, F.-W. Fu, and Y. Yang, “Bounds and constructions of locally repairable codes: Parity-check matrix approach”, _IEEE Trans. Inf. Theory_ , vol. 66, no. 12, pp. 7465-7474, Dec. 2020.
  * [20] L. Jin, “Explicit construction of optimal locally recoverable codes of distance 5 and 6 via binary constant weight codes,” _IEEE Trans. Inf. Theory_ , vol. 65, no. 8, pp. 4658-4663, Aug. 2019.
  * [21] L. Jin, L. Ma, and C. Xing, “Construction of optimal locally repairable codes via automorphism groups of rational function fields,” _IEEE Trans. Inf. Theory_ , vol. 66, no. 1, pp. 210-221, Jan. 2020.
  * [22] X. Li, L. Ma, and C. Xing, “Optimal locally repairable codes via elliptic curves,” _IEEE Trans. Inf. Theory_ , vol. 65, no. 1, pp. 108-117, Jan. 2019.
  * [23] Y. Luo, C. Xing, and C. Yuan, “Optimal locally repairable codes of distance 3 and 4 via cyclic codes,” _IEEE Trans. Inf. Theory_ , vol. 65, no. 2, pp. 1048-1053, Feb. 2019.
  * [24] F. J. MacWilliams and N. J. A. Sloane, _The Theory of Error-Correcting Codes._ Amsterdam, The Netherlands: North-Holland, 1977.
  * [25] W. Song, S. Day, C. Yuen, and T. Li, “Optimal locally repairable linear codes,” _IEEE J. Selected Areas Comm._ vol. 32, pp. 6925-6934, 2014.
  * [26] I. Tamo and A. Barg, “A family of optimal locally recoverable codes,” _IEEE Trans. Inf. Theory_ , vol. 60, no. 8, pp. 4661-4676, Aug. 2014.
  * [27] N. Prakash, G. M. Kamath, V. Lalitha, and P. V. Kumar, “Optimal linear codes with a local-error-correction property,” in Proc. _Int. Symp. Inf. Theory (ISIT)_ , Cambridge, MA, U.S.A. pp. 2776-2780, 2012.
  * [28] C. Huang, H. Simitci, Y. Xu, A. Ogus, B. Calder, P. Gopalan, J. Li, and S. Yekhanin, “Erasure coding in windows azure storage,” in:_USENIX Annual Technical Conference (ATC)_ , pp. 15-26, 2012.
  * [29] C. Xing and C. Yuan, “Construction of $(r,\delta)$ locally recoverable codes and connection with graph theory,” _IEEE Trans. Inf. Theory_ , vol. 68, no. 7, pp. 4320 - 4328, Jul. 2022.


11institutetext: Dept. of Information & Communication Technology, Islamic
University, Bangladesh 11email<EMAIL_ADDRESS>, 11email:
<EMAIL_ADDRESS>22institutetext: IICT, Bangladesh University of
Engineering and Technology.
33institutetext: Department of CSE, Green University of Bangladesh. 33email:
<EMAIL_ADDRESS>
44institutetext: School of Electrical Engineering and Robotics,QUT,
Brisbane,Australia.
44email<EMAIL_ADDRESS>, 44email<EMAIL_ADDRESS>, 44email:
<EMAIL_ADDRESS>
# Enhancing Semantic Segmentation with Adaptive Focal Loss: A Novel Approach

Md Rakibul Islam 11 Riad Hassan 2233 Abdullah Nazib 44 Kien Nguyen 44 Clinton
Fookes 44 Md Zahidul Islam 11 0009-0007-0881-7014 0000-0002-8072-7896
0000-0003-1048-0346 0000-0003-1048-0346 0000-0002-8515-6324
0000-0001-8994-5585

###### Abstract

Deep learning has achieved outstanding accuracy in medical image segmentation,
particularly for objects like organs or tumors with smooth boundaries or large
sizes. Whereas, it encounters significant difficulties with objects that have
zigzag boundaries or are small in size, leading to a notable decrease in
segmentation effectiveness. In this context, using a loss function that
incorporates smoothness and volume information into a model’s predictions
offers a promising solution to these shortcomings. In this work, we introduce
an Adaptive Focal Loss (A-FL) function designed to mitigate class imbalance by
down-weighting the loss for easy examples that results in up-weighting the
loss for hard examples and giving greater emphasis to challenging examples,
such as small and irregularly shaped objects. The proposed A-FL involves
dynamically adjusting a focusing parameter based on an object’s surface
smoothness, size information, and adjusting the class balancing parameter
based on the ratio of targeted area to total area in an image. We evaluated
the performance of the A-FL using ResNet50-encoded U-Net architecture on the
Picai 2022 and BraTS 2018 datasets. On the Picai 2022 dataset, the A-FL
achieved an Intersection over Union (IoU) of 0.696 and a Dice Similarity
Coefficient (DSC) of 0.769, outperforming the regular Focal Loss (FL) by 5.5%
and 5.4% respectively. It also surpassed the best baseline Dice-Focal by 2.0%
and 1.2%. On the BraTS 2018 dataset, A-FL achieved an IoU of 0.883 and a DSC
of 0.931. The comparative studies show that the proposed A-FL function
surpasses conventional methods, including Dice Loss, Focal Loss, and their
hybrid variants, in IoU, DSC, Sensitivity, and Specificity metrics. This work
highlights A-FL’s potential to improve deep learning models for segmenting
clinically significant regions in medical images, leading to more precise and
reliable diagnostic tools.

###### Keywords:

Adaptive Focal Loss Semantic Segmentation Deep Learning ResNet50-encoded U-Net
Class Imbalance Tumor Segmentation.

##  1 Introduction

Precise segmentation of affected regions is essential for optimal outcomes in
robotic surgery, computer-aided diagnostics, and targeted radiation therapy
[24]. The targeted region declination is tedious and time consuming. Recent
advancement in deep neural network increases the performance of segmentation
and it is relatively high when the shape of the targeted segmentation region
is large and comparatively smooth. But the segmentation is challenging when
the objects are with small size or zigzag boundary. In recent time, many
segmentation networks have been proposed to segment the challenging objects
more accurately [26, 17, 18, 13, 12, 1]. Although the features are extracted
with the segmentation networks from different view, the performance
enhancement is minimal.

Such challenging objects are common for segmentation in medical imaging.
Organs, tumors’ shapes are not only uneven but also poses variability person
to person. Segmentation networks commonly rely on loss functions such as Dice
[23], Cross-Entropy [19], and Focal [7], which focus mainly on object overlap
and the entropy between predicted and ground truth masks. However, these loss
functions often fail to consider critical factors like surface boundary
characteristics and object volume, which are crucial for accurate segmentation
of small or irregularly shaped objects.

To solve these issues, we introduce a novel Adaptive Focal Loss (A-FL) that
considers tumor volume information, surface smoothness information, and
dynamically adjusts class balancing parameter. When the objects are ordinary
with large size and smooth surface, the A-FL posses lower loss. In contrast,
during the challenging object segmentation, the A-FL offer higher loss and
force the network to optimize the loss properly. This dynamic adaptive nature
of A-FL successfully feedback the loss appropriately to the network which
leads the higher segmentation accuracy.

##  2 Related Work

Binary Cross Entropy (BCE) loss [19] and its variations [25, 19, 5], are
frequently utilized for model training within the domain of semantic
segmentation [8, 6]. The model’s performance may be hampered by the simple
pixels’ gradients being overwhelmed by the hard pixels’ due to BCE’s equal
treatment of all pixels. By correcting the imbalance between positive and
negative samples [15, 10], or the disparity between easy and hard samples [7,
5], previous initiatives [14] have attempted to remedy this.

Weighted Binary Cross Entropy (WBCE) [3] introduces a weighting factor for
positive samples in order to rectify the imbalance between positive and
negative data. In a similar manner, positive and negative samples are given
weights via Balanced Cross Entropy (BCE) [25]. These techniques are beneficial
when applied to skewed data distributions [4], but their impact on model
performance when applied to balanced datasets may be less pronounced. An
unique solution to this problem was offered by Leng et al. [5], who proposed
Poly Loss (PL), a linear mix of polynomial functions.

Focal Loss (FL) [7] provides a difficulty modifier to address the discrepancy
between hard/easy samples. This helps the model concentrate more on hard cases
by lessening the influence of easy examples. The Normalized Focal Loss (NFL),
which incorporates an extra correction factor inversely related to the
modulating component in FL, was proposed by Sofiiuk et al. [22]. Other
research [10], [15] have also attempted to address this issue; nevertheless,
difficulties such as gradient swamping impede the proper classification of
equivocal pixels.

In this research by utilizing A-FL in where we introduce a focusing parameter
$\gamma_{adaptive}$ that is dynamically adjusted according to the volume and
smoothness information of the segmented objects. This approach aims to
overcome the restrictions of static parameter choices encountered in
conventional focal loss functions so as to improve the segmentation of
irregularly shaped and small sized tumors.

##  3 Methodology

The overall working pipeline of this research implementation is illustrated in
Fig.1. It consists of three main components: (a) dataset pre-processing, (b)
ResNet50-encoded U-Net architecture, and (c) proposed A-FL function. Details
on data pre-processing are provided in Section 4. In this section, we provide
a summary of A-FL, detail the implementation of our innovative adaptive focal
loss that dynamically integrates tumor volume and surface smoothness
information, and describe the segmentation network architecture.

Figure 1: Overall working pipeline comprises of three main parts: a. Data pre-
processing; b. Segmentation Network; c. proposed Adaptive Loss Function (A
schematic overview of the training process with our Adaptive Loss function
(A-FL).

###  3.1 Overview

The core concept of Adaptive Focal Loss (A-FL) is to dynamically calculate and
then incorporate the tumor volume and surface smoothness information into
regular Focal loss function through a focusing parameter for each patient
during the training process. A-FL uses dynamically calculated non-cancerous
pixel to total pixels ratio as class balancing parameter, which helps to
address the class imbalance between the numerous non-cancerous pixels and the
comparatively few cancerous pixels. As shown in Fig.1 step c, we introduce two
straightforward but highly effective modifications to the regular focal loss
function during the training process:

  1. 1.

During training, we assess tumor surface smoothness by computing the gradient
along the x, y, and z axes, and we also evaluate tumor volume by calculating
the ratio of cancerous pixels to the total pixels in the corresponding label
mask. We use this smoothness and volume information as focusing parameter.

  2. 2.

We calculate the ratio of non-cancerous pixels to the total pixel count and
utilize this ratio as a class balancing parameter.

To compute both focusing parameter and class balancing parameter during the
training process we have introduced a novel specifically designed mathematical
model. This approach is optimized for computational efficiency and integrates
seamlessly into the training pipeline. By calculating these parameters
dynamically during training, the proposed loss function ensures that the
segmentation model can better adapt to variations in tumor sizes and surface
characteristics that results in greater accuracy and robustness of the
segmentation outcomes.

###  3.2 Tumor volume & surface smoothness aware Adaptive Focal Loss (A-FL)

We used the regular focal loss function [7] as our baseline to focus on
easy/hard examples by reshaping the Balanced Cross Entropy loss with a
modulating factor that is based on manually tune-able focusing parameter.
Their research showed that a fixed focusing parameter of 2 and class balancing
parameter of 0.25 yielded the best results. This approach fails to address the
varying difficulty levels within the dataset, particularly struggling with
small and irregularly shaped tumors. As a result, the model often fails to
achieve optimal segmentation accuracy for these challenging examples.

We address these limitations by dynamically adjusting a focusing parameter
based on tumor volume and surface smoothness information, and a class
balancing parameter based on the non-cancerous to total pixel ratio. This
adaptive focal loss effectively handles class imbalance, able to give more
focus on hard examples like small or irregularly shaped tumors. By ensuring
higher training loss for challenging examples and lower for easy ones, our
approach allows the model to update its weights more effectively, improving
dice accuracy for small and more zigzag shaped tumors.

In this work, we propose a novel enhancement to the standard Focal loss by
dynamically adjusting the focusing parameter during training for semantic
segmentation. We term this parameter as Adaptive Focusing Parameter because it
is adjusted based on the volume and surface smoothness information of the
tumor. The following steps outline the detailed implementation of proposed
adaptive focal loss (A-FL):

  1. 1.

Calculating Tumor Volume Based Adaptive Parameters: To address class imbalance
and give more focus to small tumor cases, we dynamically calculate the class
balancing adaptive parameter and tumor volume information adaptive parameters
using the cancerous and non-cancerous pixels ratios to the total pixels for
each patient’s tumor during training. The equation in 1 and 2 are the
mathematical formula of Class Balancing Adaptive Parameter ($\alpha_{va}$) and
volume information adaptive parameter.

$\alpha_{va}=\frac{P_{bg}}{P_{fg}+P_{bg}}$ (1)

$\gamma_{va}=\frac{P_{fg}}{P_{fg}+P_{bg}}$ (2)

where $P_{fg}$ represents the count of foreground pixels (non-zero elements)
and $P_{bg}$ represents the count of background pixels (zero elements).

  2. 2.

Calculating Mean Surface Smoothness Adaptive Parameter: To compute the mean
smoothness of a patient’s mask, we perform the following steps.

    1. I.

Gradients along the x, y, and z Axes: Let $I$ be the image tensor. The
gradients along the x, y, and z axes are denoted as $\nabla_{x}I$,
$\nabla_{y}I$, and $\nabla_{z}I$ respectively, and the formula can be
expressed as in Equation 3.

$\nabla_{x}I=\frac{\partial I}{\partial x},\quad\nabla_{y}I=\frac{\partial
I}{\partial y},\quad\nabla_{z}I=\frac{\partial I}{\partial z}$ (3)

    2. II.

Gradient Magnitude: Using the Euclidean norm of the gradients [21] presented
in Equation 4, we calculate the magnitude of the gradient at each point along
tumor boundary.

$\|\nabla I\|=\sqrt{(\nabla_{x}I)^{2}+(\nabla_{y}I)^{2}+(\nabla_{z}I)^{2}}$
(4)

    3. III.

Mean Smoothness: The mean surface smoothness adaptive parameter
($\gamma_{mSa}$) is calculated as the average of the gradient magnitudes over
the entire image tensor. Let $N$ be the total number of elements in the image
tensor and the formula is as follows:

$\gamma_{mSa}=\frac{1}{N}\sum_{i=1}^{N}\|\nabla I_{i}\|$ (5)

  3. 3.

Calculating the Adaptive Focusing Parameter: The adaptive parameter
$\gamma_{adaptive}$ is then calculated as the sum of the volume adaptive
parameter ($\gamma_{va}$) and the mean smoothness adaptive parameter
($\gamma_{mSa}$) as follows:

$\gamma_{adaptive}=\gamma_{va}+\gamma_{mSa}$ (6)

  4. 4.

Defining the Adaptive Focal Loss (A-FL): Our proposed A-FL denoted as
${A-FL}(P_{t})$ expands on conventional Focal loss by utilizing dynamically
adaptive parameter $\gamma_{adaptive}$. The Equation 7 shows the mathematical
formula of A-FL.

$\text{A-FL}(P_{t})=(1-P_{t})^{\gamma_{adaptive}}\cdot\log(P_{t})$ (7)

We note two key properties of our adaptive focal loss (A-FL):

  1. 1.

When an example is misclassified and $p_{t}$ is low, the modulating factor
stays near 1, keeping the loss unchanged. On the other hand, as $p_{t}$ nears
1, the factor reduces to 0, thus down-weighting the loss for accurately
classified examples.

  2. 2.

The value of the modulating parameter $(1-P_{t})^{\gamma_{\text{adaptive}}}$
changes in response to variations in $p_{t}$ for all patients. We have
investigated whether the value of $p_{t}$ varies based on tumor volume and
tumor surface smoothness in each patient. Thus, we incorporate these two
factors (volume and smoothness) into our adaptive focusing parameter
$\gamma_{\text{adaptive}}$ .

In practice, we have incorporated the class balancing adaptive parameter
$\alpha_{\text{va}}$ as defined in Equation 1, into our proposed loss
function. This inclusion results in slightly better accuracy compared to the
compared to the non-$\alpha_{\text{va}}$-included form. The final A-FL formula
is presented in Equation 8.

$\textbf{A-FL}(P_{t})=\alpha_{\text{va}}\cdot(1-P_{t})^{\gamma_{\text{adaptive}}}\cdot\log(P_{t})\quad$
(8)

###  3.3 Our ResNet50 Encoded U-Net Architecture

For all our experiments, we utilize ResNet50 [2] as the encoder in the U-Net
architecture. This backbone is extensively employed in semantic segmentation
[11], making it an ideal baseline for comparison and future studies.
Integrating ResNet50 into U-Net encoder (displayed in Fig. 2) significantly
boosts the network’s feature extraction capabilities. The residual blocks in
ResNet50 effectively mitigate the vanishing gradient issue, enabling the
network to learn more robust and abstract features.

Figure 2: The U-Net network architecture uses pre-trained Resnet50 [2] as
backbone. The residual blocks in ResNet50 enable the network to learn more
complex features and deeper representations, which are crucial for accurate
segmentation.

##  4 Experiment Setup

###  4.1 Dataset

All our experiments use two publicly available MRI datasets: 1) the Picai 2022
dataset [20] and 2) the BraTS 2018 dataset [9]. Both datasets are designed to
improve cancer diagnosis using deep learning (DL) tools.
Picai 2022 dataset: This dataset includes 1,500 Bi-parametric MRI (bpMRI)
cases with three modalities: Apparent Diffusion Coefficient (ADC), High
b-value (HBV), and T2-weighted (T2w). It comprises 1,075 benign or indolent
prostate cancer (PCa) cases, 205 unlabeled malignant cases, and 220 manually
labeled malignant cases. For segmentation model training, 220 patients are
utilized, divided into a training set of 180 patients (80%) and a validation
set of 40 patients (20%).
BraTS 2018 dataset: This dataset includes multi-modal MRI scans from 650
patients, with sequences as Fluid-Attenuated Inversion Recovery (FLAIR),
T1-weighted, T1-weighted with contrast enhancement (T1ce), and T2-weighted. Of
these, 484 cases are manually labeled. For model training and validation, 384
cases (80%) are allocated for training, and 100 cases (20%) for validation.

###  4.2 Data Preparation

As mentioned earlier, the Picai-2022 dataset includes three modalities: T2w
images, ADC, and HBV maps for each patient. To ensure uniformity, ADC and HBV
maps are resampled using the maximum voxel spacing (43%) observed from axial
T2W images, resulting in a voxel size of 3.0×0.5×0.5 mm. A two-step
normalization procedure is applied, consisting of min-max normalization
followed by z-score normalization. After normalization, all images, labels,
and prostate whole gland masks are resized to 30 x 256 x 256. A bounding box
is computed around the prostate whole gland mask and extended by 30 pixels in
each direction. The prostate region is then extracted from the T2W, ADC, and
HBV maps corresponding to the same slice, reducing image and mask size for
quicker experimentation. These extracted regions are resized to 24 x 160 x 128
for segmentation model training. Finally, the N4 bias field correction filter
is applied to the dataset to reduce bias corruption.

The BraTS 2018 dataset consists of 4 modalities (T1-weighted, T1ce,
T2-weighted, and FLAIR ) for each patient. To ensure pixel dimension
uniformity between these modalities, the 4 modalities are resampled to
1.0×1.0×1.0 mm/voxel. A two-step normalizing procedure is also implemented
here, as Picai dataset. After intensity normalization, all image modalities
and labels are resized to 155 x 224 x 224 along z, x and y directions.

###  4.3 Experiment Design & Implementation

We use the Stochastic Gradient Descent (SGD) optimizer [16] for all training
methods. The optimizer has a base learning rate of 0.01, a momentum of 0.9, a
weight decay of 0.0001, and we train for 300 epochs. The training is conducted
with a batch size of 1. In order to address the problem of over-fitting, we
employ data augmentation methods such as random affine transformations,
flipping, Gaussian noise, and intensity scaling. The experiments are carried
out utilizing PyTorch 2.3.1 on a high-performance computer configuration,
comprising an Intel Xeon 2.40 GHz processor, an NVIDIA RTX 3060 GPU, and 32 GB
of RAM.

###  4.4 Evaluation Metrics:

Evaluation metrics are crucial for assessing the performance of segmentation
models. In this study, we utilized four primary metrics: mean IoU, DSC,
Sensitivity, and Specificity which are described in [4]. IoU and Dice
Coefficient quantify the overlap between the ground truth and predicted
output. Sensitivity measures the proportion of True Positives, while
Specificity measures the proportion of True Negatives. Together, these metrics
provide a comprehensive evaluation of the model’s effectiveness.

##  5 Result and Discussion

In this section, we present experiments demonstrating the benefits of
integrating a dynamic focusing parameter and adaptive imbalance weighting into
the regular Focal Loss (FL) function. We provide quantitative comparisons
between conventional FL and A-FL across various datasets. Additionally, we
conduct comparative analyses of A-FL against FL using different baseline
models and other loss functions. We also evaluate qualitative examples and
perform ablation studies to assess the impact of our A-FL function.

###  5.1 Quantitative Results Evaluation

Tables 1 and 2 present a quantitative comparison between the regular FL and
our proposed A-FL on the Picai 2022 [20] and BraTS 2018 [9] datasets.

Table 1: The proposed A-FL’s performance was evaluated against the regular FL function using a ResNet50-encoded U-Net model on the Picai 2022 Dataset [20]. Loss Function | Evaluation Metrics
---|---
IoU $\uparrow$ | DSC $\uparrow$ | Sensitivity $\uparrow$ | Specificity $\uparrow$
Focal Loss | 0.641 | 0.715 | 0.924 | 0.9484
Our A-FL | 0.696 | 0.769 | 0.941 | 0.9489

On the Picai 2020 dataset, A-FL achieves a 5.5% increase in IoU, a 5.4% rise
in DSC, and a 1.7% boost in Sensitivity, demonstrating improved handling of
small and irregular tumors. Additionally, a slight increase in Specificity
(0.05%) indicates balanced performance.

On the BraTS 2018 dataset, A-FL shows a 5.2% improvement in IoU and a 3.8%
increase in DSC, reflecting better segmentation accuracy. Despite a minor
decrease in Sensitivity (1.2%), the gain in Specificity (1.1%) suggests fewer
false positives and a more robust architecture.

Table 2: The proposed A-FL function’s performance was evaluated against the regular FL function using a ResNet50-encoded UNet model on the BraTS 2018 Dataset [9]. Loss Function | Evaluation Metrics
---|---
IoU $\uparrow$ | Dice $\uparrow$ | Sensitivity $\uparrow$ | Specificity $\uparrow$
FL | 0.831 | 0.893 | 0.949 | 0.946
A-FL | 0.883 | 0.931 | 0.937 | 0.957

Table 3 presents a comparison of the performance of the proposed Adaptive
Focal Loss (A-FL) against several baseline loss functions, using a
ResNet50-encoded U-Net model on the Picai 2022 dataset. The results show
A-FL’s superiority in key metrics: IoU, Dice coefficient, and Sensitivity.
Specifically, A-FL achieves an IoU of 0.696 and a Dice coefficient of 0.769,
outperforming other loss functions such as Traversky Loss (IoU: 0.654, Dice:
0.726), Cross Entropy Loss (IoU: 0.630, Dice: 0.705), IoU Loss (IoU: 0.654,
Dice: 0.727), Dice Loss (IoU: 0.665, Dice: 0.739), Dice Cross Entropy Loss
(IoU: 0.670, Dice: 0.742), and Dice Focal Loss (IoU: 0.685, Dice: 0.757).

A-FL also achieves the highest Sensitivity at 0.951, indicating its accuracy
in identifying true positives. Compared to the best-performing baseline, Dice
Focal Loss, A-FL improves IoU by 1.61%, Dice coefficient by 1.58%, and
Sensitivity by 6.14%. Although A-FL’s Specificity (0.948) is slightly lower
than Dice Loss (0.952), it maintains high performance overall.

In Table 4, we compare A-FL with traditional Focal Loss (FL) using various
baseline models on the Picai 2022 dataset. The data highlights significant
improvements in IoU, Dice coefficient, Sensitivity, and Specificity achieved
by A-FL.

Table 3: Comparison studies evaluate the performance of the proposed A-FL against other baseline loss functions using a ResNet50-encoded U-Net model. Loss Function | Evaluation Metrics
---|---
IoU $\uparrow$ | Dice $\uparrow$ | Sensitivity $\uparrow$ | Specificity $\uparrow$
Traversky Loss | 0.654 | 0.726 | 0.917 | 0.948
Cross Entropy Loss | 0.630 | 0.705 | 0.870 | 0.876
IoU Loss | 0.654 | 0.727 | 0.917 | 0.947
Dice Loss | 0.665 | 0.739 | 0.904 | 0.952
Dice Cross Entropy Loss | 0.670 | 0.742 | 0.938 | 0.927
Dice Focal Loss | 0.685 | 0.757 | 0.896 | 0.949
A-FL | 0.696 | 0.769 | 0.951 | 0.948
Table 4: Comparison studies for the performance of our proposed Loss function with the Focal Loss function using various baseline models. Model | Loss Function | Evaluation Metrics
---|---|---
IoU $\uparrow$ | Dice $\uparrow$ | Sensitivity $\uparrow$ | Specificity $\uparrow$
UNet | FL | 0.640 | 0.710 | 0.721 | 0.749
A-FL | 0.669 | 0.740 | 0.792 | 0.825
AttUNet | FL | 0.647 | 0.721 | 0.997 | 0.940
A-FL | 0.679 | 0.750 | 0.992 | 0.948
RegUNet | FL | 0.562 | 0.622 | 0.600 | 0.950
A-FL | 0.573 | 0.635 | 0.691 | 0.944
RRUNet | FL | 0.634 | 0.709 | 0.967 | 0.946
A-FL | 0.672 | 0.740 | 0.989 | 0.949
ResNet50 encoded UNet | FL | 0.641 | 0.715 | 0.924 | 0.9484
A-FL | 0.696 | 0.769 | 0.941 | 0.9489

For the UNet model, A-FL improves IoU by 2.9% (from 0.640 to 0.669) and Dice
coefficient by 3.0% (from 0.710 to 0.740). Sensitivity increases by 7.1% (from
0.721 to 0.792), and Specificity by 7.6% (from 0.749 to 0.825). For the
AttUNet model, A-FL increases IoU by 3.2% (from 0.647 to 0.679) and Dice
coefficient by 2.9% (from 0.721 to 0.750). Sensitivity slightly decreases by
0.5% (from 0.997 to 0.992), but Specificity improves by 0.85% (from 0.940 to
0.948). For the RegUNet model, A-FL improves IoU by 1.96% (from 0.562 to
0.573) and Dice coefficient by 1.3% (from 0.622 to 0.635). Sensitivity
increases by 9.1% (from 0.600 to 0.691), while Specificity decreases by 0.63%
(from 0.950 to 0.944). For the RRUNet model, A-FL enhances IoU by 3.8% (from
0.634 to 0.672) and Dice coefficient by 3.1% (from 0.709 to 0.740).
Sensitivity increases by 2.28% (from 0.967 to 0.989), and Specificity by 0.32%
(from 0.946 to 0.949).

For the ResNet50 encoded UNet model, A-FL improves IoU by 5.51% (from 0.641 to
0.696) and Dice coefficient by 4.8% (from 0.715 to 0.769). Sensitivity
increases by 1.84% (from 0.924 to 0.941), and Specificity slightly by 0.05%
(from 0.9484 to 0.9489).

Tables 1, 2, 3, and 4 provide evidence for the superiority of A-FL in
segmentation tasks, showing significant improvements in IoU, Dice coefficient,
and Sensitivity across datasets, loss functions, and models. These results
highlight A-FL’s effectiveness in handling class imbalance and enhancing
performance in small volume and irregular tumor segmentation.

Figure 3: Performance Comparison of Regular Focal Loss vs. Adaptive Focal Loss
(A-FL). The left chart shows average Dice Similarity Coefficient (DSC) for
good, medium, and poor smoothness cases. The right chart shows average DSC for
large, medium, and small volume cases. Results highlight A-FL’s effectiveness
in improving segmentation accuracy, especially for small volume and
irregularly shaped tumors.

The bar charts in Fig. 3 compare traditional Focal Loss (FL) and our Adaptive
Focal Loss (A-FL) using the Dice Similarity Coefficient (DSC) across different
tumor smoothness and volume levels. For smoothness, A-FL demonstrates clear
superiority, with a 5.22% improvement in DSC for tumors with good smoothness,
a 7.69% improvement for medium smoothness tumors, and a notable 13.69%
increase for tumors with poor smoothness. This highlights A-FL’s exceptional
ability to manage tumors with varying surface complexities, particularly those
with poor smoothness. In terms of volume, A-FL shows robust performance,
providing a 4.41% improvement in DSC for large volume tumors, a 6.23% increase
for medium volume tumors, and an impressive 7.77% boost for small volume
tumors. These findings underscore A-FL’s effectiveness in accurately
segmenting tumors of different sizes, excelling especially with smaller, more
challenging tumors.

###  5.2 Qualitative Results Evaluation

The qualitative results for the Picai dataset, shown in Fig. 4, illustrate
that A-FL outperforms baseline FL in prostate cancer (PCa) segmentation. While
large volume and smooth surface cases (i) and (iii) show similar performance
for both methods, A-FL excels in segmenting uneven or small volume tumors
(cases (ii) and (iv)). This is evident in the 2D slice-by-slice
visualizations, where A-FL demonstrates higher accuracy due to the dynamically
adjusted focusing parameter.

In summary, the visual results in Fig. 4 support our quantitative findings,
highlighting A-FL’s superior performance in managing various tumor volumes and
surface complexities.

Figure 4:  (a) Qualitative results are visualized in 3D voxel and 2D slice
manners for examples from the Picai validation set. In the 3D voxel
visualization (a), the Label row shows ground truth masks, the A-FL row shows
predictions using our proposed A-FL method, and the FL row shows predictions
using the existing baseline FL. Columns represent large volume (i), small
volume (ii), good surface smoothness (iii), and poor surface smoothness (iv)
cases. In the 2D slice visualization (b), each bounded box-column follows the
same order: baseline FL prediction, A-FL prediction, and ground truth mask.

###  5.3 The Ablation Studies

To assess the effectiveness of proposed dynamically tumor volume and
smoothness adaptive focal loss (A-FL), twelve different experiments are
conducted and presented on Table-5. Each variable and combination of variables
is tested with ResNet50 encoded U-Net architecture. The accuracy is measured
by mean IoU and mean Dice from the respective dataset.

In Table 5, the first row is the baseline results using the original Focal
Loss (FL) in where $\alpha$ and $\gamma$ is manually set to 0.25 and 2
respectively [7]. while the 2nd row shows the results after introducing
$\alpha_{\text{va}}$ alone which leads to a slight improvements due to
assigning higher weights to minority foreground class. On the Picai dataset,
IoU increased by 1.3% and Dice by 1.8%, while on the BraTS dataset, IoU
increased by 0.7% and Dice by 1.3%.

Combining the background volume adapting weight $\alpha_{\text{va}}$ with the
foreground volume adapting weight $\gamma_{\text{va}}$ improves results by
balancing both background and foreground adjustments, leading to more precise
segmentation. This increased IoU by 3.6% and Dice by 3.3% on the Picai
dataset, and IoU by 1.5% and Dice by 1.9% on the BraTS dataset. Similarly,
combining $\alpha_{\text{va}}$ with the most influential parameter of our
A-FL, tumor surface mean smoothness adapting weight $\gamma_{\text{mSa}}$
enhances performance by ensuring more focus regarding more zigzag shaped
tumor, increasing IoU by 4.6% and Dice by 4.1% on the Picai dataset, and IoU
by 2.6% and Dice by 3.6% on the BraTS dataset.

The optimal configuration is achieved when all three parameters are enabled
(shows in row 4), resulting in the highest metrics. Compared to the baseline,
IoU on the Picai dataset increased by 5.5% and Dice by 5.4%, while on the
BraTS dataset, IoU increased by 5.2% and Dice by 4.8%. Conversely, disabling
$\alpha_{\text{va}}$ while enabling both $\gamma_{\text{va}}$ and
$\gamma_{\text{mSa}}$ results in lower performance compared to the optimal
configuration. This demonstrates the effectiveness of dynamic parameter
adjustments in addressing class imbalance and complex tumor structures.

Table 5: Ablation studies on Picai and BraTS dataset. Here, the values of $\alpha_{\text{va}}$, $\gamma_{\text{va}}$ and $\gamma_{\text{mSa}}$ are continuously changed for every patient in the training session. Parameters | Picai Dataset | BraTS Dataset
---|---|---
$\alpha_{\text{va}}$ | $\gamma_{\text{va}}$ | $\gamma_{\text{mSa}}$ | IoU $\uparrow$ | Dice $\uparrow$ | IoU $\uparrow$ | Dice $\uparrow$
✗ | ✗ | ✗ | 0.641 | 0.715 | 0.831 | 0.883
✓ | ✗ | ✗ | 0.656 | 0.733 | 0.838 | 0.906
✓ | ✓ | ✗ | 0.677 | 0.748 | 0.846 | 0.912
✓ | ✗ | ✓ | 0.687 | 0.756 | 0.857 | 0.929
✓ | ✓ | ✓ | 0.696 | 0.769 | 0.883 | 0.931
✗ | ✓ | ✓ | 0.677 | 0.746 | 0.882 | 0.924

##  6 Conclusion

This paper introduces A-FL, a novel Adaptive Focal Loss (A-FL) function
tailored for semantic segmentation, specifically addressing tumor volume and
surface smoothness considerations. A-FL improves upon traditional focal loss
by dynamically adjusting focusing and balancing parameters at the pixel level
during training. This adaptation allows our models to achieve more balanced
and precise segmentation performance by integrating tumor volume and surface
smoothness as focal parameters, while also considering background volume for
class balancing. Experimental evaluations conducted on the Picai and BraTS
datasets using ResNet50-based U-Net architecture demonstrate the superior
performance of A-FL compared to conventional focal loss methods.

##  7 Acknowledgments

This research is funded by Grant No. 56.00.0000.052.33.001.23-59 from the ICT
Division, Bangladesh. The authors thank the Computer Vision & Intelligent
Interfacing (CVIIL) Lab, Islamic University, Bangladesh for providing high-
configuration computer setup for experiments. Special thanks to Biomedical
Robotics, AI, and Imaging Network (BioRain) Lab and SAIVT, QUT for their
ongoing support, contributions to the study design, and project supervision.

## References

  * [1] Hassan, R., Mondal, M.R.H., Ahamed, S.I.: Udbrnet: A novel uncertainty driven boundary refined network for organ at risk segmentation. PLOS ONE 19(6), 1–18 (06 2024). https://doi.org/10.1371/journal.pone.0304771
  * [2] He, K., Zhang, X., Ren, S., Sun, J.: Deep residual learning for image recognition. In: Proceedings of the IEEE conference on computer vision and pattern recognition. pp. 770–778 (2016)
  * [3] Ho, Y., Wookey, S.: The real-world-weight cross-entropy loss function: Modeling the costs of mislabeling. IEEE access 8, 4806–4813 (2019)
  * [4] Jadon, S.: A survey of loss functions for semantic segmentation. In: 2020 IEEE conference on computational intelligence in bioinformatics and computational biology (CIBCB). pp. 1–7. IEEE (2020)
  * [5] Leng, Z., Tan, M., Liu, C., Cubuk, E.D., Shi, X., Cheng, S., Anguelov, D.: Polyloss: A polynomial expansion perspective of classification loss functions. arXiv preprint arXiv:2204.12511 (2022)
  * [6] Lin, J., Xiao, Z., Wei, X., Duan, P., He, X., Dian, R., Li, Z., Li, S.: Click-pixel cognition fusion network with balanced cut for interactive image segmentation. IEEE Transactions on Image Processing 33, 177–190 (2023)
  * [7] Lin, T.Y., Goyal, P., Girshick, R., He, K., Dollár, P.: Focal loss for dense object detection. In: Proceedings of the IEEE international conference on computer vision. pp. 2980–2988 (2017)
  * [8] Maninis, K.K., Caelles, S., Pont-Tuset, J., Van Gool, L.: Deep extreme cut: From extreme points to object segmentation. In: Proceedings of the IEEE conference on computer vision and pattern recognition. pp. 616–625 (2018)
  * [9] Menze, B.H., Jakab, A., Bauer, S., Kalpathy-Cramer, J., Farahani, K., Kirby, J., Burren, Y., Porz, N., Slotboom, J., Wiest, R., et al.: The multimodal brain tumor image segmentation benchmark (brats). IEEE transactions on medical imaging 34(10), 1993–2024 (2014)
  * [10] Milletari, F., Navab, N., Ahmadi, S.A.: V-net: Fully convolutional neural networks for volumetric medical image segmentation. In: 2016 fourth international conference on 3D vision (3DV). pp. 565–571. Ieee (2016)
  * [11] Minaee, S., Boykov, Y., Porikli, F., Plaza, A., Kehtarnavaz, N., Terzopoulos, D.: Image segmentation using deep learning: A survey. IEEE transactions on pattern analysis and machine intelligence 44(7), 3523–3542 (2021)
  * [12] Nazib, A., Hassan, R., Islam, Z., Fookes, C.: Uncertainty driven bottleneck attention u-net for organ at risk segmentation (2024)
  * [13] Pais, G.D., Ramalingam, S., Govindu, V.M., Nascimento, J.C., Chellappa, R., Miraldo, P.: 3dregnet: A deep neural network for 3d point registration. In: Proceedings of the IEEE/CVF conference on computer vision and pattern recognition. pp. 7193–7203 (2020)
  * [14] Pihur, V., Datta, S., Datta, S.: Weighted rank aggregation of cluster validation measures: a monte carlo cross-entropy approach. Bioinformatics 23(13), 1607–1615 (2007)
  * [15] Rahman, M.A., Wang, Y.: Optimizing intersection-over-union in deep neural networks for image segmentation. In: International symposium on visual computing. pp. 234–244. Springer (2016)
  * [16] Robbins, H., Monro, S.: A stochastic approximation method. The annals of mathematical statistics pp. 400–407 (1951)
  * [17] Ronneberger, O., Fischer, P., Brox, T.: U-net: Convolutional networks for biomedical image segmentation. In: Medical image computing and computer-assisted intervention–MICCAI 2015: 18th international conference, Munich, Germany, October 5-9, 2015, proceedings, part III 18. pp. 234–241. Springer (2015)
  * [18] Roy, R., Annappa, B., Dodia, S.: 3d attu-net for brain tumor segmentation with a novel loss function. In: 2023 6th International Conference on Information Systems and Computer Networks (ISCON). pp. 1–8. IEEE (2023)
  * [19] Ruby, U., Yendapalli, V.: Binary cross entropy with deep learning technique for image classification. Int. J. Adv. Trends Comput. Sci. Eng 9(10) (2020)
  * [20] Saha, A., Bosma, J.S., Twilt, J.J., van Ginneken, B., the PI-CAI consortium: Artificial intelligence and radiologists in prostate cancer detection on mri (pi-cai): an international, paired, non-inferiority, confirmatory study. The Lancet Oncology 25(7), 879–887 (2024). https://doi.org/https://doi.org/10.1016/S1470-2045(24)00220-1
  * [21] Santambrogio, F.: $\\{$Euclidean, metric, and Wasserstein$\\}$ gradient flows: an overview. Bulletin of Mathematical Sciences 7, 87–154 (2017)
  * [22] Sofiiuk, K., Barinova, O., Konushin, A.: Adaptis: Adaptive instance selection network. In: Proceedings of the IEEE/CVF international conference on computer vision. pp. 7355–7363 (2019)
  * [23] Sudre, C.H., Li, W., Vercauteren, T., Ourselin, S., Jorge Cardoso, M.: Generalised dice overlap as a deep learning loss function for highly unbalanced segmentations. In: Deep Learning in Medical Image Analysis and Multimodal Learning for Clinical Decision Support: Third International Workshop, DLMIA 2017, and 7th International Workshop, ML-CDS 2017, Held in Conjunction with MICCAI 2017, Québec City, QC, Canada, September 14, Proceedings 3. pp. 240–248. Springer (2017)
  * [24] Wu, D., Zhang, R., Pore, A., Dall’Alba, D., Ha, X.T., Li, Z., Zhang, Y., Herrera, F., Ourak, M., Kowalczyk, W., et al.: A review on machine learning in flexible surgical and interventional robots: Where we are and where we are going. Biomedical Signal Processing and Control 93, 106179 (2024)
  * [25] Xie, S., Tu, Z.: Holistically-nested edge detection. In: Proceedings of the IEEE international conference on computer vision. pp. 1395–1403 (2015)
  * [26] Zhang, Y., Shen, Z., Jiao, R.: Segment anything model for medical image segmentation: Current applications and future directions. Computers in Biology and Medicine p. 108238 (2024)